Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1 | // @generated by pegen.py from ./Grammar/python.gram |
| 2 | #include "pegen.h" |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 3 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4 | #if defined(Py_DEBUG) && defined(Py_BUILD_CORE) |
Victor Stinner | 6af528b | 2021-03-18 09:54:13 +0100 | [diff] [blame^] | 5 | # define D(x) if (Py_DebugFlag) x; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 6 | #else |
Victor Stinner | 6af528b | 2021-03-18 09:54:13 +0100 | [diff] [blame^] | 7 | # define D(x) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 8 | #endif |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9 | static const int n_keyword_lists = 9; |
| 10 | static KeywordToken *reserved_keywords[] = { |
Pablo Galindo | 1ac0cbc | 2020-07-06 20:31:16 +0100 | [diff] [blame] | 11 | (KeywordToken[]) {{NULL, -1}}, |
| 12 | (KeywordToken[]) {{NULL, -1}}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13 | (KeywordToken[]) { |
| 14 | {"if", 510}, |
| 15 | {"in", 518}, |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16 | {"as", 520}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17 | {"is", 530}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18 | {"or", 531}, |
| 19 | {NULL, -1}, |
| 20 | }, |
| 21 | (KeywordToken[]) { |
| 22 | {"del", 503}, |
| 23 | {"try", 511}, |
| 24 | {"for", 517}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25 | {"def", 526}, |
| 26 | {"not", 529}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27 | {"and", 532}, |
| 28 | {NULL, -1}, |
| 29 | }, |
| 30 | (KeywordToken[]) { |
| 31 | {"pass", 502}, |
| 32 | {"from", 514}, |
| 33 | {"elif", 515}, |
| 34 | {"else", 516}, |
| 35 | {"with", 519}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 36 | {"None", 523}, |
| 37 | {"True", 524}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 38 | {NULL, -1}, |
| 39 | }, |
| 40 | (KeywordToken[]) { |
| 41 | {"raise", 501}, |
| 42 | {"yield", 504}, |
| 43 | {"break", 506}, |
| 44 | {"while", 512}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 45 | {"False", 525}, |
| 46 | {"class", 527}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 47 | {NULL, -1}, |
| 48 | }, |
| 49 | (KeywordToken[]) { |
| 50 | {"return", 500}, |
| 51 | {"assert", 505}, |
| 52 | {"global", 508}, |
| 53 | {"import", 513}, |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 54 | {"except", 521}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 55 | {"lambda", 528}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 56 | {NULL, -1}, |
| 57 | }, |
| 58 | (KeywordToken[]) { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 59 | {"finally", 522}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 60 | {NULL, -1}, |
| 61 | }, |
| 62 | (KeywordToken[]) { |
| 63 | {"continue", 507}, |
| 64 | {"nonlocal", 509}, |
| 65 | {NULL, -1}, |
| 66 | }, |
| 67 | }; |
| 68 | #define file_type 1000 |
| 69 | #define interactive_type 1001 |
| 70 | #define eval_type 1002 |
| 71 | #define func_type_type 1003 |
| 72 | #define fstring_type 1004 |
| 73 | #define type_expressions_type 1005 |
| 74 | #define statements_type 1006 |
| 75 | #define statement_type 1007 |
| 76 | #define statement_newline_type 1008 |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 77 | #define simple_stmts_type 1009 |
| 78 | #define simple_stmt_type 1010 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 79 | #define compound_stmt_type 1011 |
| 80 | #define assignment_type 1012 |
| 81 | #define augassign_type 1013 |
| 82 | #define global_stmt_type 1014 |
| 83 | #define nonlocal_stmt_type 1015 |
| 84 | #define yield_stmt_type 1016 |
| 85 | #define assert_stmt_type 1017 |
| 86 | #define del_stmt_type 1018 |
| 87 | #define import_stmt_type 1019 |
| 88 | #define import_name_type 1020 |
| 89 | #define import_from_type 1021 |
| 90 | #define import_from_targets_type 1022 |
| 91 | #define import_from_as_names_type 1023 |
| 92 | #define import_from_as_name_type 1024 |
| 93 | #define dotted_as_names_type 1025 |
| 94 | #define dotted_as_name_type 1026 |
| 95 | #define dotted_name_type 1027 // Left-recursive |
| 96 | #define if_stmt_type 1028 |
| 97 | #define elif_stmt_type 1029 |
| 98 | #define else_block_type 1030 |
| 99 | #define while_stmt_type 1031 |
| 100 | #define for_stmt_type 1032 |
| 101 | #define with_stmt_type 1033 |
| 102 | #define with_item_type 1034 |
| 103 | #define try_stmt_type 1035 |
| 104 | #define except_block_type 1036 |
| 105 | #define finally_block_type 1037 |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 106 | #define match_stmt_type 1038 |
| 107 | #define subject_expr_type 1039 |
| 108 | #define case_block_type 1040 |
| 109 | #define guard_type 1041 |
| 110 | #define patterns_type 1042 |
| 111 | #define pattern_type 1043 |
| 112 | #define as_pattern_type 1044 |
| 113 | #define or_pattern_type 1045 |
| 114 | #define closed_pattern_type 1046 |
| 115 | #define literal_pattern_type 1047 |
| 116 | #define signed_number_type 1048 |
| 117 | #define capture_pattern_type 1049 |
| 118 | #define wildcard_pattern_type 1050 |
| 119 | #define value_pattern_type 1051 |
| 120 | #define attr_type 1052 // Left-recursive |
| 121 | #define name_or_attr_type 1053 // Left-recursive |
| 122 | #define group_pattern_type 1054 |
| 123 | #define sequence_pattern_type 1055 |
| 124 | #define open_sequence_pattern_type 1056 |
| 125 | #define maybe_sequence_pattern_type 1057 |
| 126 | #define maybe_star_pattern_type 1058 |
| 127 | #define star_pattern_type 1059 |
| 128 | #define mapping_pattern_type 1060 |
| 129 | #define items_pattern_type 1061 |
| 130 | #define key_value_pattern_type 1062 |
| 131 | #define double_star_pattern_type 1063 |
| 132 | #define class_pattern_type 1064 |
| 133 | #define positional_patterns_type 1065 |
| 134 | #define keyword_patterns_type 1066 |
| 135 | #define keyword_pattern_type 1067 |
| 136 | #define return_stmt_type 1068 |
| 137 | #define raise_stmt_type 1069 |
| 138 | #define function_def_type 1070 |
| 139 | #define function_def_raw_type 1071 |
| 140 | #define func_type_comment_type 1072 |
| 141 | #define params_type 1073 |
| 142 | #define parameters_type 1074 |
| 143 | #define slash_no_default_type 1075 |
| 144 | #define slash_with_default_type 1076 |
| 145 | #define star_etc_type 1077 |
| 146 | #define kwds_type 1078 |
| 147 | #define param_no_default_type 1079 |
| 148 | #define param_with_default_type 1080 |
| 149 | #define param_maybe_default_type 1081 |
| 150 | #define param_type 1082 |
| 151 | #define annotation_type 1083 |
| 152 | #define default_type 1084 |
| 153 | #define decorators_type 1085 |
| 154 | #define class_def_type 1086 |
| 155 | #define class_def_raw_type 1087 |
| 156 | #define block_type 1088 |
| 157 | #define star_expressions_type 1089 |
| 158 | #define star_expression_type 1090 |
| 159 | #define star_named_expressions_type 1091 |
| 160 | #define star_named_expression_type 1092 |
| 161 | #define named_expression_type 1093 |
| 162 | #define annotated_rhs_type 1094 |
| 163 | #define expressions_type 1095 |
| 164 | #define expression_type 1096 |
| 165 | #define lambdef_type 1097 |
| 166 | #define lambda_params_type 1098 |
| 167 | #define lambda_parameters_type 1099 |
| 168 | #define lambda_slash_no_default_type 1100 |
| 169 | #define lambda_slash_with_default_type 1101 |
| 170 | #define lambda_star_etc_type 1102 |
| 171 | #define lambda_kwds_type 1103 |
| 172 | #define lambda_param_no_default_type 1104 |
| 173 | #define lambda_param_with_default_type 1105 |
| 174 | #define lambda_param_maybe_default_type 1106 |
| 175 | #define lambda_param_type 1107 |
| 176 | #define disjunction_type 1108 |
| 177 | #define conjunction_type 1109 |
| 178 | #define inversion_type 1110 |
| 179 | #define comparison_type 1111 |
| 180 | #define compare_op_bitwise_or_pair_type 1112 |
| 181 | #define eq_bitwise_or_type 1113 |
| 182 | #define noteq_bitwise_or_type 1114 |
| 183 | #define lte_bitwise_or_type 1115 |
| 184 | #define lt_bitwise_or_type 1116 |
| 185 | #define gte_bitwise_or_type 1117 |
| 186 | #define gt_bitwise_or_type 1118 |
| 187 | #define notin_bitwise_or_type 1119 |
| 188 | #define in_bitwise_or_type 1120 |
| 189 | #define isnot_bitwise_or_type 1121 |
| 190 | #define is_bitwise_or_type 1122 |
| 191 | #define bitwise_or_type 1123 // Left-recursive |
| 192 | #define bitwise_xor_type 1124 // Left-recursive |
| 193 | #define bitwise_and_type 1125 // Left-recursive |
| 194 | #define shift_expr_type 1126 // Left-recursive |
| 195 | #define sum_type 1127 // Left-recursive |
| 196 | #define term_type 1128 // Left-recursive |
| 197 | #define factor_type 1129 |
| 198 | #define power_type 1130 |
| 199 | #define await_primary_type 1131 |
| 200 | #define primary_type 1132 // Left-recursive |
| 201 | #define slices_type 1133 |
| 202 | #define slice_type 1134 |
| 203 | #define atom_type 1135 |
| 204 | #define strings_type 1136 |
| 205 | #define list_type 1137 |
| 206 | #define listcomp_type 1138 |
| 207 | #define tuple_type 1139 |
| 208 | #define group_type 1140 |
| 209 | #define genexp_type 1141 |
| 210 | #define set_type 1142 |
| 211 | #define setcomp_type 1143 |
| 212 | #define dict_type 1144 |
| 213 | #define dictcomp_type 1145 |
| 214 | #define double_starred_kvpairs_type 1146 |
| 215 | #define double_starred_kvpair_type 1147 |
| 216 | #define kvpair_type 1148 |
| 217 | #define for_if_clauses_type 1149 |
| 218 | #define for_if_clause_type 1150 |
| 219 | #define yield_expr_type 1151 |
| 220 | #define arguments_type 1152 |
| 221 | #define args_type 1153 |
| 222 | #define kwargs_type 1154 |
| 223 | #define starred_expression_type 1155 |
| 224 | #define kwarg_or_starred_type 1156 |
| 225 | #define kwarg_or_double_starred_type 1157 |
| 226 | #define star_targets_type 1158 |
| 227 | #define star_targets_list_seq_type 1159 |
| 228 | #define star_targets_tuple_seq_type 1160 |
| 229 | #define star_target_type 1161 |
| 230 | #define target_with_star_atom_type 1162 |
| 231 | #define star_atom_type 1163 |
| 232 | #define single_target_type 1164 |
| 233 | #define single_subscript_attribute_target_type 1165 |
| 234 | #define del_targets_type 1166 |
| 235 | #define del_target_type 1167 |
| 236 | #define del_t_atom_type 1168 |
| 237 | #define targets_type 1169 |
| 238 | #define target_type 1170 |
| 239 | #define t_primary_type 1171 // Left-recursive |
| 240 | #define t_lookahead_type 1172 |
| 241 | #define t_atom_type 1173 |
| 242 | #define invalid_arguments_type 1174 |
| 243 | #define invalid_kwarg_type 1175 |
| 244 | #define invalid_named_expression_type 1176 |
| 245 | #define invalid_assignment_type 1177 |
| 246 | #define invalid_ann_assign_target_type 1178 |
| 247 | #define invalid_del_stmt_type 1179 |
| 248 | #define invalid_block_type 1180 |
| 249 | #define invalid_primary_type 1181 // Left-recursive |
| 250 | #define invalid_comprehension_type 1182 |
| 251 | #define invalid_dict_comprehension_type 1183 |
| 252 | #define invalid_parameters_type 1184 |
| 253 | #define invalid_parameters_helper_type 1185 |
| 254 | #define invalid_lambda_parameters_type 1186 |
| 255 | #define invalid_lambda_parameters_helper_type 1187 |
| 256 | #define invalid_star_etc_type 1188 |
| 257 | #define invalid_lambda_star_etc_type 1189 |
| 258 | #define invalid_double_type_comments_type 1190 |
| 259 | #define invalid_with_item_type 1191 |
| 260 | #define invalid_for_target_type 1192 |
| 261 | #define invalid_group_type 1193 |
| 262 | #define invalid_import_from_targets_type 1194 |
| 263 | #define invalid_with_stmt_type 1195 |
| 264 | #define invalid_except_block_type 1196 |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 265 | #define invalid_match_stmt_type 1197 |
| 266 | #define invalid_case_block_type 1198 |
| 267 | #define _loop0_1_type 1199 |
| 268 | #define _loop0_2_type 1200 |
| 269 | #define _loop0_4_type 1201 |
| 270 | #define _gather_3_type 1202 |
| 271 | #define _loop0_6_type 1203 |
| 272 | #define _gather_5_type 1204 |
| 273 | #define _loop0_8_type 1205 |
| 274 | #define _gather_7_type 1206 |
| 275 | #define _loop0_10_type 1207 |
| 276 | #define _gather_9_type 1208 |
| 277 | #define _loop1_11_type 1209 |
| 278 | #define _loop0_13_type 1210 |
| 279 | #define _gather_12_type 1211 |
| 280 | #define _tmp_14_type 1212 |
| 281 | #define _tmp_15_type 1213 |
| 282 | #define _tmp_16_type 1214 |
| 283 | #define _tmp_17_type 1215 |
| 284 | #define _tmp_18_type 1216 |
| 285 | #define _tmp_19_type 1217 |
| 286 | #define _tmp_20_type 1218 |
| 287 | #define _tmp_21_type 1219 |
| 288 | #define _loop1_22_type 1220 |
| 289 | #define _tmp_23_type 1221 |
| 290 | #define _tmp_24_type 1222 |
| 291 | #define _loop0_26_type 1223 |
| 292 | #define _gather_25_type 1224 |
| 293 | #define _loop0_28_type 1225 |
| 294 | #define _gather_27_type 1226 |
| 295 | #define _tmp_29_type 1227 |
| 296 | #define _tmp_30_type 1228 |
| 297 | #define _loop0_31_type 1229 |
| 298 | #define _loop1_32_type 1230 |
| 299 | #define _loop0_34_type 1231 |
| 300 | #define _gather_33_type 1232 |
| 301 | #define _tmp_35_type 1233 |
| 302 | #define _loop0_37_type 1234 |
| 303 | #define _gather_36_type 1235 |
| 304 | #define _tmp_38_type 1236 |
| 305 | #define _loop0_40_type 1237 |
| 306 | #define _gather_39_type 1238 |
| 307 | #define _loop0_42_type 1239 |
| 308 | #define _gather_41_type 1240 |
| 309 | #define _loop0_44_type 1241 |
| 310 | #define _gather_43_type 1242 |
| 311 | #define _loop0_46_type 1243 |
| 312 | #define _gather_45_type 1244 |
| 313 | #define _tmp_47_type 1245 |
| 314 | #define _loop1_48_type 1246 |
| 315 | #define _tmp_49_type 1247 |
| 316 | #define _loop1_50_type 1248 |
| 317 | #define _loop0_52_type 1249 |
| 318 | #define _gather_51_type 1250 |
| 319 | #define _tmp_53_type 1251 |
| 320 | #define _tmp_54_type 1252 |
| 321 | #define _tmp_55_type 1253 |
| 322 | #define _loop0_57_type 1254 |
| 323 | #define _gather_56_type 1255 |
| 324 | #define _tmp_58_type 1256 |
| 325 | #define _loop0_60_type 1257 |
| 326 | #define _gather_59_type 1258 |
| 327 | #define _tmp_61_type 1259 |
| 328 | #define _loop0_63_type 1260 |
| 329 | #define _gather_62_type 1261 |
| 330 | #define _loop0_65_type 1262 |
| 331 | #define _gather_64_type 1263 |
| 332 | #define _tmp_66_type 1264 |
| 333 | #define _tmp_67_type 1265 |
| 334 | #define _tmp_68_type 1266 |
| 335 | #define _tmp_69_type 1267 |
| 336 | #define _loop0_70_type 1268 |
| 337 | #define _loop0_71_type 1269 |
| 338 | #define _loop0_72_type 1270 |
| 339 | #define _loop1_73_type 1271 |
| 340 | #define _loop0_74_type 1272 |
| 341 | #define _loop1_75_type 1273 |
| 342 | #define _loop1_76_type 1274 |
| 343 | #define _loop1_77_type 1275 |
| 344 | #define _loop0_78_type 1276 |
| 345 | #define _loop1_79_type 1277 |
| 346 | #define _loop0_80_type 1278 |
| 347 | #define _loop1_81_type 1279 |
| 348 | #define _loop0_82_type 1280 |
| 349 | #define _loop1_83_type 1281 |
| 350 | #define _loop1_84_type 1282 |
| 351 | #define _tmp_85_type 1283 |
| 352 | #define _loop1_86_type 1284 |
| 353 | #define _loop0_88_type 1285 |
| 354 | #define _gather_87_type 1286 |
| 355 | #define _loop1_89_type 1287 |
| 356 | #define _loop0_90_type 1288 |
| 357 | #define _loop0_91_type 1289 |
| 358 | #define _loop0_92_type 1290 |
| 359 | #define _loop1_93_type 1291 |
| 360 | #define _loop0_94_type 1292 |
| 361 | #define _loop1_95_type 1293 |
| 362 | #define _loop1_96_type 1294 |
| 363 | #define _loop1_97_type 1295 |
| 364 | #define _loop0_98_type 1296 |
| 365 | #define _loop1_99_type 1297 |
| 366 | #define _loop0_100_type 1298 |
| 367 | #define _loop1_101_type 1299 |
| 368 | #define _loop0_102_type 1300 |
| 369 | #define _loop1_103_type 1301 |
| 370 | #define _loop1_104_type 1302 |
| 371 | #define _loop1_105_type 1303 |
| 372 | #define _loop1_106_type 1304 |
| 373 | #define _tmp_107_type 1305 |
| 374 | #define _loop0_109_type 1306 |
| 375 | #define _gather_108_type 1307 |
| 376 | #define _tmp_110_type 1308 |
| 377 | #define _tmp_111_type 1309 |
| 378 | #define _tmp_112_type 1310 |
| 379 | #define _tmp_113_type 1311 |
| 380 | #define _loop1_114_type 1312 |
| 381 | #define _tmp_115_type 1313 |
| 382 | #define _tmp_116_type 1314 |
| 383 | #define _loop0_118_type 1315 |
| 384 | #define _gather_117_type 1316 |
| 385 | #define _loop1_119_type 1317 |
| 386 | #define _loop0_120_type 1318 |
| 387 | #define _loop0_121_type 1319 |
| 388 | #define _loop0_123_type 1320 |
| 389 | #define _gather_122_type 1321 |
| 390 | #define _tmp_124_type 1322 |
| 391 | #define _loop0_126_type 1323 |
| 392 | #define _gather_125_type 1324 |
| 393 | #define _loop0_128_type 1325 |
| 394 | #define _gather_127_type 1326 |
| 395 | #define _loop0_130_type 1327 |
| 396 | #define _gather_129_type 1328 |
| 397 | #define _loop0_132_type 1329 |
| 398 | #define _gather_131_type 1330 |
| 399 | #define _loop0_133_type 1331 |
| 400 | #define _loop0_135_type 1332 |
| 401 | #define _gather_134_type 1333 |
| 402 | #define _loop1_136_type 1334 |
| 403 | #define _tmp_137_type 1335 |
| 404 | #define _loop0_139_type 1336 |
| 405 | #define _gather_138_type 1337 |
| 406 | #define _loop0_141_type 1338 |
| 407 | #define _gather_140_type 1339 |
| 408 | #define _tmp_142_type 1340 |
| 409 | #define _loop0_143_type 1341 |
| 410 | #define _loop0_144_type 1342 |
| 411 | #define _loop0_145_type 1343 |
| 412 | #define _tmp_146_type 1344 |
| 413 | #define _tmp_147_type 1345 |
| 414 | #define _tmp_148_type 1346 |
| 415 | #define _loop0_149_type 1347 |
| 416 | #define _loop1_150_type 1348 |
| 417 | #define _loop0_151_type 1349 |
| 418 | #define _loop1_152_type 1350 |
| 419 | #define _tmp_153_type 1351 |
| 420 | #define _tmp_154_type 1352 |
| 421 | #define _tmp_155_type 1353 |
| 422 | #define _loop0_157_type 1354 |
| 423 | #define _gather_156_type 1355 |
| 424 | #define _loop0_159_type 1356 |
| 425 | #define _gather_158_type 1357 |
| 426 | #define _tmp_160_type 1358 |
| 427 | #define _tmp_161_type 1359 |
| 428 | #define _tmp_162_type 1360 |
| 429 | #define _tmp_163_type 1361 |
| 430 | #define _tmp_164_type 1362 |
| 431 | #define _tmp_165_type 1363 |
| 432 | #define _tmp_166_type 1364 |
| 433 | #define _tmp_167_type 1365 |
| 434 | #define _tmp_168_type 1366 |
| 435 | #define _tmp_169_type 1367 |
| 436 | #define _tmp_170_type 1368 |
| 437 | #define _tmp_171_type 1369 |
| 438 | #define _tmp_172_type 1370 |
| 439 | #define _tmp_173_type 1371 |
| 440 | #define _tmp_174_type 1372 |
| 441 | #define _tmp_175_type 1373 |
| 442 | #define _tmp_176_type 1374 |
| 443 | #define _tmp_177_type 1375 |
| 444 | #define _tmp_178_type 1376 |
| 445 | #define _tmp_179_type 1377 |
| 446 | #define _tmp_180_type 1378 |
| 447 | #define _tmp_181_type 1379 |
| 448 | #define _tmp_182_type 1380 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 449 | |
| 450 | static mod_ty file_rule(Parser *p); |
| 451 | static mod_ty interactive_rule(Parser *p); |
| 452 | static mod_ty eval_rule(Parser *p); |
| 453 | static mod_ty func_type_rule(Parser *p); |
| 454 | static expr_ty fstring_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 455 | static asdl_expr_seq* type_expressions_rule(Parser *p); |
| 456 | static asdl_stmt_seq* statements_rule(Parser *p); |
| 457 | static asdl_stmt_seq* statement_rule(Parser *p); |
| 458 | static asdl_stmt_seq* statement_newline_rule(Parser *p); |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 459 | static asdl_stmt_seq* simple_stmts_rule(Parser *p); |
| 460 | static stmt_ty simple_stmt_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 461 | static stmt_ty compound_stmt_rule(Parser *p); |
| 462 | static stmt_ty assignment_rule(Parser *p); |
| 463 | static AugOperator* augassign_rule(Parser *p); |
| 464 | static stmt_ty global_stmt_rule(Parser *p); |
| 465 | static stmt_ty nonlocal_stmt_rule(Parser *p); |
| 466 | static stmt_ty yield_stmt_rule(Parser *p); |
| 467 | static stmt_ty assert_stmt_rule(Parser *p); |
| 468 | static stmt_ty del_stmt_rule(Parser *p); |
| 469 | static stmt_ty import_stmt_rule(Parser *p); |
| 470 | static stmt_ty import_name_rule(Parser *p); |
| 471 | static stmt_ty import_from_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 472 | static asdl_alias_seq* import_from_targets_rule(Parser *p); |
| 473 | static asdl_alias_seq* import_from_as_names_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 474 | static alias_ty import_from_as_name_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 475 | static asdl_alias_seq* dotted_as_names_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 476 | static alias_ty dotted_as_name_rule(Parser *p); |
| 477 | static expr_ty dotted_name_rule(Parser *p); |
| 478 | static stmt_ty if_stmt_rule(Parser *p); |
| 479 | static stmt_ty elif_stmt_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 480 | static asdl_stmt_seq* else_block_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 481 | static stmt_ty while_stmt_rule(Parser *p); |
| 482 | static stmt_ty for_stmt_rule(Parser *p); |
| 483 | static stmt_ty with_stmt_rule(Parser *p); |
| 484 | static withitem_ty with_item_rule(Parser *p); |
| 485 | static stmt_ty try_stmt_rule(Parser *p); |
| 486 | static excepthandler_ty except_block_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 487 | static asdl_stmt_seq* finally_block_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 488 | static stmt_ty match_stmt_rule(Parser *p); |
| 489 | static expr_ty subject_expr_rule(Parser *p); |
| 490 | static match_case_ty case_block_rule(Parser *p); |
| 491 | static expr_ty guard_rule(Parser *p); |
| 492 | static expr_ty patterns_rule(Parser *p); |
| 493 | static expr_ty pattern_rule(Parser *p); |
| 494 | static expr_ty as_pattern_rule(Parser *p); |
| 495 | static expr_ty or_pattern_rule(Parser *p); |
| 496 | static expr_ty closed_pattern_rule(Parser *p); |
| 497 | static expr_ty literal_pattern_rule(Parser *p); |
| 498 | static expr_ty signed_number_rule(Parser *p); |
| 499 | static expr_ty capture_pattern_rule(Parser *p); |
| 500 | static expr_ty wildcard_pattern_rule(Parser *p); |
| 501 | static expr_ty value_pattern_rule(Parser *p); |
| 502 | static expr_ty attr_rule(Parser *p); |
| 503 | static expr_ty name_or_attr_rule(Parser *p); |
| 504 | static expr_ty group_pattern_rule(Parser *p); |
| 505 | static expr_ty sequence_pattern_rule(Parser *p); |
| 506 | static asdl_seq* open_sequence_pattern_rule(Parser *p); |
| 507 | static asdl_seq* maybe_sequence_pattern_rule(Parser *p); |
| 508 | static expr_ty maybe_star_pattern_rule(Parser *p); |
| 509 | static expr_ty star_pattern_rule(Parser *p); |
| 510 | static expr_ty mapping_pattern_rule(Parser *p); |
| 511 | static asdl_seq* items_pattern_rule(Parser *p); |
| 512 | static KeyValuePair* key_value_pattern_rule(Parser *p); |
| 513 | static KeyValuePair* double_star_pattern_rule(Parser *p); |
| 514 | static expr_ty class_pattern_rule(Parser *p); |
| 515 | static asdl_expr_seq* positional_patterns_rule(Parser *p); |
| 516 | static asdl_keyword_seq* keyword_patterns_rule(Parser *p); |
| 517 | static keyword_ty keyword_pattern_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 518 | static stmt_ty return_stmt_rule(Parser *p); |
| 519 | static stmt_ty raise_stmt_rule(Parser *p); |
| 520 | static stmt_ty function_def_rule(Parser *p); |
| 521 | static stmt_ty function_def_raw_rule(Parser *p); |
| 522 | static Token* func_type_comment_rule(Parser *p); |
| 523 | static arguments_ty params_rule(Parser *p); |
| 524 | static arguments_ty parameters_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 525 | static asdl_arg_seq* slash_no_default_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 526 | static SlashWithDefault* slash_with_default_rule(Parser *p); |
| 527 | static StarEtc* star_etc_rule(Parser *p); |
| 528 | static arg_ty kwds_rule(Parser *p); |
| 529 | static arg_ty param_no_default_rule(Parser *p); |
| 530 | static NameDefaultPair* param_with_default_rule(Parser *p); |
| 531 | static NameDefaultPair* param_maybe_default_rule(Parser *p); |
| 532 | static arg_ty param_rule(Parser *p); |
| 533 | static expr_ty annotation_rule(Parser *p); |
| 534 | static expr_ty default_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 535 | static asdl_expr_seq* decorators_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 536 | static stmt_ty class_def_rule(Parser *p); |
| 537 | static stmt_ty class_def_raw_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 538 | static asdl_stmt_seq* block_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 539 | static expr_ty star_expressions_rule(Parser *p); |
| 540 | static expr_ty star_expression_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 541 | static asdl_expr_seq* star_named_expressions_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 542 | static expr_ty star_named_expression_rule(Parser *p); |
| 543 | static expr_ty named_expression_rule(Parser *p); |
| 544 | static expr_ty annotated_rhs_rule(Parser *p); |
| 545 | static expr_ty expressions_rule(Parser *p); |
| 546 | static expr_ty expression_rule(Parser *p); |
| 547 | static expr_ty lambdef_rule(Parser *p); |
| 548 | static arguments_ty lambda_params_rule(Parser *p); |
| 549 | static arguments_ty lambda_parameters_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 550 | static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 551 | static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); |
| 552 | static StarEtc* lambda_star_etc_rule(Parser *p); |
| 553 | static arg_ty lambda_kwds_rule(Parser *p); |
| 554 | static arg_ty lambda_param_no_default_rule(Parser *p); |
| 555 | static NameDefaultPair* lambda_param_with_default_rule(Parser *p); |
| 556 | static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p); |
| 557 | static arg_ty lambda_param_rule(Parser *p); |
| 558 | static expr_ty disjunction_rule(Parser *p); |
| 559 | static expr_ty conjunction_rule(Parser *p); |
| 560 | static expr_ty inversion_rule(Parser *p); |
| 561 | static expr_ty comparison_rule(Parser *p); |
| 562 | static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p); |
| 563 | static CmpopExprPair* eq_bitwise_or_rule(Parser *p); |
| 564 | static CmpopExprPair* noteq_bitwise_or_rule(Parser *p); |
| 565 | static CmpopExprPair* lte_bitwise_or_rule(Parser *p); |
| 566 | static CmpopExprPair* lt_bitwise_or_rule(Parser *p); |
| 567 | static CmpopExprPair* gte_bitwise_or_rule(Parser *p); |
| 568 | static CmpopExprPair* gt_bitwise_or_rule(Parser *p); |
| 569 | static CmpopExprPair* notin_bitwise_or_rule(Parser *p); |
| 570 | static CmpopExprPair* in_bitwise_or_rule(Parser *p); |
| 571 | static CmpopExprPair* isnot_bitwise_or_rule(Parser *p); |
| 572 | static CmpopExprPair* is_bitwise_or_rule(Parser *p); |
| 573 | static expr_ty bitwise_or_rule(Parser *p); |
| 574 | static expr_ty bitwise_xor_rule(Parser *p); |
| 575 | static expr_ty bitwise_and_rule(Parser *p); |
| 576 | static expr_ty shift_expr_rule(Parser *p); |
| 577 | static expr_ty sum_rule(Parser *p); |
| 578 | static expr_ty term_rule(Parser *p); |
| 579 | static expr_ty factor_rule(Parser *p); |
| 580 | static expr_ty power_rule(Parser *p); |
| 581 | static expr_ty await_primary_rule(Parser *p); |
| 582 | static expr_ty primary_rule(Parser *p); |
| 583 | static expr_ty slices_rule(Parser *p); |
| 584 | static expr_ty slice_rule(Parser *p); |
| 585 | static expr_ty atom_rule(Parser *p); |
| 586 | static expr_ty strings_rule(Parser *p); |
| 587 | static expr_ty list_rule(Parser *p); |
| 588 | static expr_ty listcomp_rule(Parser *p); |
| 589 | static expr_ty tuple_rule(Parser *p); |
| 590 | static expr_ty group_rule(Parser *p); |
| 591 | static expr_ty genexp_rule(Parser *p); |
| 592 | static expr_ty set_rule(Parser *p); |
| 593 | static expr_ty setcomp_rule(Parser *p); |
| 594 | static expr_ty dict_rule(Parser *p); |
| 595 | static expr_ty dictcomp_rule(Parser *p); |
| 596 | static asdl_seq* double_starred_kvpairs_rule(Parser *p); |
| 597 | static KeyValuePair* double_starred_kvpair_rule(Parser *p); |
| 598 | static KeyValuePair* kvpair_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 599 | static asdl_comprehension_seq* for_if_clauses_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 600 | static comprehension_ty for_if_clause_rule(Parser *p); |
| 601 | static expr_ty yield_expr_rule(Parser *p); |
| 602 | static expr_ty arguments_rule(Parser *p); |
| 603 | static expr_ty args_rule(Parser *p); |
| 604 | static asdl_seq* kwargs_rule(Parser *p); |
| 605 | static expr_ty starred_expression_rule(Parser *p); |
| 606 | static KeywordOrStarred* kwarg_or_starred_rule(Parser *p); |
| 607 | static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p); |
| 608 | static expr_ty star_targets_rule(Parser *p); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 609 | static asdl_expr_seq* star_targets_list_seq_rule(Parser *p); |
| 610 | static asdl_expr_seq* star_targets_tuple_seq_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 611 | static expr_ty star_target_rule(Parser *p); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 612 | static expr_ty target_with_star_atom_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 613 | static expr_ty star_atom_rule(Parser *p); |
| 614 | static expr_ty single_target_rule(Parser *p); |
| 615 | static expr_ty single_subscript_attribute_target_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 616 | static asdl_expr_seq* del_targets_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 617 | static expr_ty del_target_rule(Parser *p); |
| 618 | static expr_ty del_t_atom_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 619 | static asdl_expr_seq* targets_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 620 | static expr_ty target_rule(Parser *p); |
| 621 | static expr_ty t_primary_rule(Parser *p); |
| 622 | static void *t_lookahead_rule(Parser *p); |
| 623 | static expr_ty t_atom_rule(Parser *p); |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 624 | static void *invalid_arguments_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 625 | static void *invalid_kwarg_rule(Parser *p); |
| 626 | static void *invalid_named_expression_rule(Parser *p); |
| 627 | static void *invalid_assignment_rule(Parser *p); |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 628 | static expr_ty invalid_ann_assign_target_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 629 | static void *invalid_del_stmt_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 630 | static void *invalid_block_rule(Parser *p); |
Lysandros Nikolaou | 15acc4e | 2020-10-27 20:54:20 +0200 | [diff] [blame] | 631 | static void *invalid_primary_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 632 | static void *invalid_comprehension_rule(Parser *p); |
| 633 | static void *invalid_dict_comprehension_rule(Parser *p); |
| 634 | static void *invalid_parameters_rule(Parser *p); |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 635 | static void *invalid_parameters_helper_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 636 | static void *invalid_lambda_parameters_rule(Parser *p); |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 637 | static void *invalid_lambda_parameters_helper_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 638 | static void *invalid_star_etc_rule(Parser *p); |
| 639 | static void *invalid_lambda_star_etc_rule(Parser *p); |
| 640 | static void *invalid_double_type_comments_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 641 | static void *invalid_with_item_rule(Parser *p); |
| 642 | static void *invalid_for_target_rule(Parser *p); |
| 643 | static void *invalid_group_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 644 | static void *invalid_import_from_targets_rule(Parser *p); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 645 | static void *invalid_with_stmt_rule(Parser *p); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 646 | static void *invalid_except_block_rule(Parser *p); |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 647 | static void *invalid_match_stmt_rule(Parser *p); |
| 648 | static void *invalid_case_block_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 649 | static asdl_seq *_loop0_1_rule(Parser *p); |
| 650 | static asdl_seq *_loop0_2_rule(Parser *p); |
| 651 | static asdl_seq *_loop0_4_rule(Parser *p); |
| 652 | static asdl_seq *_gather_3_rule(Parser *p); |
| 653 | static asdl_seq *_loop0_6_rule(Parser *p); |
| 654 | static asdl_seq *_gather_5_rule(Parser *p); |
| 655 | static asdl_seq *_loop0_8_rule(Parser *p); |
| 656 | static asdl_seq *_gather_7_rule(Parser *p); |
| 657 | static asdl_seq *_loop0_10_rule(Parser *p); |
| 658 | static asdl_seq *_gather_9_rule(Parser *p); |
| 659 | static asdl_seq *_loop1_11_rule(Parser *p); |
| 660 | static asdl_seq *_loop0_13_rule(Parser *p); |
| 661 | static asdl_seq *_gather_12_rule(Parser *p); |
| 662 | static void *_tmp_14_rule(Parser *p); |
| 663 | static void *_tmp_15_rule(Parser *p); |
| 664 | static void *_tmp_16_rule(Parser *p); |
| 665 | static void *_tmp_17_rule(Parser *p); |
| 666 | static void *_tmp_18_rule(Parser *p); |
| 667 | static void *_tmp_19_rule(Parser *p); |
| 668 | static void *_tmp_20_rule(Parser *p); |
| 669 | static void *_tmp_21_rule(Parser *p); |
| 670 | static asdl_seq *_loop1_22_rule(Parser *p); |
| 671 | static void *_tmp_23_rule(Parser *p); |
| 672 | static void *_tmp_24_rule(Parser *p); |
| 673 | static asdl_seq *_loop0_26_rule(Parser *p); |
| 674 | static asdl_seq *_gather_25_rule(Parser *p); |
| 675 | static asdl_seq *_loop0_28_rule(Parser *p); |
| 676 | static asdl_seq *_gather_27_rule(Parser *p); |
| 677 | static void *_tmp_29_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 678 | static void *_tmp_30_rule(Parser *p); |
| 679 | static asdl_seq *_loop0_31_rule(Parser *p); |
| 680 | static asdl_seq *_loop1_32_rule(Parser *p); |
| 681 | static asdl_seq *_loop0_34_rule(Parser *p); |
| 682 | static asdl_seq *_gather_33_rule(Parser *p); |
| 683 | static void *_tmp_35_rule(Parser *p); |
| 684 | static asdl_seq *_loop0_37_rule(Parser *p); |
| 685 | static asdl_seq *_gather_36_rule(Parser *p); |
| 686 | static void *_tmp_38_rule(Parser *p); |
| 687 | static asdl_seq *_loop0_40_rule(Parser *p); |
| 688 | static asdl_seq *_gather_39_rule(Parser *p); |
| 689 | static asdl_seq *_loop0_42_rule(Parser *p); |
| 690 | static asdl_seq *_gather_41_rule(Parser *p); |
| 691 | static asdl_seq *_loop0_44_rule(Parser *p); |
| 692 | static asdl_seq *_gather_43_rule(Parser *p); |
| 693 | static asdl_seq *_loop0_46_rule(Parser *p); |
| 694 | static asdl_seq *_gather_45_rule(Parser *p); |
| 695 | static void *_tmp_47_rule(Parser *p); |
| 696 | static asdl_seq *_loop1_48_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 697 | static void *_tmp_49_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 698 | static asdl_seq *_loop1_50_rule(Parser *p); |
| 699 | static asdl_seq *_loop0_52_rule(Parser *p); |
| 700 | static asdl_seq *_gather_51_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 701 | static void *_tmp_53_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 702 | static void *_tmp_54_rule(Parser *p); |
| 703 | static void *_tmp_55_rule(Parser *p); |
| 704 | static asdl_seq *_loop0_57_rule(Parser *p); |
| 705 | static asdl_seq *_gather_56_rule(Parser *p); |
| 706 | static void *_tmp_58_rule(Parser *p); |
| 707 | static asdl_seq *_loop0_60_rule(Parser *p); |
| 708 | static asdl_seq *_gather_59_rule(Parser *p); |
| 709 | static void *_tmp_61_rule(Parser *p); |
| 710 | static asdl_seq *_loop0_63_rule(Parser *p); |
| 711 | static asdl_seq *_gather_62_rule(Parser *p); |
| 712 | static asdl_seq *_loop0_65_rule(Parser *p); |
| 713 | static asdl_seq *_gather_64_rule(Parser *p); |
| 714 | static void *_tmp_66_rule(Parser *p); |
| 715 | static void *_tmp_67_rule(Parser *p); |
| 716 | static void *_tmp_68_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 717 | static void *_tmp_69_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 718 | static asdl_seq *_loop0_70_rule(Parser *p); |
| 719 | static asdl_seq *_loop0_71_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 720 | static asdl_seq *_loop0_72_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 721 | static asdl_seq *_loop1_73_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 722 | static asdl_seq *_loop0_74_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 723 | static asdl_seq *_loop1_75_rule(Parser *p); |
| 724 | static asdl_seq *_loop1_76_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 725 | static asdl_seq *_loop1_77_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 726 | static asdl_seq *_loop0_78_rule(Parser *p); |
| 727 | static asdl_seq *_loop1_79_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 728 | static asdl_seq *_loop0_80_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 729 | static asdl_seq *_loop1_81_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 730 | static asdl_seq *_loop0_82_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 731 | static asdl_seq *_loop1_83_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 732 | static asdl_seq *_loop1_84_rule(Parser *p); |
| 733 | static void *_tmp_85_rule(Parser *p); |
| 734 | static asdl_seq *_loop1_86_rule(Parser *p); |
| 735 | static asdl_seq *_loop0_88_rule(Parser *p); |
| 736 | static asdl_seq *_gather_87_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 737 | static asdl_seq *_loop1_89_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 738 | static asdl_seq *_loop0_90_rule(Parser *p); |
| 739 | static asdl_seq *_loop0_91_rule(Parser *p); |
| 740 | static asdl_seq *_loop0_92_rule(Parser *p); |
| 741 | static asdl_seq *_loop1_93_rule(Parser *p); |
| 742 | static asdl_seq *_loop0_94_rule(Parser *p); |
| 743 | static asdl_seq *_loop1_95_rule(Parser *p); |
| 744 | static asdl_seq *_loop1_96_rule(Parser *p); |
| 745 | static asdl_seq *_loop1_97_rule(Parser *p); |
| 746 | static asdl_seq *_loop0_98_rule(Parser *p); |
| 747 | static asdl_seq *_loop1_99_rule(Parser *p); |
| 748 | static asdl_seq *_loop0_100_rule(Parser *p); |
| 749 | static asdl_seq *_loop1_101_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 750 | static asdl_seq *_loop0_102_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 751 | static asdl_seq *_loop1_103_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 752 | static asdl_seq *_loop1_104_rule(Parser *p); |
| 753 | static asdl_seq *_loop1_105_rule(Parser *p); |
| 754 | static asdl_seq *_loop1_106_rule(Parser *p); |
| 755 | static void *_tmp_107_rule(Parser *p); |
| 756 | static asdl_seq *_loop0_109_rule(Parser *p); |
| 757 | static asdl_seq *_gather_108_rule(Parser *p); |
| 758 | static void *_tmp_110_rule(Parser *p); |
| 759 | static void *_tmp_111_rule(Parser *p); |
| 760 | static void *_tmp_112_rule(Parser *p); |
| 761 | static void *_tmp_113_rule(Parser *p); |
| 762 | static asdl_seq *_loop1_114_rule(Parser *p); |
| 763 | static void *_tmp_115_rule(Parser *p); |
| 764 | static void *_tmp_116_rule(Parser *p); |
| 765 | static asdl_seq *_loop0_118_rule(Parser *p); |
| 766 | static asdl_seq *_gather_117_rule(Parser *p); |
| 767 | static asdl_seq *_loop1_119_rule(Parser *p); |
| 768 | static asdl_seq *_loop0_120_rule(Parser *p); |
| 769 | static asdl_seq *_loop0_121_rule(Parser *p); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 770 | static asdl_seq *_loop0_123_rule(Parser *p); |
| 771 | static asdl_seq *_gather_122_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 772 | static void *_tmp_124_rule(Parser *p); |
| 773 | static asdl_seq *_loop0_126_rule(Parser *p); |
| 774 | static asdl_seq *_gather_125_rule(Parser *p); |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 775 | static asdl_seq *_loop0_128_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 776 | static asdl_seq *_gather_127_rule(Parser *p); |
| 777 | static asdl_seq *_loop0_130_rule(Parser *p); |
| 778 | static asdl_seq *_gather_129_rule(Parser *p); |
| 779 | static asdl_seq *_loop0_132_rule(Parser *p); |
| 780 | static asdl_seq *_gather_131_rule(Parser *p); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 781 | static asdl_seq *_loop0_133_rule(Parser *p); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 782 | static asdl_seq *_loop0_135_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 783 | static asdl_seq *_gather_134_rule(Parser *p); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 784 | static asdl_seq *_loop1_136_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 785 | static void *_tmp_137_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 786 | static asdl_seq *_loop0_139_rule(Parser *p); |
| 787 | static asdl_seq *_gather_138_rule(Parser *p); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 788 | static asdl_seq *_loop0_141_rule(Parser *p); |
| 789 | static asdl_seq *_gather_140_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 790 | static void *_tmp_142_rule(Parser *p); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 791 | static asdl_seq *_loop0_143_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 792 | static asdl_seq *_loop0_144_rule(Parser *p); |
| 793 | static asdl_seq *_loop0_145_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 794 | static void *_tmp_146_rule(Parser *p); |
| 795 | static void *_tmp_147_rule(Parser *p); |
| 796 | static void *_tmp_148_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 797 | static asdl_seq *_loop0_149_rule(Parser *p); |
| 798 | static asdl_seq *_loop1_150_rule(Parser *p); |
| 799 | static asdl_seq *_loop0_151_rule(Parser *p); |
| 800 | static asdl_seq *_loop1_152_rule(Parser *p); |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 801 | static void *_tmp_153_rule(Parser *p); |
| 802 | static void *_tmp_154_rule(Parser *p); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 803 | static void *_tmp_155_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 804 | static asdl_seq *_loop0_157_rule(Parser *p); |
| 805 | static asdl_seq *_gather_156_rule(Parser *p); |
| 806 | static asdl_seq *_loop0_159_rule(Parser *p); |
| 807 | static asdl_seq *_gather_158_rule(Parser *p); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 808 | static void *_tmp_160_rule(Parser *p); |
| 809 | static void *_tmp_161_rule(Parser *p); |
| 810 | static void *_tmp_162_rule(Parser *p); |
| 811 | static void *_tmp_163_rule(Parser *p); |
| 812 | static void *_tmp_164_rule(Parser *p); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 813 | static void *_tmp_165_rule(Parser *p); |
| 814 | static void *_tmp_166_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 815 | static void *_tmp_167_rule(Parser *p); |
| 816 | static void *_tmp_168_rule(Parser *p); |
| 817 | static void *_tmp_169_rule(Parser *p); |
| 818 | static void *_tmp_170_rule(Parser *p); |
| 819 | static void *_tmp_171_rule(Parser *p); |
| 820 | static void *_tmp_172_rule(Parser *p); |
| 821 | static void *_tmp_173_rule(Parser *p); |
| 822 | static void *_tmp_174_rule(Parser *p); |
| 823 | static void *_tmp_175_rule(Parser *p); |
| 824 | static void *_tmp_176_rule(Parser *p); |
| 825 | static void *_tmp_177_rule(Parser *p); |
| 826 | static void *_tmp_178_rule(Parser *p); |
| 827 | static void *_tmp_179_rule(Parser *p); |
| 828 | static void *_tmp_180_rule(Parser *p); |
| 829 | static void *_tmp_181_rule(Parser *p); |
| 830 | static void *_tmp_182_rule(Parser *p); |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 831 | |
| 832 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 833 | // file: statements? $ |
| 834 | static mod_ty |
| 835 | file_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 836 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 837 | D(p->level++); |
| 838 | if (p->error_indicator) { |
| 839 | D(p->level--); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 840 | return NULL; |
| 841 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 842 | mod_ty _res = NULL; |
| 843 | int _mark = p->mark; |
| 844 | { // statements? $ |
| 845 | if (p->error_indicator) { |
| 846 | D(p->level--); |
| 847 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 848 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 849 | D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $")); |
| 850 | void *a; |
| 851 | Token * endmarker_var; |
| 852 | if ( |
| 853 | (a = statements_rule(p), 1) // statements? |
| 854 | && |
| 855 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
| 856 | ) |
| 857 | { |
| 858 | D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $")); |
| 859 | _res = _PyPegen_make_module ( p , a ); |
| 860 | if (_res == NULL && PyErr_Occurred()) { |
| 861 | p->error_indicator = 1; |
| 862 | D(p->level--); |
| 863 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 864 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 865 | goto done; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 866 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 867 | p->mark = _mark; |
| 868 | D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ', |
| 869 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $")); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 870 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 871 | _res = NULL; |
| 872 | done: |
| 873 | D(p->level--); |
| 874 | return _res; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 875 | } |
| 876 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 877 | // interactive: statement_newline |
| 878 | static mod_ty |
| 879 | interactive_rule(Parser *p) |
Guido van Rossum | b09f7ed | 2001-07-15 21:08:29 +0000 | [diff] [blame] | 880 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 881 | D(p->level++); |
| 882 | if (p->error_indicator) { |
| 883 | D(p->level--); |
| 884 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 885 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 886 | mod_ty _res = NULL; |
| 887 | int _mark = p->mark; |
| 888 | { // statement_newline |
| 889 | if (p->error_indicator) { |
| 890 | D(p->level--); |
| 891 | return NULL; |
| 892 | } |
| 893 | D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 894 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 895 | if ( |
| 896 | (a = statement_newline_rule(p)) // statement_newline |
| 897 | ) |
| 898 | { |
| 899 | D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline")); |
| 900 | _res = Interactive ( a , p -> arena ); |
| 901 | if (_res == NULL && PyErr_Occurred()) { |
| 902 | p->error_indicator = 1; |
| 903 | D(p->level--); |
| 904 | return NULL; |
| 905 | } |
| 906 | goto done; |
| 907 | } |
| 908 | p->mark = _mark; |
| 909 | D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ', |
| 910 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline")); |
| 911 | } |
| 912 | _res = NULL; |
| 913 | done: |
| 914 | D(p->level--); |
| 915 | return _res; |
Guido van Rossum | b09f7ed | 2001-07-15 21:08:29 +0000 | [diff] [blame] | 916 | } |
| 917 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 918 | // eval: expressions NEWLINE* $ |
| 919 | static mod_ty |
| 920 | eval_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 921 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 922 | D(p->level++); |
| 923 | if (p->error_indicator) { |
| 924 | D(p->level--); |
| 925 | return NULL; |
| 926 | } |
| 927 | mod_ty _res = NULL; |
| 928 | int _mark = p->mark; |
| 929 | { // expressions NEWLINE* $ |
| 930 | if (p->error_indicator) { |
| 931 | D(p->level--); |
| 932 | return NULL; |
| 933 | } |
| 934 | D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $")); |
| 935 | asdl_seq * _loop0_1_var; |
| 936 | expr_ty a; |
| 937 | Token * endmarker_var; |
| 938 | if ( |
| 939 | (a = expressions_rule(p)) // expressions |
| 940 | && |
| 941 | (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE* |
| 942 | && |
| 943 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
| 944 | ) |
| 945 | { |
| 946 | D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $")); |
| 947 | _res = Expression ( a , p -> arena ); |
| 948 | if (_res == NULL && PyErr_Occurred()) { |
| 949 | p->error_indicator = 1; |
| 950 | D(p->level--); |
| 951 | return NULL; |
| 952 | } |
| 953 | goto done; |
| 954 | } |
| 955 | p->mark = _mark; |
| 956 | D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ', |
| 957 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $")); |
| 958 | } |
| 959 | _res = NULL; |
| 960 | done: |
| 961 | D(p->level--); |
| 962 | return _res; |
| 963 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 964 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 965 | // func_type: '(' type_expressions? ')' '->' expression NEWLINE* $ |
| 966 | static mod_ty |
| 967 | func_type_rule(Parser *p) |
| 968 | { |
| 969 | D(p->level++); |
| 970 | if (p->error_indicator) { |
| 971 | D(p->level--); |
| 972 | return NULL; |
| 973 | } |
| 974 | mod_ty _res = NULL; |
| 975 | int _mark = p->mark; |
| 976 | { // '(' type_expressions? ')' '->' expression NEWLINE* $ |
| 977 | if (p->error_indicator) { |
| 978 | D(p->level--); |
| 979 | return NULL; |
| 980 | } |
| 981 | D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
| 982 | Token * _literal; |
| 983 | Token * _literal_1; |
| 984 | Token * _literal_2; |
| 985 | asdl_seq * _loop0_2_var; |
| 986 | void *a; |
| 987 | expr_ty b; |
| 988 | Token * endmarker_var; |
| 989 | if ( |
| 990 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 991 | && |
| 992 | (a = type_expressions_rule(p), 1) // type_expressions? |
| 993 | && |
| 994 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 995 | && |
| 996 | (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->' |
| 997 | && |
| 998 | (b = expression_rule(p)) // expression |
| 999 | && |
| 1000 | (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE* |
| 1001 | && |
| 1002 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
| 1003 | ) |
| 1004 | { |
| 1005 | D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
| 1006 | _res = FunctionType ( a , b , p -> arena ); |
| 1007 | if (_res == NULL && PyErr_Occurred()) { |
| 1008 | p->error_indicator = 1; |
| 1009 | D(p->level--); |
| 1010 | return NULL; |
| 1011 | } |
| 1012 | goto done; |
| 1013 | } |
| 1014 | p->mark = _mark; |
| 1015 | D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ', |
| 1016 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
| 1017 | } |
| 1018 | _res = NULL; |
| 1019 | done: |
| 1020 | D(p->level--); |
| 1021 | return _res; |
| 1022 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 1023 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1024 | // fstring: star_expressions |
| 1025 | static expr_ty |
| 1026 | fstring_rule(Parser *p) |
| 1027 | { |
| 1028 | D(p->level++); |
| 1029 | if (p->error_indicator) { |
| 1030 | D(p->level--); |
| 1031 | return NULL; |
| 1032 | } |
| 1033 | expr_ty _res = NULL; |
| 1034 | int _mark = p->mark; |
| 1035 | { // star_expressions |
| 1036 | if (p->error_indicator) { |
| 1037 | D(p->level--); |
| 1038 | return NULL; |
| 1039 | } |
| 1040 | D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 1041 | expr_ty star_expressions_var; |
| 1042 | if ( |
| 1043 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 1044 | ) |
| 1045 | { |
| 1046 | D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 1047 | _res = star_expressions_var; |
| 1048 | goto done; |
| 1049 | } |
| 1050 | p->mark = _mark; |
| 1051 | D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ', |
| 1052 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 1053 | } |
| 1054 | _res = NULL; |
| 1055 | done: |
| 1056 | D(p->level--); |
| 1057 | return _res; |
| 1058 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 1059 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1060 | // type_expressions: |
| 1061 | // | ','.expression+ ',' '*' expression ',' '**' expression |
| 1062 | // | ','.expression+ ',' '*' expression |
| 1063 | // | ','.expression+ ',' '**' expression |
| 1064 | // | '*' expression ',' '**' expression |
| 1065 | // | '*' expression |
| 1066 | // | '**' expression |
| 1067 | // | ','.expression+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1068 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1069 | type_expressions_rule(Parser *p) |
| 1070 | { |
| 1071 | D(p->level++); |
| 1072 | if (p->error_indicator) { |
| 1073 | D(p->level--); |
| 1074 | return NULL; |
| 1075 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1076 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1077 | int _mark = p->mark; |
| 1078 | { // ','.expression+ ',' '*' expression ',' '**' expression |
| 1079 | if (p->error_indicator) { |
| 1080 | D(p->level--); |
| 1081 | return NULL; |
| 1082 | } |
| 1083 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
| 1084 | Token * _literal; |
| 1085 | Token * _literal_1; |
| 1086 | Token * _literal_2; |
| 1087 | Token * _literal_3; |
| 1088 | asdl_seq * a; |
| 1089 | expr_ty b; |
| 1090 | expr_ty c; |
| 1091 | if ( |
| 1092 | (a = _gather_3_rule(p)) // ','.expression+ |
| 1093 | && |
| 1094 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 1095 | && |
| 1096 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
| 1097 | && |
| 1098 | (b = expression_rule(p)) // expression |
| 1099 | && |
| 1100 | (_literal_2 = _PyPegen_expect_token(p, 12)) // token=',' |
| 1101 | && |
| 1102 | (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**' |
| 1103 | && |
| 1104 | (c = expression_rule(p)) // expression |
| 1105 | ) |
| 1106 | { |
| 1107 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 1108 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_seq_append_to_end ( p , a , b ) ) , c ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1109 | if (_res == NULL && PyErr_Occurred()) { |
| 1110 | p->error_indicator = 1; |
| 1111 | D(p->level--); |
| 1112 | return NULL; |
| 1113 | } |
| 1114 | goto done; |
| 1115 | } |
| 1116 | p->mark = _mark; |
| 1117 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1118 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
| 1119 | } |
| 1120 | { // ','.expression+ ',' '*' expression |
| 1121 | if (p->error_indicator) { |
| 1122 | D(p->level--); |
| 1123 | return NULL; |
| 1124 | } |
| 1125 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression")); |
| 1126 | Token * _literal; |
| 1127 | Token * _literal_1; |
| 1128 | asdl_seq * a; |
| 1129 | expr_ty b; |
| 1130 | if ( |
| 1131 | (a = _gather_5_rule(p)) // ','.expression+ |
| 1132 | && |
| 1133 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 1134 | && |
| 1135 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
| 1136 | && |
| 1137 | (b = expression_rule(p)) // expression |
| 1138 | ) |
| 1139 | { |
| 1140 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1141 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1142 | if (_res == NULL && PyErr_Occurred()) { |
| 1143 | p->error_indicator = 1; |
| 1144 | D(p->level--); |
| 1145 | return NULL; |
| 1146 | } |
| 1147 | goto done; |
| 1148 | } |
| 1149 | p->mark = _mark; |
| 1150 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1151 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression")); |
| 1152 | } |
| 1153 | { // ','.expression+ ',' '**' expression |
| 1154 | if (p->error_indicator) { |
| 1155 | D(p->level--); |
| 1156 | return NULL; |
| 1157 | } |
| 1158 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression")); |
| 1159 | Token * _literal; |
| 1160 | Token * _literal_1; |
| 1161 | asdl_seq * a; |
| 1162 | expr_ty b; |
| 1163 | if ( |
| 1164 | (a = _gather_7_rule(p)) // ','.expression+ |
| 1165 | && |
| 1166 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 1167 | && |
| 1168 | (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**' |
| 1169 | && |
| 1170 | (b = expression_rule(p)) // expression |
| 1171 | ) |
| 1172 | { |
| 1173 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1174 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1175 | if (_res == NULL && PyErr_Occurred()) { |
| 1176 | p->error_indicator = 1; |
| 1177 | D(p->level--); |
| 1178 | return NULL; |
| 1179 | } |
| 1180 | goto done; |
| 1181 | } |
| 1182 | p->mark = _mark; |
| 1183 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1184 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression")); |
| 1185 | } |
| 1186 | { // '*' expression ',' '**' expression |
| 1187 | if (p->error_indicator) { |
| 1188 | D(p->level--); |
| 1189 | return NULL; |
| 1190 | } |
| 1191 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression")); |
| 1192 | Token * _literal; |
| 1193 | Token * _literal_1; |
| 1194 | Token * _literal_2; |
| 1195 | expr_ty a; |
| 1196 | expr_ty b; |
| 1197 | if ( |
| 1198 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 1199 | && |
| 1200 | (a = expression_rule(p)) // expression |
| 1201 | && |
| 1202 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 1203 | && |
| 1204 | (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**' |
| 1205 | && |
| 1206 | (b = expression_rule(p)) // expression |
| 1207 | ) |
| 1208 | { |
| 1209 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression")); |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 1210 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_singleton_seq ( p , a ) ) , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1211 | if (_res == NULL && PyErr_Occurred()) { |
| 1212 | p->error_indicator = 1; |
| 1213 | D(p->level--); |
| 1214 | return NULL; |
| 1215 | } |
| 1216 | goto done; |
| 1217 | } |
| 1218 | p->mark = _mark; |
| 1219 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1220 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression")); |
| 1221 | } |
| 1222 | { // '*' expression |
| 1223 | if (p->error_indicator) { |
| 1224 | D(p->level--); |
| 1225 | return NULL; |
| 1226 | } |
| 1227 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
| 1228 | Token * _literal; |
| 1229 | expr_ty a; |
| 1230 | if ( |
| 1231 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 1232 | && |
| 1233 | (a = expression_rule(p)) // expression |
| 1234 | ) |
| 1235 | { |
| 1236 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1237 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1238 | if (_res == NULL && PyErr_Occurred()) { |
| 1239 | p->error_indicator = 1; |
| 1240 | D(p->level--); |
| 1241 | return NULL; |
| 1242 | } |
| 1243 | goto done; |
| 1244 | } |
| 1245 | p->mark = _mark; |
| 1246 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1247 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
| 1248 | } |
| 1249 | { // '**' expression |
| 1250 | if (p->error_indicator) { |
| 1251 | D(p->level--); |
| 1252 | return NULL; |
| 1253 | } |
| 1254 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
| 1255 | Token * _literal; |
| 1256 | expr_ty a; |
| 1257 | if ( |
| 1258 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 1259 | && |
| 1260 | (a = expression_rule(p)) // expression |
| 1261 | ) |
| 1262 | { |
| 1263 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1264 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1265 | if (_res == NULL && PyErr_Occurred()) { |
| 1266 | p->error_indicator = 1; |
| 1267 | D(p->level--); |
| 1268 | return NULL; |
| 1269 | } |
| 1270 | goto done; |
| 1271 | } |
| 1272 | p->mark = _mark; |
| 1273 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1274 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
| 1275 | } |
| 1276 | { // ','.expression+ |
| 1277 | if (p->error_indicator) { |
| 1278 | D(p->level--); |
| 1279 | return NULL; |
| 1280 | } |
| 1281 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1282 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1283 | if ( |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1284 | (a = (asdl_expr_seq*)_gather_9_rule(p)) // ','.expression+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1285 | ) |
| 1286 | { |
| 1287 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1288 | _res = a; |
| 1289 | if (_res == NULL && PyErr_Occurred()) { |
| 1290 | p->error_indicator = 1; |
| 1291 | D(p->level--); |
| 1292 | return NULL; |
| 1293 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1294 | goto done; |
| 1295 | } |
| 1296 | p->mark = _mark; |
| 1297 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1298 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+")); |
| 1299 | } |
| 1300 | _res = NULL; |
| 1301 | done: |
| 1302 | D(p->level--); |
| 1303 | return _res; |
| 1304 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 1305 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1306 | // statements: statement+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1307 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1308 | statements_rule(Parser *p) |
| 1309 | { |
| 1310 | D(p->level++); |
| 1311 | if (p->error_indicator) { |
| 1312 | D(p->level--); |
| 1313 | return NULL; |
| 1314 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1315 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1316 | int _mark = p->mark; |
| 1317 | { // statement+ |
| 1318 | if (p->error_indicator) { |
| 1319 | D(p->level--); |
| 1320 | return NULL; |
| 1321 | } |
| 1322 | D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+")); |
| 1323 | asdl_seq * a; |
| 1324 | if ( |
| 1325 | (a = _loop1_11_rule(p)) // statement+ |
| 1326 | ) |
| 1327 | { |
| 1328 | D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1329 | _res = ( asdl_stmt_seq * ) _PyPegen_seq_flatten ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1330 | if (_res == NULL && PyErr_Occurred()) { |
| 1331 | p->error_indicator = 1; |
| 1332 | D(p->level--); |
| 1333 | return NULL; |
| 1334 | } |
| 1335 | goto done; |
| 1336 | } |
| 1337 | p->mark = _mark; |
| 1338 | D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ', |
| 1339 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+")); |
| 1340 | } |
| 1341 | _res = NULL; |
| 1342 | done: |
| 1343 | D(p->level--); |
| 1344 | return _res; |
| 1345 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 1346 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1347 | // statement: compound_stmt | simple_stmts |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1348 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1349 | statement_rule(Parser *p) |
| 1350 | { |
| 1351 | D(p->level++); |
| 1352 | if (p->error_indicator) { |
| 1353 | D(p->level--); |
| 1354 | return NULL; |
| 1355 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1356 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1357 | int _mark = p->mark; |
| 1358 | { // compound_stmt |
| 1359 | if (p->error_indicator) { |
| 1360 | D(p->level--); |
| 1361 | return NULL; |
| 1362 | } |
| 1363 | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
| 1364 | stmt_ty a; |
| 1365 | if ( |
| 1366 | (a = compound_stmt_rule(p)) // compound_stmt |
| 1367 | ) |
| 1368 | { |
| 1369 | D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1370 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1371 | if (_res == NULL && PyErr_Occurred()) { |
| 1372 | p->error_indicator = 1; |
| 1373 | D(p->level--); |
| 1374 | return NULL; |
| 1375 | } |
| 1376 | goto done; |
| 1377 | } |
| 1378 | p->mark = _mark; |
| 1379 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
| 1380 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt")); |
| 1381 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1382 | { // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1383 | if (p->error_indicator) { |
| 1384 | D(p->level--); |
| 1385 | return NULL; |
| 1386 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1387 | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1388 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1389 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1390 | (a = (asdl_stmt_seq*)simple_stmts_rule(p)) // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1391 | ) |
| 1392 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1393 | D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1394 | _res = a; |
| 1395 | if (_res == NULL && PyErr_Occurred()) { |
| 1396 | p->error_indicator = 1; |
| 1397 | D(p->level--); |
| 1398 | return NULL; |
| 1399 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1400 | goto done; |
| 1401 | } |
| 1402 | p->mark = _mark; |
| 1403 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1404 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1405 | } |
| 1406 | _res = NULL; |
| 1407 | done: |
| 1408 | D(p->level--); |
| 1409 | return _res; |
| 1410 | } |
| 1411 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1412 | // statement_newline: compound_stmt NEWLINE | simple_stmts | NEWLINE | $ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1413 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1414 | statement_newline_rule(Parser *p) |
| 1415 | { |
| 1416 | D(p->level++); |
| 1417 | if (p->error_indicator) { |
| 1418 | D(p->level--); |
| 1419 | return NULL; |
| 1420 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1421 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1422 | int _mark = p->mark; |
| 1423 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 1424 | p->error_indicator = 1; |
| 1425 | D(p->level--); |
| 1426 | return NULL; |
| 1427 | } |
| 1428 | int _start_lineno = p->tokens[_mark]->lineno; |
| 1429 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 1430 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 1431 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 1432 | { // compound_stmt NEWLINE |
| 1433 | if (p->error_indicator) { |
| 1434 | D(p->level--); |
| 1435 | return NULL; |
| 1436 | } |
| 1437 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE")); |
| 1438 | stmt_ty a; |
| 1439 | Token * newline_var; |
| 1440 | if ( |
| 1441 | (a = compound_stmt_rule(p)) // compound_stmt |
| 1442 | && |
| 1443 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 1444 | ) |
| 1445 | { |
| 1446 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1447 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1448 | if (_res == NULL && PyErr_Occurred()) { |
| 1449 | p->error_indicator = 1; |
| 1450 | D(p->level--); |
| 1451 | return NULL; |
| 1452 | } |
| 1453 | goto done; |
| 1454 | } |
| 1455 | p->mark = _mark; |
| 1456 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1457 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE")); |
| 1458 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1459 | { // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1460 | if (p->error_indicator) { |
| 1461 | D(p->level--); |
| 1462 | return NULL; |
| 1463 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1464 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
| 1465 | asdl_stmt_seq* simple_stmts_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1466 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1467 | (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1468 | ) |
| 1469 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1470 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
| 1471 | _res = simple_stmts_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1472 | goto done; |
| 1473 | } |
| 1474 | p->mark = _mark; |
| 1475 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1476 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1477 | } |
| 1478 | { // NEWLINE |
| 1479 | if (p->error_indicator) { |
| 1480 | D(p->level--); |
| 1481 | return NULL; |
| 1482 | } |
| 1483 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 1484 | Token * newline_var; |
| 1485 | if ( |
| 1486 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 1487 | ) |
| 1488 | { |
| 1489 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 1490 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1491 | if (_token == NULL) { |
| 1492 | D(p->level--); |
| 1493 | return NULL; |
| 1494 | } |
| 1495 | int _end_lineno = _token->end_lineno; |
| 1496 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1497 | int _end_col_offset = _token->end_col_offset; |
| 1498 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 1499 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _Py_Pass ( EXTRA ) ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1500 | if (_res == NULL && PyErr_Occurred()) { |
| 1501 | p->error_indicator = 1; |
| 1502 | D(p->level--); |
| 1503 | return NULL; |
| 1504 | } |
| 1505 | goto done; |
| 1506 | } |
| 1507 | p->mark = _mark; |
| 1508 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1509 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
| 1510 | } |
| 1511 | { // $ |
| 1512 | if (p->error_indicator) { |
| 1513 | D(p->level--); |
| 1514 | return NULL; |
| 1515 | } |
| 1516 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$")); |
| 1517 | Token * endmarker_var; |
| 1518 | if ( |
| 1519 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
| 1520 | ) |
| 1521 | { |
| 1522 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$")); |
| 1523 | _res = _PyPegen_interactive_exit ( p ); |
| 1524 | if (_res == NULL && PyErr_Occurred()) { |
| 1525 | p->error_indicator = 1; |
| 1526 | D(p->level--); |
| 1527 | return NULL; |
| 1528 | } |
| 1529 | goto done; |
| 1530 | } |
| 1531 | p->mark = _mark; |
| 1532 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1533 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$")); |
| 1534 | } |
| 1535 | _res = NULL; |
| 1536 | done: |
| 1537 | D(p->level--); |
| 1538 | return _res; |
| 1539 | } |
| 1540 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1541 | // simple_stmts: simple_stmt !';' NEWLINE | ';'.simple_stmt+ ';'? NEWLINE |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1542 | static asdl_stmt_seq* |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1543 | simple_stmts_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1544 | { |
| 1545 | D(p->level++); |
| 1546 | if (p->error_indicator) { |
| 1547 | D(p->level--); |
| 1548 | return NULL; |
| 1549 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1550 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1551 | int _mark = p->mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1552 | { // simple_stmt !';' NEWLINE |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1553 | if (p->error_indicator) { |
| 1554 | D(p->level--); |
| 1555 | return NULL; |
| 1556 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1557 | D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1558 | stmt_ty a; |
| 1559 | Token * newline_var; |
| 1560 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1561 | (a = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1562 | && |
| 1563 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';' |
| 1564 | && |
| 1565 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 1566 | ) |
| 1567 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1568 | D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1569 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1570 | if (_res == NULL && PyErr_Occurred()) { |
| 1571 | p->error_indicator = 1; |
| 1572 | D(p->level--); |
| 1573 | return NULL; |
| 1574 | } |
| 1575 | goto done; |
| 1576 | } |
| 1577 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1578 | D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ', |
| 1579 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt !';' NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1580 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1581 | { // ';'.simple_stmt+ ';'? NEWLINE |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1582 | if (p->error_indicator) { |
| 1583 | D(p->level--); |
| 1584 | return NULL; |
| 1585 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1586 | D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1587 | void *_opt_var; |
| 1588 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1589 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1590 | Token * newline_var; |
| 1591 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1592 | (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.simple_stmt+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1593 | && |
| 1594 | (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'? |
| 1595 | && |
| 1596 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 1597 | ) |
| 1598 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1599 | D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1600 | _res = a; |
| 1601 | if (_res == NULL && PyErr_Occurred()) { |
| 1602 | p->error_indicator = 1; |
| 1603 | D(p->level--); |
| 1604 | return NULL; |
| 1605 | } |
| 1606 | goto done; |
| 1607 | } |
| 1608 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1609 | D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ', |
| 1610 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1611 | } |
| 1612 | _res = NULL; |
| 1613 | done: |
| 1614 | D(p->level--); |
| 1615 | return _res; |
| 1616 | } |
| 1617 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1618 | // simple_stmt: |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1619 | // | assignment |
| 1620 | // | star_expressions |
| 1621 | // | &'return' return_stmt |
| 1622 | // | &('import' | 'from') import_stmt |
| 1623 | // | &'raise' raise_stmt |
| 1624 | // | 'pass' |
| 1625 | // | &'del' del_stmt |
| 1626 | // | &'yield' yield_stmt |
| 1627 | // | &'assert' assert_stmt |
| 1628 | // | 'break' |
| 1629 | // | 'continue' |
| 1630 | // | &'global' global_stmt |
| 1631 | // | &'nonlocal' nonlocal_stmt |
| 1632 | static stmt_ty |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1633 | simple_stmt_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1634 | { |
| 1635 | D(p->level++); |
| 1636 | if (p->error_indicator) { |
| 1637 | D(p->level--); |
| 1638 | return NULL; |
| 1639 | } |
| 1640 | stmt_ty _res = NULL; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1641 | if (_PyPegen_is_memoized(p, simple_stmt_type, &_res)) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1642 | D(p->level--); |
| 1643 | return _res; |
| 1644 | } |
| 1645 | int _mark = p->mark; |
| 1646 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 1647 | p->error_indicator = 1; |
| 1648 | D(p->level--); |
| 1649 | return NULL; |
| 1650 | } |
| 1651 | int _start_lineno = p->tokens[_mark]->lineno; |
| 1652 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 1653 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 1654 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 1655 | { // assignment |
| 1656 | if (p->error_indicator) { |
| 1657 | D(p->level--); |
| 1658 | return NULL; |
| 1659 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1660 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1661 | stmt_ty assignment_var; |
| 1662 | if ( |
| 1663 | (assignment_var = assignment_rule(p)) // assignment |
| 1664 | ) |
| 1665 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1666 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1667 | _res = assignment_var; |
| 1668 | goto done; |
| 1669 | } |
| 1670 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1671 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1672 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment")); |
| 1673 | } |
| 1674 | { // star_expressions |
| 1675 | if (p->error_indicator) { |
| 1676 | D(p->level--); |
| 1677 | return NULL; |
| 1678 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1679 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1680 | expr_ty e; |
| 1681 | if ( |
| 1682 | (e = star_expressions_rule(p)) // star_expressions |
| 1683 | ) |
| 1684 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1685 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1686 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1687 | if (_token == NULL) { |
| 1688 | D(p->level--); |
| 1689 | return NULL; |
| 1690 | } |
| 1691 | int _end_lineno = _token->end_lineno; |
| 1692 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1693 | int _end_col_offset = _token->end_col_offset; |
| 1694 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1695 | _res = _Py_Expr ( e , EXTRA ); |
| 1696 | if (_res == NULL && PyErr_Occurred()) { |
| 1697 | p->error_indicator = 1; |
| 1698 | D(p->level--); |
| 1699 | return NULL; |
| 1700 | } |
| 1701 | goto done; |
| 1702 | } |
| 1703 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1704 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1705 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 1706 | } |
| 1707 | { // &'return' return_stmt |
| 1708 | if (p->error_indicator) { |
| 1709 | D(p->level--); |
| 1710 | return NULL; |
| 1711 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1712 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1713 | stmt_ty return_stmt_var; |
| 1714 | if ( |
| 1715 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return' |
| 1716 | && |
| 1717 | (return_stmt_var = return_stmt_rule(p)) // return_stmt |
| 1718 | ) |
| 1719 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1720 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1721 | _res = return_stmt_var; |
| 1722 | goto done; |
| 1723 | } |
| 1724 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1725 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1726 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt")); |
| 1727 | } |
| 1728 | { // &('import' | 'from') import_stmt |
| 1729 | if (p->error_indicator) { |
| 1730 | D(p->level--); |
| 1731 | return NULL; |
| 1732 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1733 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1734 | stmt_ty import_stmt_var; |
| 1735 | if ( |
| 1736 | _PyPegen_lookahead(1, _tmp_14_rule, p) |
| 1737 | && |
| 1738 | (import_stmt_var = import_stmt_rule(p)) // import_stmt |
| 1739 | ) |
| 1740 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1741 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1742 | _res = import_stmt_var; |
| 1743 | goto done; |
| 1744 | } |
| 1745 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1746 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1747 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt")); |
| 1748 | } |
| 1749 | { // &'raise' raise_stmt |
| 1750 | if (p->error_indicator) { |
| 1751 | D(p->level--); |
| 1752 | return NULL; |
| 1753 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1754 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1755 | stmt_ty raise_stmt_var; |
| 1756 | if ( |
| 1757 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise' |
| 1758 | && |
| 1759 | (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt |
| 1760 | ) |
| 1761 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1762 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1763 | _res = raise_stmt_var; |
| 1764 | goto done; |
| 1765 | } |
| 1766 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1767 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1768 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt")); |
| 1769 | } |
| 1770 | { // 'pass' |
| 1771 | if (p->error_indicator) { |
| 1772 | D(p->level--); |
| 1773 | return NULL; |
| 1774 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1775 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1776 | Token * _keyword; |
| 1777 | if ( |
| 1778 | (_keyword = _PyPegen_expect_token(p, 502)) // token='pass' |
| 1779 | ) |
| 1780 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1781 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1782 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1783 | if (_token == NULL) { |
| 1784 | D(p->level--); |
| 1785 | return NULL; |
| 1786 | } |
| 1787 | int _end_lineno = _token->end_lineno; |
| 1788 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1789 | int _end_col_offset = _token->end_col_offset; |
| 1790 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1791 | _res = _Py_Pass ( EXTRA ); |
| 1792 | if (_res == NULL && PyErr_Occurred()) { |
| 1793 | p->error_indicator = 1; |
| 1794 | D(p->level--); |
| 1795 | return NULL; |
| 1796 | } |
| 1797 | goto done; |
| 1798 | } |
| 1799 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1800 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1801 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'")); |
| 1802 | } |
| 1803 | { // &'del' del_stmt |
| 1804 | if (p->error_indicator) { |
| 1805 | D(p->level--); |
| 1806 | return NULL; |
| 1807 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1808 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1809 | stmt_ty del_stmt_var; |
| 1810 | if ( |
| 1811 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del' |
| 1812 | && |
| 1813 | (del_stmt_var = del_stmt_rule(p)) // del_stmt |
| 1814 | ) |
| 1815 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1816 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1817 | _res = del_stmt_var; |
| 1818 | goto done; |
| 1819 | } |
| 1820 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1821 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1822 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt")); |
| 1823 | } |
| 1824 | { // &'yield' yield_stmt |
| 1825 | if (p->error_indicator) { |
| 1826 | D(p->level--); |
| 1827 | return NULL; |
| 1828 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1829 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1830 | stmt_ty yield_stmt_var; |
| 1831 | if ( |
| 1832 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield' |
| 1833 | && |
| 1834 | (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt |
| 1835 | ) |
| 1836 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1837 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1838 | _res = yield_stmt_var; |
| 1839 | goto done; |
| 1840 | } |
| 1841 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1842 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1843 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt")); |
| 1844 | } |
| 1845 | { // &'assert' assert_stmt |
| 1846 | if (p->error_indicator) { |
| 1847 | D(p->level--); |
| 1848 | return NULL; |
| 1849 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1850 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1851 | stmt_ty assert_stmt_var; |
| 1852 | if ( |
| 1853 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert' |
| 1854 | && |
| 1855 | (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt |
| 1856 | ) |
| 1857 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1858 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1859 | _res = assert_stmt_var; |
| 1860 | goto done; |
| 1861 | } |
| 1862 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1863 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1864 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt")); |
| 1865 | } |
| 1866 | { // 'break' |
| 1867 | if (p->error_indicator) { |
| 1868 | D(p->level--); |
| 1869 | return NULL; |
| 1870 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1871 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1872 | Token * _keyword; |
| 1873 | if ( |
| 1874 | (_keyword = _PyPegen_expect_token(p, 506)) // token='break' |
| 1875 | ) |
| 1876 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1877 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1878 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1879 | if (_token == NULL) { |
| 1880 | D(p->level--); |
| 1881 | return NULL; |
| 1882 | } |
| 1883 | int _end_lineno = _token->end_lineno; |
| 1884 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1885 | int _end_col_offset = _token->end_col_offset; |
| 1886 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1887 | _res = _Py_Break ( EXTRA ); |
| 1888 | if (_res == NULL && PyErr_Occurred()) { |
| 1889 | p->error_indicator = 1; |
| 1890 | D(p->level--); |
| 1891 | return NULL; |
| 1892 | } |
| 1893 | goto done; |
| 1894 | } |
| 1895 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1896 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1897 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'")); |
| 1898 | } |
| 1899 | { // 'continue' |
| 1900 | if (p->error_indicator) { |
| 1901 | D(p->level--); |
| 1902 | return NULL; |
| 1903 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1904 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1905 | Token * _keyword; |
| 1906 | if ( |
| 1907 | (_keyword = _PyPegen_expect_token(p, 507)) // token='continue' |
| 1908 | ) |
| 1909 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1910 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1911 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1912 | if (_token == NULL) { |
| 1913 | D(p->level--); |
| 1914 | return NULL; |
| 1915 | } |
| 1916 | int _end_lineno = _token->end_lineno; |
| 1917 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1918 | int _end_col_offset = _token->end_col_offset; |
| 1919 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1920 | _res = _Py_Continue ( EXTRA ); |
| 1921 | if (_res == NULL && PyErr_Occurred()) { |
| 1922 | p->error_indicator = 1; |
| 1923 | D(p->level--); |
| 1924 | return NULL; |
| 1925 | } |
| 1926 | goto done; |
| 1927 | } |
| 1928 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1929 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1930 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'")); |
| 1931 | } |
| 1932 | { // &'global' global_stmt |
| 1933 | if (p->error_indicator) { |
| 1934 | D(p->level--); |
| 1935 | return NULL; |
| 1936 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1937 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1938 | stmt_ty global_stmt_var; |
| 1939 | if ( |
| 1940 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global' |
| 1941 | && |
| 1942 | (global_stmt_var = global_stmt_rule(p)) // global_stmt |
| 1943 | ) |
| 1944 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1945 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1946 | _res = global_stmt_var; |
| 1947 | goto done; |
| 1948 | } |
| 1949 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1950 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1951 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt")); |
| 1952 | } |
| 1953 | { // &'nonlocal' nonlocal_stmt |
| 1954 | if (p->error_indicator) { |
| 1955 | D(p->level--); |
| 1956 | return NULL; |
| 1957 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1958 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1959 | stmt_ty nonlocal_stmt_var; |
| 1960 | if ( |
| 1961 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal' |
| 1962 | && |
| 1963 | (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt |
| 1964 | ) |
| 1965 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1966 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1967 | _res = nonlocal_stmt_var; |
| 1968 | goto done; |
| 1969 | } |
| 1970 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1971 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1972 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
| 1973 | } |
| 1974 | _res = NULL; |
| 1975 | done: |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1976 | _PyPegen_insert_memo(p, _mark, simple_stmt_type, _res); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1977 | D(p->level--); |
| 1978 | return _res; |
| 1979 | } |
| 1980 | |
| 1981 | // compound_stmt: |
| 1982 | // | &('def' | '@' | ASYNC) function_def |
| 1983 | // | &'if' if_stmt |
| 1984 | // | &('class' | '@') class_def |
| 1985 | // | &('with' | ASYNC) with_stmt |
| 1986 | // | &('for' | ASYNC) for_stmt |
| 1987 | // | &'try' try_stmt |
| 1988 | // | &'while' while_stmt |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 1989 | // | match_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1990 | static stmt_ty |
| 1991 | compound_stmt_rule(Parser *p) |
| 1992 | { |
| 1993 | D(p->level++); |
| 1994 | if (p->error_indicator) { |
| 1995 | D(p->level--); |
| 1996 | return NULL; |
| 1997 | } |
| 1998 | stmt_ty _res = NULL; |
| 1999 | int _mark = p->mark; |
| 2000 | { // &('def' | '@' | ASYNC) function_def |
| 2001 | if (p->error_indicator) { |
| 2002 | D(p->level--); |
| 2003 | return NULL; |
| 2004 | } |
| 2005 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
| 2006 | stmt_ty function_def_var; |
| 2007 | if ( |
| 2008 | _PyPegen_lookahead(1, _tmp_15_rule, p) |
| 2009 | && |
| 2010 | (function_def_var = function_def_rule(p)) // function_def |
| 2011 | ) |
| 2012 | { |
| 2013 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
| 2014 | _res = function_def_var; |
| 2015 | goto done; |
| 2016 | } |
| 2017 | p->mark = _mark; |
| 2018 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2019 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
| 2020 | } |
| 2021 | { // &'if' if_stmt |
| 2022 | if (p->error_indicator) { |
| 2023 | D(p->level--); |
| 2024 | return NULL; |
| 2025 | } |
| 2026 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); |
| 2027 | stmt_ty if_stmt_var; |
| 2028 | if ( |
| 2029 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if' |
| 2030 | && |
| 2031 | (if_stmt_var = if_stmt_rule(p)) // if_stmt |
| 2032 | ) |
| 2033 | { |
| 2034 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); |
| 2035 | _res = if_stmt_var; |
| 2036 | goto done; |
| 2037 | } |
| 2038 | p->mark = _mark; |
| 2039 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2040 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt")); |
| 2041 | } |
| 2042 | { // &('class' | '@') class_def |
| 2043 | if (p->error_indicator) { |
| 2044 | D(p->level--); |
| 2045 | return NULL; |
| 2046 | } |
| 2047 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def")); |
| 2048 | stmt_ty class_def_var; |
| 2049 | if ( |
| 2050 | _PyPegen_lookahead(1, _tmp_16_rule, p) |
| 2051 | && |
| 2052 | (class_def_var = class_def_rule(p)) // class_def |
| 2053 | ) |
| 2054 | { |
| 2055 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def")); |
| 2056 | _res = class_def_var; |
| 2057 | goto done; |
| 2058 | } |
| 2059 | p->mark = _mark; |
| 2060 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2061 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def")); |
| 2062 | } |
| 2063 | { // &('with' | ASYNC) with_stmt |
| 2064 | if (p->error_indicator) { |
| 2065 | D(p->level--); |
| 2066 | return NULL; |
| 2067 | } |
| 2068 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
| 2069 | stmt_ty with_stmt_var; |
| 2070 | if ( |
| 2071 | _PyPegen_lookahead(1, _tmp_17_rule, p) |
| 2072 | && |
| 2073 | (with_stmt_var = with_stmt_rule(p)) // with_stmt |
| 2074 | ) |
| 2075 | { |
| 2076 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
| 2077 | _res = with_stmt_var; |
| 2078 | goto done; |
| 2079 | } |
| 2080 | p->mark = _mark; |
| 2081 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2082 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
| 2083 | } |
| 2084 | { // &('for' | ASYNC) for_stmt |
| 2085 | if (p->error_indicator) { |
| 2086 | D(p->level--); |
| 2087 | return NULL; |
| 2088 | } |
| 2089 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
| 2090 | stmt_ty for_stmt_var; |
| 2091 | if ( |
| 2092 | _PyPegen_lookahead(1, _tmp_18_rule, p) |
| 2093 | && |
| 2094 | (for_stmt_var = for_stmt_rule(p)) // for_stmt |
| 2095 | ) |
| 2096 | { |
| 2097 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
| 2098 | _res = for_stmt_var; |
| 2099 | goto done; |
| 2100 | } |
| 2101 | p->mark = _mark; |
| 2102 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2103 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
| 2104 | } |
| 2105 | { // &'try' try_stmt |
| 2106 | if (p->error_indicator) { |
| 2107 | D(p->level--); |
| 2108 | return NULL; |
| 2109 | } |
| 2110 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); |
| 2111 | stmt_ty try_stmt_var; |
| 2112 | if ( |
| 2113 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try' |
| 2114 | && |
| 2115 | (try_stmt_var = try_stmt_rule(p)) // try_stmt |
| 2116 | ) |
| 2117 | { |
| 2118 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); |
| 2119 | _res = try_stmt_var; |
| 2120 | goto done; |
| 2121 | } |
| 2122 | p->mark = _mark; |
| 2123 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2124 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt")); |
| 2125 | } |
| 2126 | { // &'while' while_stmt |
| 2127 | if (p->error_indicator) { |
| 2128 | D(p->level--); |
| 2129 | return NULL; |
| 2130 | } |
| 2131 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); |
| 2132 | stmt_ty while_stmt_var; |
| 2133 | if ( |
| 2134 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while' |
| 2135 | && |
| 2136 | (while_stmt_var = while_stmt_rule(p)) // while_stmt |
| 2137 | ) |
| 2138 | { |
| 2139 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); |
| 2140 | _res = while_stmt_var; |
| 2141 | goto done; |
| 2142 | } |
| 2143 | p->mark = _mark; |
| 2144 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2145 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt")); |
| 2146 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 2147 | { // match_stmt |
| 2148 | if (p->error_indicator) { |
| 2149 | D(p->level--); |
| 2150 | return NULL; |
| 2151 | } |
| 2152 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt")); |
| 2153 | stmt_ty match_stmt_var; |
| 2154 | if ( |
| 2155 | (match_stmt_var = match_stmt_rule(p)) // match_stmt |
| 2156 | ) |
| 2157 | { |
| 2158 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "match_stmt")); |
| 2159 | _res = match_stmt_var; |
| 2160 | goto done; |
| 2161 | } |
| 2162 | p->mark = _mark; |
| 2163 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2164 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "match_stmt")); |
| 2165 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2166 | _res = NULL; |
| 2167 | done: |
| 2168 | D(p->level--); |
| 2169 | return _res; |
| 2170 | } |
| 2171 | |
| 2172 | // assignment: |
| 2173 | // | NAME ':' expression ['=' annotated_rhs] |
| 2174 | // | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
| 2175 | // | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT? |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2176 | // | single_target augassign ~ (yield_expr | star_expressions) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2177 | // | invalid_assignment |
| 2178 | static stmt_ty |
| 2179 | assignment_rule(Parser *p) |
| 2180 | { |
| 2181 | D(p->level++); |
| 2182 | if (p->error_indicator) { |
| 2183 | D(p->level--); |
| 2184 | return NULL; |
| 2185 | } |
| 2186 | stmt_ty _res = NULL; |
| 2187 | int _mark = p->mark; |
| 2188 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2189 | p->error_indicator = 1; |
| 2190 | D(p->level--); |
| 2191 | return NULL; |
| 2192 | } |
| 2193 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2194 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2195 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2196 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2197 | { // NAME ':' expression ['=' annotated_rhs] |
| 2198 | if (p->error_indicator) { |
| 2199 | D(p->level--); |
| 2200 | return NULL; |
| 2201 | } |
| 2202 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
| 2203 | Token * _literal; |
| 2204 | expr_ty a; |
| 2205 | expr_ty b; |
| 2206 | void *c; |
| 2207 | if ( |
| 2208 | (a = _PyPegen_name_token(p)) // NAME |
| 2209 | && |
| 2210 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 2211 | && |
| 2212 | (b = expression_rule(p)) // expression |
| 2213 | && |
| 2214 | (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs] |
| 2215 | ) |
| 2216 | { |
| 2217 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
| 2218 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2219 | if (_token == NULL) { |
| 2220 | D(p->level--); |
| 2221 | return NULL; |
| 2222 | } |
| 2223 | int _end_lineno = _token->end_lineno; |
| 2224 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2225 | int _end_col_offset = _token->end_col_offset; |
| 2226 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2227 | _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2228 | if (_res == NULL && PyErr_Occurred()) { |
| 2229 | p->error_indicator = 1; |
| 2230 | D(p->level--); |
| 2231 | return NULL; |
| 2232 | } |
| 2233 | goto done; |
| 2234 | } |
| 2235 | p->mark = _mark; |
| 2236 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2237 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
| 2238 | } |
| 2239 | { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
| 2240 | if (p->error_indicator) { |
| 2241 | D(p->level--); |
| 2242 | return NULL; |
| 2243 | } |
| 2244 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
| 2245 | Token * _literal; |
| 2246 | void *a; |
| 2247 | expr_ty b; |
| 2248 | void *c; |
| 2249 | if ( |
| 2250 | (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target |
| 2251 | && |
| 2252 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 2253 | && |
| 2254 | (b = expression_rule(p)) // expression |
| 2255 | && |
| 2256 | (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs] |
| 2257 | ) |
| 2258 | { |
| 2259 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
| 2260 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2261 | if (_token == NULL) { |
| 2262 | D(p->level--); |
| 2263 | return NULL; |
| 2264 | } |
| 2265 | int _end_lineno = _token->end_lineno; |
| 2266 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2267 | int _end_col_offset = _token->end_col_offset; |
| 2268 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2269 | _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2270 | if (_res == NULL && PyErr_Occurred()) { |
| 2271 | p->error_indicator = 1; |
| 2272 | D(p->level--); |
| 2273 | return NULL; |
| 2274 | } |
| 2275 | goto done; |
| 2276 | } |
| 2277 | p->mark = _mark; |
| 2278 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2279 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
| 2280 | } |
| 2281 | { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT? |
| 2282 | if (p->error_indicator) { |
| 2283 | D(p->level--); |
| 2284 | return NULL; |
| 2285 | } |
| 2286 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2287 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2288 | void *b; |
| 2289 | void *tc; |
| 2290 | if ( |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2291 | (a = (asdl_expr_seq*)_loop1_22_rule(p)) // ((star_targets '='))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2292 | && |
| 2293 | (b = _tmp_23_rule(p)) // yield_expr | star_expressions |
| 2294 | && |
| 2295 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
| 2296 | && |
| 2297 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 2298 | ) |
| 2299 | { |
| 2300 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?")); |
| 2301 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2302 | if (_token == NULL) { |
| 2303 | D(p->level--); |
| 2304 | return NULL; |
| 2305 | } |
| 2306 | int _end_lineno = _token->end_lineno; |
| 2307 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2308 | int _end_col_offset = _token->end_col_offset; |
| 2309 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2310 | _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 2311 | if (_res == NULL && PyErr_Occurred()) { |
| 2312 | p->error_indicator = 1; |
| 2313 | D(p->level--); |
| 2314 | return NULL; |
| 2315 | } |
| 2316 | goto done; |
| 2317 | } |
| 2318 | p->mark = _mark; |
| 2319 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2320 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?")); |
| 2321 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2322 | { // single_target augassign ~ (yield_expr | star_expressions) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2323 | if (p->error_indicator) { |
| 2324 | D(p->level--); |
| 2325 | return NULL; |
| 2326 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2327 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)")); |
| 2328 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2329 | expr_ty a; |
| 2330 | AugOperator* b; |
| 2331 | void *c; |
| 2332 | if ( |
| 2333 | (a = single_target_rule(p)) // single_target |
| 2334 | && |
| 2335 | (b = augassign_rule(p)) // augassign |
| 2336 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2337 | (_cut_var = 1) |
| 2338 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2339 | (c = _tmp_24_rule(p)) // yield_expr | star_expressions |
| 2340 | ) |
| 2341 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2342 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2343 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2344 | if (_token == NULL) { |
| 2345 | D(p->level--); |
| 2346 | return NULL; |
| 2347 | } |
| 2348 | int _end_lineno = _token->end_lineno; |
| 2349 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2350 | int _end_col_offset = _token->end_col_offset; |
| 2351 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2352 | _res = _Py_AugAssign ( a , b -> kind , c , EXTRA ); |
| 2353 | if (_res == NULL && PyErr_Occurred()) { |
| 2354 | p->error_indicator = 1; |
| 2355 | D(p->level--); |
| 2356 | return NULL; |
| 2357 | } |
| 2358 | goto done; |
| 2359 | } |
| 2360 | p->mark = _mark; |
| 2361 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2362 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)")); |
| 2363 | if (_cut_var) { |
| 2364 | D(p->level--); |
| 2365 | return NULL; |
| 2366 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2367 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 2368 | if (p->call_invalid_rules) { // invalid_assignment |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2369 | if (p->error_indicator) { |
| 2370 | D(p->level--); |
| 2371 | return NULL; |
| 2372 | } |
| 2373 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment")); |
| 2374 | void *invalid_assignment_var; |
| 2375 | if ( |
| 2376 | (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment |
| 2377 | ) |
| 2378 | { |
| 2379 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment")); |
| 2380 | _res = invalid_assignment_var; |
| 2381 | goto done; |
| 2382 | } |
| 2383 | p->mark = _mark; |
| 2384 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2385 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment")); |
| 2386 | } |
| 2387 | _res = NULL; |
| 2388 | done: |
| 2389 | D(p->level--); |
| 2390 | return _res; |
| 2391 | } |
| 2392 | |
| 2393 | // augassign: |
| 2394 | // | '+=' |
| 2395 | // | '-=' |
| 2396 | // | '*=' |
| 2397 | // | '@=' |
| 2398 | // | '/=' |
| 2399 | // | '%=' |
| 2400 | // | '&=' |
| 2401 | // | '|=' |
| 2402 | // | '^=' |
| 2403 | // | '<<=' |
| 2404 | // | '>>=' |
| 2405 | // | '**=' |
| 2406 | // | '//=' |
| 2407 | static AugOperator* |
| 2408 | augassign_rule(Parser *p) |
| 2409 | { |
| 2410 | D(p->level++); |
| 2411 | if (p->error_indicator) { |
| 2412 | D(p->level--); |
| 2413 | return NULL; |
| 2414 | } |
| 2415 | AugOperator* _res = NULL; |
| 2416 | int _mark = p->mark; |
| 2417 | { // '+=' |
| 2418 | if (p->error_indicator) { |
| 2419 | D(p->level--); |
| 2420 | return NULL; |
| 2421 | } |
| 2422 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='")); |
| 2423 | Token * _literal; |
| 2424 | if ( |
| 2425 | (_literal = _PyPegen_expect_token(p, 36)) // token='+=' |
| 2426 | ) |
| 2427 | { |
| 2428 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='")); |
| 2429 | _res = _PyPegen_augoperator ( p , Add ); |
| 2430 | if (_res == NULL && PyErr_Occurred()) { |
| 2431 | p->error_indicator = 1; |
| 2432 | D(p->level--); |
| 2433 | return NULL; |
| 2434 | } |
| 2435 | goto done; |
| 2436 | } |
| 2437 | p->mark = _mark; |
| 2438 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2439 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='")); |
| 2440 | } |
| 2441 | { // '-=' |
| 2442 | if (p->error_indicator) { |
| 2443 | D(p->level--); |
| 2444 | return NULL; |
| 2445 | } |
| 2446 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='")); |
| 2447 | Token * _literal; |
| 2448 | if ( |
| 2449 | (_literal = _PyPegen_expect_token(p, 37)) // token='-=' |
| 2450 | ) |
| 2451 | { |
| 2452 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='")); |
| 2453 | _res = _PyPegen_augoperator ( p , Sub ); |
| 2454 | if (_res == NULL && PyErr_Occurred()) { |
| 2455 | p->error_indicator = 1; |
| 2456 | D(p->level--); |
| 2457 | return NULL; |
| 2458 | } |
| 2459 | goto done; |
| 2460 | } |
| 2461 | p->mark = _mark; |
| 2462 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2463 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='")); |
| 2464 | } |
| 2465 | { // '*=' |
| 2466 | if (p->error_indicator) { |
| 2467 | D(p->level--); |
| 2468 | return NULL; |
| 2469 | } |
| 2470 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='")); |
| 2471 | Token * _literal; |
| 2472 | if ( |
| 2473 | (_literal = _PyPegen_expect_token(p, 38)) // token='*=' |
| 2474 | ) |
| 2475 | { |
| 2476 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='")); |
| 2477 | _res = _PyPegen_augoperator ( p , Mult ); |
| 2478 | if (_res == NULL && PyErr_Occurred()) { |
| 2479 | p->error_indicator = 1; |
| 2480 | D(p->level--); |
| 2481 | return NULL; |
| 2482 | } |
| 2483 | goto done; |
| 2484 | } |
| 2485 | p->mark = _mark; |
| 2486 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2487 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='")); |
| 2488 | } |
| 2489 | { // '@=' |
| 2490 | if (p->error_indicator) { |
| 2491 | D(p->level--); |
| 2492 | return NULL; |
| 2493 | } |
| 2494 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='")); |
| 2495 | Token * _literal; |
| 2496 | if ( |
| 2497 | (_literal = _PyPegen_expect_token(p, 50)) // token='@=' |
| 2498 | ) |
| 2499 | { |
| 2500 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='")); |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2501 | _res = CHECK_VERSION ( AugOperator * , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2502 | if (_res == NULL && PyErr_Occurred()) { |
| 2503 | p->error_indicator = 1; |
| 2504 | D(p->level--); |
| 2505 | return NULL; |
| 2506 | } |
| 2507 | goto done; |
| 2508 | } |
| 2509 | p->mark = _mark; |
| 2510 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2511 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='")); |
| 2512 | } |
| 2513 | { // '/=' |
| 2514 | if (p->error_indicator) { |
| 2515 | D(p->level--); |
| 2516 | return NULL; |
| 2517 | } |
| 2518 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='")); |
| 2519 | Token * _literal; |
| 2520 | if ( |
| 2521 | (_literal = _PyPegen_expect_token(p, 39)) // token='/=' |
| 2522 | ) |
| 2523 | { |
| 2524 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='")); |
| 2525 | _res = _PyPegen_augoperator ( p , Div ); |
| 2526 | if (_res == NULL && PyErr_Occurred()) { |
| 2527 | p->error_indicator = 1; |
| 2528 | D(p->level--); |
| 2529 | return NULL; |
| 2530 | } |
| 2531 | goto done; |
| 2532 | } |
| 2533 | p->mark = _mark; |
| 2534 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2535 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='")); |
| 2536 | } |
| 2537 | { // '%=' |
| 2538 | if (p->error_indicator) { |
| 2539 | D(p->level--); |
| 2540 | return NULL; |
| 2541 | } |
| 2542 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='")); |
| 2543 | Token * _literal; |
| 2544 | if ( |
| 2545 | (_literal = _PyPegen_expect_token(p, 40)) // token='%=' |
| 2546 | ) |
| 2547 | { |
| 2548 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='")); |
| 2549 | _res = _PyPegen_augoperator ( p , Mod ); |
| 2550 | if (_res == NULL && PyErr_Occurred()) { |
| 2551 | p->error_indicator = 1; |
| 2552 | D(p->level--); |
| 2553 | return NULL; |
| 2554 | } |
| 2555 | goto done; |
| 2556 | } |
| 2557 | p->mark = _mark; |
| 2558 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2559 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='")); |
| 2560 | } |
| 2561 | { // '&=' |
| 2562 | if (p->error_indicator) { |
| 2563 | D(p->level--); |
| 2564 | return NULL; |
| 2565 | } |
| 2566 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='")); |
| 2567 | Token * _literal; |
| 2568 | if ( |
| 2569 | (_literal = _PyPegen_expect_token(p, 41)) // token='&=' |
| 2570 | ) |
| 2571 | { |
| 2572 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='")); |
| 2573 | _res = _PyPegen_augoperator ( p , BitAnd ); |
| 2574 | if (_res == NULL && PyErr_Occurred()) { |
| 2575 | p->error_indicator = 1; |
| 2576 | D(p->level--); |
| 2577 | return NULL; |
| 2578 | } |
| 2579 | goto done; |
| 2580 | } |
| 2581 | p->mark = _mark; |
| 2582 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2583 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='")); |
| 2584 | } |
| 2585 | { // '|=' |
| 2586 | if (p->error_indicator) { |
| 2587 | D(p->level--); |
| 2588 | return NULL; |
| 2589 | } |
| 2590 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='")); |
| 2591 | Token * _literal; |
| 2592 | if ( |
| 2593 | (_literal = _PyPegen_expect_token(p, 42)) // token='|=' |
| 2594 | ) |
| 2595 | { |
| 2596 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='")); |
| 2597 | _res = _PyPegen_augoperator ( p , BitOr ); |
| 2598 | if (_res == NULL && PyErr_Occurred()) { |
| 2599 | p->error_indicator = 1; |
| 2600 | D(p->level--); |
| 2601 | return NULL; |
| 2602 | } |
| 2603 | goto done; |
| 2604 | } |
| 2605 | p->mark = _mark; |
| 2606 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2607 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='")); |
| 2608 | } |
| 2609 | { // '^=' |
| 2610 | if (p->error_indicator) { |
| 2611 | D(p->level--); |
| 2612 | return NULL; |
| 2613 | } |
| 2614 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='")); |
| 2615 | Token * _literal; |
| 2616 | if ( |
| 2617 | (_literal = _PyPegen_expect_token(p, 43)) // token='^=' |
| 2618 | ) |
| 2619 | { |
| 2620 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='")); |
| 2621 | _res = _PyPegen_augoperator ( p , BitXor ); |
| 2622 | if (_res == NULL && PyErr_Occurred()) { |
| 2623 | p->error_indicator = 1; |
| 2624 | D(p->level--); |
| 2625 | return NULL; |
| 2626 | } |
| 2627 | goto done; |
| 2628 | } |
| 2629 | p->mark = _mark; |
| 2630 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2631 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='")); |
| 2632 | } |
| 2633 | { // '<<=' |
| 2634 | if (p->error_indicator) { |
| 2635 | D(p->level--); |
| 2636 | return NULL; |
| 2637 | } |
| 2638 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='")); |
| 2639 | Token * _literal; |
| 2640 | if ( |
| 2641 | (_literal = _PyPegen_expect_token(p, 44)) // token='<<=' |
| 2642 | ) |
| 2643 | { |
| 2644 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='")); |
| 2645 | _res = _PyPegen_augoperator ( p , LShift ); |
| 2646 | if (_res == NULL && PyErr_Occurred()) { |
| 2647 | p->error_indicator = 1; |
| 2648 | D(p->level--); |
| 2649 | return NULL; |
| 2650 | } |
| 2651 | goto done; |
| 2652 | } |
| 2653 | p->mark = _mark; |
| 2654 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2655 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='")); |
| 2656 | } |
| 2657 | { // '>>=' |
| 2658 | if (p->error_indicator) { |
| 2659 | D(p->level--); |
| 2660 | return NULL; |
| 2661 | } |
| 2662 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='")); |
| 2663 | Token * _literal; |
| 2664 | if ( |
| 2665 | (_literal = _PyPegen_expect_token(p, 45)) // token='>>=' |
| 2666 | ) |
| 2667 | { |
| 2668 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='")); |
| 2669 | _res = _PyPegen_augoperator ( p , RShift ); |
| 2670 | if (_res == NULL && PyErr_Occurred()) { |
| 2671 | p->error_indicator = 1; |
| 2672 | D(p->level--); |
| 2673 | return NULL; |
| 2674 | } |
| 2675 | goto done; |
| 2676 | } |
| 2677 | p->mark = _mark; |
| 2678 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2679 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='")); |
| 2680 | } |
| 2681 | { // '**=' |
| 2682 | if (p->error_indicator) { |
| 2683 | D(p->level--); |
| 2684 | return NULL; |
| 2685 | } |
| 2686 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='")); |
| 2687 | Token * _literal; |
| 2688 | if ( |
| 2689 | (_literal = _PyPegen_expect_token(p, 46)) // token='**=' |
| 2690 | ) |
| 2691 | { |
| 2692 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='")); |
| 2693 | _res = _PyPegen_augoperator ( p , Pow ); |
| 2694 | if (_res == NULL && PyErr_Occurred()) { |
| 2695 | p->error_indicator = 1; |
| 2696 | D(p->level--); |
| 2697 | return NULL; |
| 2698 | } |
| 2699 | goto done; |
| 2700 | } |
| 2701 | p->mark = _mark; |
| 2702 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2703 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='")); |
| 2704 | } |
| 2705 | { // '//=' |
| 2706 | if (p->error_indicator) { |
| 2707 | D(p->level--); |
| 2708 | return NULL; |
| 2709 | } |
| 2710 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='")); |
| 2711 | Token * _literal; |
| 2712 | if ( |
| 2713 | (_literal = _PyPegen_expect_token(p, 48)) // token='//=' |
| 2714 | ) |
| 2715 | { |
| 2716 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='")); |
| 2717 | _res = _PyPegen_augoperator ( p , FloorDiv ); |
| 2718 | if (_res == NULL && PyErr_Occurred()) { |
| 2719 | p->error_indicator = 1; |
| 2720 | D(p->level--); |
| 2721 | return NULL; |
| 2722 | } |
| 2723 | goto done; |
| 2724 | } |
| 2725 | p->mark = _mark; |
| 2726 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2727 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='")); |
| 2728 | } |
| 2729 | _res = NULL; |
| 2730 | done: |
| 2731 | D(p->level--); |
| 2732 | return _res; |
| 2733 | } |
| 2734 | |
| 2735 | // global_stmt: 'global' ','.NAME+ |
| 2736 | static stmt_ty |
| 2737 | global_stmt_rule(Parser *p) |
| 2738 | { |
| 2739 | D(p->level++); |
| 2740 | if (p->error_indicator) { |
| 2741 | D(p->level--); |
| 2742 | return NULL; |
| 2743 | } |
| 2744 | stmt_ty _res = NULL; |
| 2745 | int _mark = p->mark; |
| 2746 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2747 | p->error_indicator = 1; |
| 2748 | D(p->level--); |
| 2749 | return NULL; |
| 2750 | } |
| 2751 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2752 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2753 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2754 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2755 | { // 'global' ','.NAME+ |
| 2756 | if (p->error_indicator) { |
| 2757 | D(p->level--); |
| 2758 | return NULL; |
| 2759 | } |
| 2760 | D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+")); |
| 2761 | Token * _keyword; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2762 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2763 | if ( |
| 2764 | (_keyword = _PyPegen_expect_token(p, 508)) // token='global' |
| 2765 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2766 | (a = (asdl_expr_seq*)_gather_25_rule(p)) // ','.NAME+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2767 | ) |
| 2768 | { |
| 2769 | D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+")); |
| 2770 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2771 | if (_token == NULL) { |
| 2772 | D(p->level--); |
| 2773 | return NULL; |
| 2774 | } |
| 2775 | int _end_lineno = _token->end_lineno; |
| 2776 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2777 | int _end_col_offset = _token->end_col_offset; |
| 2778 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2779 | _res = _Py_Global ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2780 | if (_res == NULL && PyErr_Occurred()) { |
| 2781 | p->error_indicator = 1; |
| 2782 | D(p->level--); |
| 2783 | return NULL; |
| 2784 | } |
| 2785 | goto done; |
| 2786 | } |
| 2787 | p->mark = _mark; |
| 2788 | D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2789 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+")); |
| 2790 | } |
| 2791 | _res = NULL; |
| 2792 | done: |
| 2793 | D(p->level--); |
| 2794 | return _res; |
| 2795 | } |
| 2796 | |
| 2797 | // nonlocal_stmt: 'nonlocal' ','.NAME+ |
| 2798 | static stmt_ty |
| 2799 | nonlocal_stmt_rule(Parser *p) |
| 2800 | { |
| 2801 | D(p->level++); |
| 2802 | if (p->error_indicator) { |
| 2803 | D(p->level--); |
| 2804 | return NULL; |
| 2805 | } |
| 2806 | stmt_ty _res = NULL; |
| 2807 | int _mark = p->mark; |
| 2808 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2809 | p->error_indicator = 1; |
| 2810 | D(p->level--); |
| 2811 | return NULL; |
| 2812 | } |
| 2813 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2814 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2815 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2816 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2817 | { // 'nonlocal' ','.NAME+ |
| 2818 | if (p->error_indicator) { |
| 2819 | D(p->level--); |
| 2820 | return NULL; |
| 2821 | } |
| 2822 | D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+")); |
| 2823 | Token * _keyword; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2824 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2825 | if ( |
| 2826 | (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal' |
| 2827 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2828 | (a = (asdl_expr_seq*)_gather_27_rule(p)) // ','.NAME+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2829 | ) |
| 2830 | { |
| 2831 | D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+")); |
| 2832 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2833 | if (_token == NULL) { |
| 2834 | D(p->level--); |
| 2835 | return NULL; |
| 2836 | } |
| 2837 | int _end_lineno = _token->end_lineno; |
| 2838 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2839 | int _end_col_offset = _token->end_col_offset; |
| 2840 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2841 | _res = _Py_Nonlocal ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2842 | if (_res == NULL && PyErr_Occurred()) { |
| 2843 | p->error_indicator = 1; |
| 2844 | D(p->level--); |
| 2845 | return NULL; |
| 2846 | } |
| 2847 | goto done; |
| 2848 | } |
| 2849 | p->mark = _mark; |
| 2850 | D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2851 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+")); |
| 2852 | } |
| 2853 | _res = NULL; |
| 2854 | done: |
| 2855 | D(p->level--); |
| 2856 | return _res; |
| 2857 | } |
| 2858 | |
| 2859 | // yield_stmt: yield_expr |
| 2860 | static stmt_ty |
| 2861 | yield_stmt_rule(Parser *p) |
| 2862 | { |
| 2863 | D(p->level++); |
| 2864 | if (p->error_indicator) { |
| 2865 | D(p->level--); |
| 2866 | return NULL; |
| 2867 | } |
| 2868 | stmt_ty _res = NULL; |
| 2869 | int _mark = p->mark; |
| 2870 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2871 | p->error_indicator = 1; |
| 2872 | D(p->level--); |
| 2873 | return NULL; |
| 2874 | } |
| 2875 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2876 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2877 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2878 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2879 | { // yield_expr |
| 2880 | if (p->error_indicator) { |
| 2881 | D(p->level--); |
| 2882 | return NULL; |
| 2883 | } |
| 2884 | D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 2885 | expr_ty y; |
| 2886 | if ( |
| 2887 | (y = yield_expr_rule(p)) // yield_expr |
| 2888 | ) |
| 2889 | { |
| 2890 | D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 2891 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2892 | if (_token == NULL) { |
| 2893 | D(p->level--); |
| 2894 | return NULL; |
| 2895 | } |
| 2896 | int _end_lineno = _token->end_lineno; |
| 2897 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2898 | int _end_col_offset = _token->end_col_offset; |
| 2899 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2900 | _res = _Py_Expr ( y , EXTRA ); |
| 2901 | if (_res == NULL && PyErr_Occurred()) { |
| 2902 | p->error_indicator = 1; |
| 2903 | D(p->level--); |
| 2904 | return NULL; |
| 2905 | } |
| 2906 | goto done; |
| 2907 | } |
| 2908 | p->mark = _mark; |
| 2909 | D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2910 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 2911 | } |
| 2912 | _res = NULL; |
| 2913 | done: |
| 2914 | D(p->level--); |
| 2915 | return _res; |
| 2916 | } |
| 2917 | |
| 2918 | // assert_stmt: 'assert' expression [',' expression] |
| 2919 | static stmt_ty |
| 2920 | assert_stmt_rule(Parser *p) |
| 2921 | { |
| 2922 | D(p->level++); |
| 2923 | if (p->error_indicator) { |
| 2924 | D(p->level--); |
| 2925 | return NULL; |
| 2926 | } |
| 2927 | stmt_ty _res = NULL; |
| 2928 | int _mark = p->mark; |
| 2929 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2930 | p->error_indicator = 1; |
| 2931 | D(p->level--); |
| 2932 | return NULL; |
| 2933 | } |
| 2934 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2935 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2936 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2937 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2938 | { // 'assert' expression [',' expression] |
| 2939 | if (p->error_indicator) { |
| 2940 | D(p->level--); |
| 2941 | return NULL; |
| 2942 | } |
| 2943 | D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]")); |
| 2944 | Token * _keyword; |
| 2945 | expr_ty a; |
| 2946 | void *b; |
| 2947 | if ( |
| 2948 | (_keyword = _PyPegen_expect_token(p, 505)) // token='assert' |
| 2949 | && |
| 2950 | (a = expression_rule(p)) // expression |
| 2951 | && |
| 2952 | (b = _tmp_29_rule(p), 1) // [',' expression] |
| 2953 | ) |
| 2954 | { |
| 2955 | D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]")); |
| 2956 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2957 | if (_token == NULL) { |
| 2958 | D(p->level--); |
| 2959 | return NULL; |
| 2960 | } |
| 2961 | int _end_lineno = _token->end_lineno; |
| 2962 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2963 | int _end_col_offset = _token->end_col_offset; |
| 2964 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2965 | _res = _Py_Assert ( a , b , EXTRA ); |
| 2966 | if (_res == NULL && PyErr_Occurred()) { |
| 2967 | p->error_indicator = 1; |
| 2968 | D(p->level--); |
| 2969 | return NULL; |
| 2970 | } |
| 2971 | goto done; |
| 2972 | } |
| 2973 | p->mark = _mark; |
| 2974 | D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2975 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]")); |
| 2976 | } |
| 2977 | _res = NULL; |
| 2978 | done: |
| 2979 | D(p->level--); |
| 2980 | return _res; |
| 2981 | } |
| 2982 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2983 | // del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2984 | static stmt_ty |
| 2985 | del_stmt_rule(Parser *p) |
| 2986 | { |
| 2987 | D(p->level++); |
| 2988 | if (p->error_indicator) { |
| 2989 | D(p->level--); |
| 2990 | return NULL; |
| 2991 | } |
| 2992 | stmt_ty _res = NULL; |
| 2993 | int _mark = p->mark; |
| 2994 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2995 | p->error_indicator = 1; |
| 2996 | D(p->level--); |
| 2997 | return NULL; |
| 2998 | } |
| 2999 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3000 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3001 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3002 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3003 | { // 'del' del_targets &(';' | NEWLINE) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3004 | if (p->error_indicator) { |
| 3005 | D(p->level--); |
| 3006 | return NULL; |
| 3007 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3008 | D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3009 | Token * _keyword; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3010 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3011 | if ( |
| 3012 | (_keyword = _PyPegen_expect_token(p, 503)) // token='del' |
| 3013 | && |
| 3014 | (a = del_targets_rule(p)) // del_targets |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3015 | && |
| 3016 | _PyPegen_lookahead(1, _tmp_30_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3017 | ) |
| 3018 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3019 | D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3020 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3021 | if (_token == NULL) { |
| 3022 | D(p->level--); |
| 3023 | return NULL; |
| 3024 | } |
| 3025 | int _end_lineno = _token->end_lineno; |
| 3026 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3027 | int _end_col_offset = _token->end_col_offset; |
| 3028 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3029 | _res = _Py_Delete ( a , EXTRA ); |
| 3030 | if (_res == NULL && PyErr_Occurred()) { |
| 3031 | p->error_indicator = 1; |
| 3032 | D(p->level--); |
| 3033 | return NULL; |
| 3034 | } |
| 3035 | goto done; |
| 3036 | } |
| 3037 | p->mark = _mark; |
| 3038 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3039 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)")); |
| 3040 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 3041 | if (p->call_invalid_rules) { // invalid_del_stmt |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3042 | if (p->error_indicator) { |
| 3043 | D(p->level--); |
| 3044 | return NULL; |
| 3045 | } |
| 3046 | D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt")); |
| 3047 | void *invalid_del_stmt_var; |
| 3048 | if ( |
| 3049 | (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt |
| 3050 | ) |
| 3051 | { |
| 3052 | D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt")); |
| 3053 | _res = invalid_del_stmt_var; |
| 3054 | goto done; |
| 3055 | } |
| 3056 | p->mark = _mark; |
| 3057 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3058 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3059 | } |
| 3060 | _res = NULL; |
| 3061 | done: |
| 3062 | D(p->level--); |
| 3063 | return _res; |
| 3064 | } |
| 3065 | |
| 3066 | // import_stmt: import_name | import_from |
| 3067 | static stmt_ty |
| 3068 | import_stmt_rule(Parser *p) |
| 3069 | { |
| 3070 | D(p->level++); |
| 3071 | if (p->error_indicator) { |
| 3072 | D(p->level--); |
| 3073 | return NULL; |
| 3074 | } |
| 3075 | stmt_ty _res = NULL; |
| 3076 | int _mark = p->mark; |
| 3077 | { // import_name |
| 3078 | if (p->error_indicator) { |
| 3079 | D(p->level--); |
| 3080 | return NULL; |
| 3081 | } |
| 3082 | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name")); |
| 3083 | stmt_ty import_name_var; |
| 3084 | if ( |
| 3085 | (import_name_var = import_name_rule(p)) // import_name |
| 3086 | ) |
| 3087 | { |
| 3088 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name")); |
| 3089 | _res = import_name_var; |
| 3090 | goto done; |
| 3091 | } |
| 3092 | p->mark = _mark; |
| 3093 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3094 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name")); |
| 3095 | } |
| 3096 | { // import_from |
| 3097 | if (p->error_indicator) { |
| 3098 | D(p->level--); |
| 3099 | return NULL; |
| 3100 | } |
| 3101 | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from")); |
| 3102 | stmt_ty import_from_var; |
| 3103 | if ( |
| 3104 | (import_from_var = import_from_rule(p)) // import_from |
| 3105 | ) |
| 3106 | { |
| 3107 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from")); |
| 3108 | _res = import_from_var; |
| 3109 | goto done; |
| 3110 | } |
| 3111 | p->mark = _mark; |
| 3112 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3113 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from")); |
| 3114 | } |
| 3115 | _res = NULL; |
| 3116 | done: |
| 3117 | D(p->level--); |
| 3118 | return _res; |
| 3119 | } |
| 3120 | |
| 3121 | // import_name: 'import' dotted_as_names |
| 3122 | static stmt_ty |
| 3123 | import_name_rule(Parser *p) |
| 3124 | { |
| 3125 | D(p->level++); |
| 3126 | if (p->error_indicator) { |
| 3127 | D(p->level--); |
| 3128 | return NULL; |
| 3129 | } |
| 3130 | stmt_ty _res = NULL; |
| 3131 | int _mark = p->mark; |
| 3132 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3133 | p->error_indicator = 1; |
| 3134 | D(p->level--); |
| 3135 | return NULL; |
| 3136 | } |
| 3137 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3138 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3139 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3140 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 3141 | { // 'import' dotted_as_names |
| 3142 | if (p->error_indicator) { |
| 3143 | D(p->level--); |
| 3144 | return NULL; |
| 3145 | } |
| 3146 | D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names")); |
| 3147 | Token * _keyword; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3148 | asdl_alias_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3149 | if ( |
| 3150 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
| 3151 | && |
| 3152 | (a = dotted_as_names_rule(p)) // dotted_as_names |
| 3153 | ) |
| 3154 | { |
| 3155 | D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names")); |
| 3156 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3157 | if (_token == NULL) { |
| 3158 | D(p->level--); |
| 3159 | return NULL; |
| 3160 | } |
| 3161 | int _end_lineno = _token->end_lineno; |
| 3162 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3163 | int _end_col_offset = _token->end_col_offset; |
| 3164 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3165 | _res = _Py_Import ( a , EXTRA ); |
| 3166 | if (_res == NULL && PyErr_Occurred()) { |
| 3167 | p->error_indicator = 1; |
| 3168 | D(p->level--); |
| 3169 | return NULL; |
| 3170 | } |
| 3171 | goto done; |
| 3172 | } |
| 3173 | p->mark = _mark; |
| 3174 | D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3175 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names")); |
| 3176 | } |
| 3177 | _res = NULL; |
| 3178 | done: |
| 3179 | D(p->level--); |
| 3180 | return _res; |
| 3181 | } |
| 3182 | |
| 3183 | // import_from: |
| 3184 | // | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
| 3185 | // | 'from' (('.' | '...'))+ 'import' import_from_targets |
| 3186 | static stmt_ty |
| 3187 | import_from_rule(Parser *p) |
| 3188 | { |
| 3189 | D(p->level++); |
| 3190 | if (p->error_indicator) { |
| 3191 | D(p->level--); |
| 3192 | return NULL; |
| 3193 | } |
| 3194 | stmt_ty _res = NULL; |
| 3195 | int _mark = p->mark; |
| 3196 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3197 | p->error_indicator = 1; |
| 3198 | D(p->level--); |
| 3199 | return NULL; |
| 3200 | } |
| 3201 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3202 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3203 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3204 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 3205 | { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
| 3206 | if (p->error_indicator) { |
| 3207 | D(p->level--); |
| 3208 | return NULL; |
| 3209 | } |
| 3210 | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
| 3211 | Token * _keyword; |
| 3212 | Token * _keyword_1; |
| 3213 | asdl_seq * a; |
| 3214 | expr_ty b; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3215 | asdl_alias_seq* c; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3216 | if ( |
| 3217 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
| 3218 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3219 | (a = _loop0_31_rule(p)) // (('.' | '...'))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3220 | && |
| 3221 | (b = dotted_name_rule(p)) // dotted_name |
| 3222 | && |
| 3223 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
| 3224 | && |
| 3225 | (c = import_from_targets_rule(p)) // import_from_targets |
| 3226 | ) |
| 3227 | { |
| 3228 | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
| 3229 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3230 | if (_token == NULL) { |
| 3231 | D(p->level--); |
| 3232 | return NULL; |
| 3233 | } |
| 3234 | int _end_lineno = _token->end_lineno; |
| 3235 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3236 | int _end_col_offset = _token->end_col_offset; |
| 3237 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3238 | _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
| 3239 | if (_res == NULL && PyErr_Occurred()) { |
| 3240 | p->error_indicator = 1; |
| 3241 | D(p->level--); |
| 3242 | return NULL; |
| 3243 | } |
| 3244 | goto done; |
| 3245 | } |
| 3246 | p->mark = _mark; |
| 3247 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
| 3248 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
| 3249 | } |
| 3250 | { // 'from' (('.' | '...'))+ 'import' import_from_targets |
| 3251 | if (p->error_indicator) { |
| 3252 | D(p->level--); |
| 3253 | return NULL; |
| 3254 | } |
| 3255 | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
| 3256 | Token * _keyword; |
| 3257 | Token * _keyword_1; |
| 3258 | asdl_seq * a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3259 | asdl_alias_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3260 | if ( |
| 3261 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
| 3262 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3263 | (a = _loop1_32_rule(p)) // (('.' | '...'))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3264 | && |
| 3265 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
| 3266 | && |
| 3267 | (b = import_from_targets_rule(p)) // import_from_targets |
| 3268 | ) |
| 3269 | { |
| 3270 | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
| 3271 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3272 | if (_token == NULL) { |
| 3273 | D(p->level--); |
| 3274 | return NULL; |
| 3275 | } |
| 3276 | int _end_lineno = _token->end_lineno; |
| 3277 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3278 | int _end_col_offset = _token->end_col_offset; |
| 3279 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3280 | _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
| 3281 | if (_res == NULL && PyErr_Occurred()) { |
| 3282 | p->error_indicator = 1; |
| 3283 | D(p->level--); |
| 3284 | return NULL; |
| 3285 | } |
| 3286 | goto done; |
| 3287 | } |
| 3288 | p->mark = _mark; |
| 3289 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
| 3290 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
| 3291 | } |
| 3292 | _res = NULL; |
| 3293 | done: |
| 3294 | D(p->level--); |
| 3295 | return _res; |
| 3296 | } |
| 3297 | |
| 3298 | // import_from_targets: |
| 3299 | // | '(' import_from_as_names ','? ')' |
| 3300 | // | import_from_as_names !',' |
| 3301 | // | '*' |
| 3302 | // | invalid_import_from_targets |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3303 | static asdl_alias_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3304 | import_from_targets_rule(Parser *p) |
| 3305 | { |
| 3306 | D(p->level++); |
| 3307 | if (p->error_indicator) { |
| 3308 | D(p->level--); |
| 3309 | return NULL; |
| 3310 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3311 | asdl_alias_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3312 | int _mark = p->mark; |
| 3313 | { // '(' import_from_as_names ','? ')' |
| 3314 | if (p->error_indicator) { |
| 3315 | D(p->level--); |
| 3316 | return NULL; |
| 3317 | } |
| 3318 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
| 3319 | Token * _literal; |
| 3320 | Token * _literal_1; |
| 3321 | void *_opt_var; |
| 3322 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3323 | asdl_alias_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3324 | if ( |
| 3325 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 3326 | && |
| 3327 | (a = import_from_as_names_rule(p)) // import_from_as_names |
| 3328 | && |
| 3329 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 3330 | && |
| 3331 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 3332 | ) |
| 3333 | { |
| 3334 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
| 3335 | _res = a; |
| 3336 | if (_res == NULL && PyErr_Occurred()) { |
| 3337 | p->error_indicator = 1; |
| 3338 | D(p->level--); |
| 3339 | return NULL; |
| 3340 | } |
| 3341 | goto done; |
| 3342 | } |
| 3343 | p->mark = _mark; |
| 3344 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3345 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
| 3346 | } |
| 3347 | { // import_from_as_names !',' |
| 3348 | if (p->error_indicator) { |
| 3349 | D(p->level--); |
| 3350 | return NULL; |
| 3351 | } |
| 3352 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3353 | asdl_alias_seq* import_from_as_names_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3354 | if ( |
| 3355 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
| 3356 | && |
| 3357 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
| 3358 | ) |
| 3359 | { |
| 3360 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','")); |
| 3361 | _res = import_from_as_names_var; |
| 3362 | goto done; |
| 3363 | } |
| 3364 | p->mark = _mark; |
| 3365 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3366 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','")); |
| 3367 | } |
| 3368 | { // '*' |
| 3369 | if (p->error_indicator) { |
| 3370 | D(p->level--); |
| 3371 | return NULL; |
| 3372 | } |
| 3373 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); |
| 3374 | Token * _literal; |
| 3375 | if ( |
| 3376 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 3377 | ) |
| 3378 | { |
| 3379 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 3380 | _res = ( asdl_alias_seq * ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p ) ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3381 | if (_res == NULL && PyErr_Occurred()) { |
| 3382 | p->error_indicator = 1; |
| 3383 | D(p->level--); |
| 3384 | return NULL; |
| 3385 | } |
| 3386 | goto done; |
| 3387 | } |
| 3388 | p->mark = _mark; |
| 3389 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3390 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); |
| 3391 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 3392 | if (p->call_invalid_rules) { // invalid_import_from_targets |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3393 | if (p->error_indicator) { |
| 3394 | D(p->level--); |
| 3395 | return NULL; |
| 3396 | } |
| 3397 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets")); |
| 3398 | void *invalid_import_from_targets_var; |
| 3399 | if ( |
| 3400 | (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets |
| 3401 | ) |
| 3402 | { |
| 3403 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets")); |
| 3404 | _res = invalid_import_from_targets_var; |
| 3405 | goto done; |
| 3406 | } |
| 3407 | p->mark = _mark; |
| 3408 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3409 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets")); |
| 3410 | } |
| 3411 | _res = NULL; |
| 3412 | done: |
| 3413 | D(p->level--); |
| 3414 | return _res; |
| 3415 | } |
| 3416 | |
| 3417 | // import_from_as_names: ','.import_from_as_name+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3418 | static asdl_alias_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3419 | import_from_as_names_rule(Parser *p) |
| 3420 | { |
| 3421 | D(p->level++); |
| 3422 | if (p->error_indicator) { |
| 3423 | D(p->level--); |
| 3424 | return NULL; |
| 3425 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3426 | asdl_alias_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3427 | int _mark = p->mark; |
| 3428 | { // ','.import_from_as_name+ |
| 3429 | if (p->error_indicator) { |
| 3430 | D(p->level--); |
| 3431 | return NULL; |
| 3432 | } |
| 3433 | D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3434 | asdl_alias_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3435 | if ( |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3436 | (a = (asdl_alias_seq*)_gather_33_rule(p)) // ','.import_from_as_name+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3437 | ) |
| 3438 | { |
| 3439 | D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+")); |
| 3440 | _res = a; |
| 3441 | if (_res == NULL && PyErr_Occurred()) { |
| 3442 | p->error_indicator = 1; |
| 3443 | D(p->level--); |
| 3444 | return NULL; |
| 3445 | } |
| 3446 | goto done; |
| 3447 | } |
| 3448 | p->mark = _mark; |
| 3449 | D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
| 3450 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+")); |
| 3451 | } |
| 3452 | _res = NULL; |
| 3453 | done: |
| 3454 | D(p->level--); |
| 3455 | return _res; |
| 3456 | } |
| 3457 | |
| 3458 | // import_from_as_name: NAME ['as' NAME] |
| 3459 | static alias_ty |
| 3460 | import_from_as_name_rule(Parser *p) |
| 3461 | { |
| 3462 | D(p->level++); |
| 3463 | if (p->error_indicator) { |
| 3464 | D(p->level--); |
| 3465 | return NULL; |
| 3466 | } |
| 3467 | alias_ty _res = NULL; |
| 3468 | int _mark = p->mark; |
| 3469 | { // NAME ['as' NAME] |
| 3470 | if (p->error_indicator) { |
| 3471 | D(p->level--); |
| 3472 | return NULL; |
| 3473 | } |
| 3474 | D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]")); |
| 3475 | expr_ty a; |
| 3476 | void *b; |
| 3477 | if ( |
| 3478 | (a = _PyPegen_name_token(p)) // NAME |
| 3479 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3480 | (b = _tmp_35_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3481 | ) |
| 3482 | { |
| 3483 | D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]")); |
| 3484 | _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena ); |
| 3485 | if (_res == NULL && PyErr_Occurred()) { |
| 3486 | p->error_indicator = 1; |
| 3487 | D(p->level--); |
| 3488 | return NULL; |
| 3489 | } |
| 3490 | goto done; |
| 3491 | } |
| 3492 | p->mark = _mark; |
| 3493 | D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3494 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]")); |
| 3495 | } |
| 3496 | _res = NULL; |
| 3497 | done: |
| 3498 | D(p->level--); |
| 3499 | return _res; |
| 3500 | } |
| 3501 | |
| 3502 | // dotted_as_names: ','.dotted_as_name+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3503 | static asdl_alias_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3504 | dotted_as_names_rule(Parser *p) |
| 3505 | { |
| 3506 | D(p->level++); |
| 3507 | if (p->error_indicator) { |
| 3508 | D(p->level--); |
| 3509 | return NULL; |
| 3510 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3511 | asdl_alias_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3512 | int _mark = p->mark; |
| 3513 | { // ','.dotted_as_name+ |
| 3514 | if (p->error_indicator) { |
| 3515 | D(p->level--); |
| 3516 | return NULL; |
| 3517 | } |
| 3518 | D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3519 | asdl_alias_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3520 | if ( |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3521 | (a = (asdl_alias_seq*)_gather_36_rule(p)) // ','.dotted_as_name+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3522 | ) |
| 3523 | { |
| 3524 | D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+")); |
| 3525 | _res = a; |
| 3526 | if (_res == NULL && PyErr_Occurred()) { |
| 3527 | p->error_indicator = 1; |
| 3528 | D(p->level--); |
| 3529 | return NULL; |
| 3530 | } |
| 3531 | goto done; |
| 3532 | } |
| 3533 | p->mark = _mark; |
| 3534 | D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
| 3535 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+")); |
| 3536 | } |
| 3537 | _res = NULL; |
| 3538 | done: |
| 3539 | D(p->level--); |
| 3540 | return _res; |
| 3541 | } |
| 3542 | |
| 3543 | // dotted_as_name: dotted_name ['as' NAME] |
| 3544 | static alias_ty |
| 3545 | dotted_as_name_rule(Parser *p) |
| 3546 | { |
| 3547 | D(p->level++); |
| 3548 | if (p->error_indicator) { |
| 3549 | D(p->level--); |
| 3550 | return NULL; |
| 3551 | } |
| 3552 | alias_ty _res = NULL; |
| 3553 | int _mark = p->mark; |
| 3554 | { // dotted_name ['as' NAME] |
| 3555 | if (p->error_indicator) { |
| 3556 | D(p->level--); |
| 3557 | return NULL; |
| 3558 | } |
| 3559 | D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]")); |
| 3560 | expr_ty a; |
| 3561 | void *b; |
| 3562 | if ( |
| 3563 | (a = dotted_name_rule(p)) // dotted_name |
| 3564 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3565 | (b = _tmp_38_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3566 | ) |
| 3567 | { |
| 3568 | D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]")); |
| 3569 | _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena ); |
| 3570 | if (_res == NULL && PyErr_Occurred()) { |
| 3571 | p->error_indicator = 1; |
| 3572 | D(p->level--); |
| 3573 | return NULL; |
| 3574 | } |
| 3575 | goto done; |
| 3576 | } |
| 3577 | p->mark = _mark; |
| 3578 | D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3579 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]")); |
| 3580 | } |
| 3581 | _res = NULL; |
| 3582 | done: |
| 3583 | D(p->level--); |
| 3584 | return _res; |
| 3585 | } |
| 3586 | |
| 3587 | // Left-recursive |
| 3588 | // dotted_name: dotted_name '.' NAME | NAME |
| 3589 | static expr_ty dotted_name_raw(Parser *); |
| 3590 | static expr_ty |
| 3591 | dotted_name_rule(Parser *p) |
| 3592 | { |
| 3593 | D(p->level++); |
| 3594 | expr_ty _res = NULL; |
| 3595 | if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) { |
| 3596 | D(p->level--); |
| 3597 | return _res; |
| 3598 | } |
| 3599 | int _mark = p->mark; |
| 3600 | int _resmark = p->mark; |
| 3601 | while (1) { |
| 3602 | int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res); |
| 3603 | if (tmpvar_0) { |
| 3604 | D(p->level--); |
| 3605 | return _res; |
| 3606 | } |
| 3607 | p->mark = _mark; |
| 3608 | void *_raw = dotted_name_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 3609 | if (p->error_indicator) |
| 3610 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3611 | if (_raw == NULL || p->mark <= _resmark) |
| 3612 | break; |
| 3613 | _resmark = p->mark; |
| 3614 | _res = _raw; |
| 3615 | } |
| 3616 | p->mark = _resmark; |
| 3617 | D(p->level--); |
| 3618 | return _res; |
| 3619 | } |
| 3620 | static expr_ty |
| 3621 | dotted_name_raw(Parser *p) |
| 3622 | { |
| 3623 | D(p->level++); |
| 3624 | if (p->error_indicator) { |
| 3625 | D(p->level--); |
| 3626 | return NULL; |
| 3627 | } |
| 3628 | expr_ty _res = NULL; |
| 3629 | int _mark = p->mark; |
| 3630 | { // dotted_name '.' NAME |
| 3631 | if (p->error_indicator) { |
| 3632 | D(p->level--); |
| 3633 | return NULL; |
| 3634 | } |
| 3635 | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME")); |
| 3636 | Token * _literal; |
| 3637 | expr_ty a; |
| 3638 | expr_ty b; |
| 3639 | if ( |
| 3640 | (a = dotted_name_rule(p)) // dotted_name |
| 3641 | && |
| 3642 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 3643 | && |
| 3644 | (b = _PyPegen_name_token(p)) // NAME |
| 3645 | ) |
| 3646 | { |
| 3647 | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME")); |
| 3648 | _res = _PyPegen_join_names_with_dot ( p , a , b ); |
| 3649 | if (_res == NULL && PyErr_Occurred()) { |
| 3650 | p->error_indicator = 1; |
| 3651 | D(p->level--); |
| 3652 | return NULL; |
| 3653 | } |
| 3654 | goto done; |
| 3655 | } |
| 3656 | p->mark = _mark; |
| 3657 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3658 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME")); |
| 3659 | } |
| 3660 | { // NAME |
| 3661 | if (p->error_indicator) { |
| 3662 | D(p->level--); |
| 3663 | return NULL; |
| 3664 | } |
| 3665 | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 3666 | expr_ty name_var; |
| 3667 | if ( |
| 3668 | (name_var = _PyPegen_name_token(p)) // NAME |
| 3669 | ) |
| 3670 | { |
| 3671 | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 3672 | _res = name_var; |
| 3673 | goto done; |
| 3674 | } |
| 3675 | p->mark = _mark; |
| 3676 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3677 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 3678 | } |
| 3679 | _res = NULL; |
| 3680 | done: |
| 3681 | D(p->level--); |
| 3682 | return _res; |
| 3683 | } |
| 3684 | |
| 3685 | // if_stmt: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3686 | // | 'if' named_expression &&':' block elif_stmt |
| 3687 | // | 'if' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3688 | static stmt_ty |
| 3689 | if_stmt_rule(Parser *p) |
| 3690 | { |
| 3691 | D(p->level++); |
| 3692 | if (p->error_indicator) { |
| 3693 | D(p->level--); |
| 3694 | return NULL; |
| 3695 | } |
| 3696 | stmt_ty _res = NULL; |
| 3697 | int _mark = p->mark; |
| 3698 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3699 | p->error_indicator = 1; |
| 3700 | D(p->level--); |
| 3701 | return NULL; |
| 3702 | } |
| 3703 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3704 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3705 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3706 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3707 | { // 'if' named_expression &&':' block elif_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3708 | if (p->error_indicator) { |
| 3709 | D(p->level--); |
| 3710 | return NULL; |
| 3711 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3712 | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression &&':' block elif_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3713 | Token * _keyword; |
| 3714 | Token * _literal; |
| 3715 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3716 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3717 | stmt_ty c; |
| 3718 | if ( |
| 3719 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 3720 | && |
| 3721 | (a = named_expression_rule(p)) // named_expression |
| 3722 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3723 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3724 | && |
| 3725 | (b = block_rule(p)) // block |
| 3726 | && |
| 3727 | (c = elif_stmt_rule(p)) // elif_stmt |
| 3728 | ) |
| 3729 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3730 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression &&':' block elif_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3731 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3732 | if (_token == NULL) { |
| 3733 | D(p->level--); |
| 3734 | return NULL; |
| 3735 | } |
| 3736 | int _end_lineno = _token->end_lineno; |
| 3737 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3738 | int _end_col_offset = _token->end_col_offset; |
| 3739 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 3740 | _res = _Py_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3741 | if (_res == NULL && PyErr_Occurred()) { |
| 3742 | p->error_indicator = 1; |
| 3743 | D(p->level--); |
| 3744 | return NULL; |
| 3745 | } |
| 3746 | goto done; |
| 3747 | } |
| 3748 | p->mark = _mark; |
| 3749 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3750 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression &&':' block elif_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3751 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3752 | { // 'if' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3753 | if (p->error_indicator) { |
| 3754 | D(p->level--); |
| 3755 | return NULL; |
| 3756 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3757 | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3758 | Token * _keyword; |
| 3759 | Token * _literal; |
| 3760 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3761 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3762 | void *c; |
| 3763 | if ( |
| 3764 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 3765 | && |
| 3766 | (a = named_expression_rule(p)) // named_expression |
| 3767 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3768 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3769 | && |
| 3770 | (b = block_rule(p)) // block |
| 3771 | && |
| 3772 | (c = else_block_rule(p), 1) // else_block? |
| 3773 | ) |
| 3774 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3775 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3776 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3777 | if (_token == NULL) { |
| 3778 | D(p->level--); |
| 3779 | return NULL; |
| 3780 | } |
| 3781 | int _end_lineno = _token->end_lineno; |
| 3782 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3783 | int _end_col_offset = _token->end_col_offset; |
| 3784 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3785 | _res = _Py_If ( a , b , c , EXTRA ); |
| 3786 | if (_res == NULL && PyErr_Occurred()) { |
| 3787 | p->error_indicator = 1; |
| 3788 | D(p->level--); |
| 3789 | return NULL; |
| 3790 | } |
| 3791 | goto done; |
| 3792 | } |
| 3793 | p->mark = _mark; |
| 3794 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3795 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3796 | } |
| 3797 | _res = NULL; |
| 3798 | done: |
| 3799 | D(p->level--); |
| 3800 | return _res; |
| 3801 | } |
| 3802 | |
| 3803 | // elif_stmt: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3804 | // | 'elif' named_expression &&':' block elif_stmt |
| 3805 | // | 'elif' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3806 | static stmt_ty |
| 3807 | elif_stmt_rule(Parser *p) |
| 3808 | { |
| 3809 | D(p->level++); |
| 3810 | if (p->error_indicator) { |
| 3811 | D(p->level--); |
| 3812 | return NULL; |
| 3813 | } |
| 3814 | stmt_ty _res = NULL; |
| 3815 | int _mark = p->mark; |
| 3816 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3817 | p->error_indicator = 1; |
| 3818 | D(p->level--); |
| 3819 | return NULL; |
| 3820 | } |
| 3821 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3822 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3823 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3824 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3825 | { // 'elif' named_expression &&':' block elif_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3826 | if (p->error_indicator) { |
| 3827 | D(p->level--); |
| 3828 | return NULL; |
| 3829 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3830 | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression &&':' block elif_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3831 | Token * _keyword; |
| 3832 | Token * _literal; |
| 3833 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3834 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3835 | stmt_ty c; |
| 3836 | if ( |
| 3837 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
| 3838 | && |
| 3839 | (a = named_expression_rule(p)) // named_expression |
| 3840 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3841 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3842 | && |
| 3843 | (b = block_rule(p)) // block |
| 3844 | && |
| 3845 | (c = elif_stmt_rule(p)) // elif_stmt |
| 3846 | ) |
| 3847 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3848 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression &&':' block elif_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3849 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3850 | if (_token == NULL) { |
| 3851 | D(p->level--); |
| 3852 | return NULL; |
| 3853 | } |
| 3854 | int _end_lineno = _token->end_lineno; |
| 3855 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3856 | int _end_col_offset = _token->end_col_offset; |
| 3857 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 3858 | _res = _Py_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3859 | if (_res == NULL && PyErr_Occurred()) { |
| 3860 | p->error_indicator = 1; |
| 3861 | D(p->level--); |
| 3862 | return NULL; |
| 3863 | } |
| 3864 | goto done; |
| 3865 | } |
| 3866 | p->mark = _mark; |
| 3867 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3868 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression &&':' block elif_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3869 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3870 | { // 'elif' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3871 | if (p->error_indicator) { |
| 3872 | D(p->level--); |
| 3873 | return NULL; |
| 3874 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3875 | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3876 | Token * _keyword; |
| 3877 | Token * _literal; |
| 3878 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3879 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3880 | void *c; |
| 3881 | if ( |
| 3882 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
| 3883 | && |
| 3884 | (a = named_expression_rule(p)) // named_expression |
| 3885 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3886 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3887 | && |
| 3888 | (b = block_rule(p)) // block |
| 3889 | && |
| 3890 | (c = else_block_rule(p), 1) // else_block? |
| 3891 | ) |
| 3892 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3893 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3894 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3895 | if (_token == NULL) { |
| 3896 | D(p->level--); |
| 3897 | return NULL; |
| 3898 | } |
| 3899 | int _end_lineno = _token->end_lineno; |
| 3900 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3901 | int _end_col_offset = _token->end_col_offset; |
| 3902 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3903 | _res = _Py_If ( a , b , c , EXTRA ); |
| 3904 | if (_res == NULL && PyErr_Occurred()) { |
| 3905 | p->error_indicator = 1; |
| 3906 | D(p->level--); |
| 3907 | return NULL; |
| 3908 | } |
| 3909 | goto done; |
| 3910 | } |
| 3911 | p->mark = _mark; |
| 3912 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3913 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3914 | } |
| 3915 | _res = NULL; |
| 3916 | done: |
| 3917 | D(p->level--); |
| 3918 | return _res; |
| 3919 | } |
| 3920 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3921 | // else_block: 'else' &&':' block |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3922 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3923 | else_block_rule(Parser *p) |
| 3924 | { |
| 3925 | D(p->level++); |
| 3926 | if (p->error_indicator) { |
| 3927 | D(p->level--); |
| 3928 | return NULL; |
| 3929 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3930 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3931 | int _mark = p->mark; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3932 | { // 'else' &&':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3933 | if (p->error_indicator) { |
| 3934 | D(p->level--); |
| 3935 | return NULL; |
| 3936 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3937 | D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' &&':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3938 | Token * _keyword; |
| 3939 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3940 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3941 | if ( |
| 3942 | (_keyword = _PyPegen_expect_token(p, 516)) // token='else' |
| 3943 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3944 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3945 | && |
| 3946 | (b = block_rule(p)) // block |
| 3947 | ) |
| 3948 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3949 | D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' &&':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3950 | _res = b; |
| 3951 | if (_res == NULL && PyErr_Occurred()) { |
| 3952 | p->error_indicator = 1; |
| 3953 | D(p->level--); |
| 3954 | return NULL; |
| 3955 | } |
| 3956 | goto done; |
| 3957 | } |
| 3958 | p->mark = _mark; |
| 3959 | D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3960 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' &&':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3961 | } |
| 3962 | _res = NULL; |
| 3963 | done: |
| 3964 | D(p->level--); |
| 3965 | return _res; |
| 3966 | } |
| 3967 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3968 | // while_stmt: 'while' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3969 | static stmt_ty |
| 3970 | while_stmt_rule(Parser *p) |
| 3971 | { |
| 3972 | D(p->level++); |
| 3973 | if (p->error_indicator) { |
| 3974 | D(p->level--); |
| 3975 | return NULL; |
| 3976 | } |
| 3977 | stmt_ty _res = NULL; |
| 3978 | int _mark = p->mark; |
| 3979 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3980 | p->error_indicator = 1; |
| 3981 | D(p->level--); |
| 3982 | return NULL; |
| 3983 | } |
| 3984 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3985 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3986 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3987 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3988 | { // 'while' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3989 | if (p->error_indicator) { |
| 3990 | D(p->level--); |
| 3991 | return NULL; |
| 3992 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3993 | D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3994 | Token * _keyword; |
| 3995 | Token * _literal; |
| 3996 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3997 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3998 | void *c; |
| 3999 | if ( |
| 4000 | (_keyword = _PyPegen_expect_token(p, 512)) // token='while' |
| 4001 | && |
| 4002 | (a = named_expression_rule(p)) // named_expression |
| 4003 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4004 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4005 | && |
| 4006 | (b = block_rule(p)) // block |
| 4007 | && |
| 4008 | (c = else_block_rule(p), 1) // else_block? |
| 4009 | ) |
| 4010 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4011 | D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4012 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4013 | if (_token == NULL) { |
| 4014 | D(p->level--); |
| 4015 | return NULL; |
| 4016 | } |
| 4017 | int _end_lineno = _token->end_lineno; |
| 4018 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4019 | int _end_col_offset = _token->end_col_offset; |
| 4020 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4021 | _res = _Py_While ( a , b , c , EXTRA ); |
| 4022 | if (_res == NULL && PyErr_Occurred()) { |
| 4023 | p->error_indicator = 1; |
| 4024 | D(p->level--); |
| 4025 | return NULL; |
| 4026 | } |
| 4027 | goto done; |
| 4028 | } |
| 4029 | p->mark = _mark; |
| 4030 | D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4031 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression &&':' block else_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4032 | } |
| 4033 | _res = NULL; |
| 4034 | done: |
| 4035 | D(p->level--); |
| 4036 | return _res; |
| 4037 | } |
| 4038 | |
| 4039 | // for_stmt: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4040 | // | 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
| 4041 | // | ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4042 | // | invalid_for_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4043 | static stmt_ty |
| 4044 | for_stmt_rule(Parser *p) |
| 4045 | { |
| 4046 | D(p->level++); |
| 4047 | if (p->error_indicator) { |
| 4048 | D(p->level--); |
| 4049 | return NULL; |
| 4050 | } |
| 4051 | stmt_ty _res = NULL; |
| 4052 | int _mark = p->mark; |
| 4053 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4054 | p->error_indicator = 1; |
| 4055 | D(p->level--); |
| 4056 | return NULL; |
| 4057 | } |
| 4058 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4059 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4060 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4061 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4062 | { // 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4063 | if (p->error_indicator) { |
| 4064 | D(p->level--); |
| 4065 | return NULL; |
| 4066 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4067 | 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?")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4068 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4069 | Token * _keyword; |
| 4070 | Token * _keyword_1; |
| 4071 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4072 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4073 | void *el; |
| 4074 | expr_ty ex; |
| 4075 | expr_ty t; |
| 4076 | void *tc; |
| 4077 | if ( |
| 4078 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 4079 | && |
| 4080 | (t = star_targets_rule(p)) // star_targets |
| 4081 | && |
| 4082 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 4083 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4084 | (_cut_var = 1) |
| 4085 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4086 | (ex = star_expressions_rule(p)) // star_expressions |
| 4087 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4088 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4089 | && |
| 4090 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 4091 | && |
| 4092 | (b = block_rule(p)) // block |
| 4093 | && |
| 4094 | (el = else_block_rule(p), 1) // else_block? |
| 4095 | ) |
| 4096 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4097 | 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?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4098 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4099 | if (_token == NULL) { |
| 4100 | D(p->level--); |
| 4101 | return NULL; |
| 4102 | } |
| 4103 | int _end_lineno = _token->end_lineno; |
| 4104 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4105 | int _end_col_offset = _token->end_col_offset; |
| 4106 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4107 | _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 4108 | if (_res == NULL && PyErr_Occurred()) { |
| 4109 | p->error_indicator = 1; |
| 4110 | D(p->level--); |
| 4111 | return NULL; |
| 4112 | } |
| 4113 | goto done; |
| 4114 | } |
| 4115 | p->mark = _mark; |
| 4116 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4117 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4118 | if (_cut_var) { |
| 4119 | D(p->level--); |
| 4120 | return NULL; |
| 4121 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4122 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4123 | { // ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4124 | if (p->error_indicator) { |
| 4125 | D(p->level--); |
| 4126 | return NULL; |
| 4127 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4128 | 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?")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4129 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4130 | Token * _keyword; |
| 4131 | Token * _keyword_1; |
| 4132 | Token * _literal; |
| 4133 | Token * async_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4134 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4135 | void *el; |
| 4136 | expr_ty ex; |
| 4137 | expr_ty t; |
| 4138 | void *tc; |
| 4139 | if ( |
| 4140 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 4141 | && |
| 4142 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 4143 | && |
| 4144 | (t = star_targets_rule(p)) // star_targets |
| 4145 | && |
| 4146 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 4147 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4148 | (_cut_var = 1) |
| 4149 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4150 | (ex = star_expressions_rule(p)) // star_expressions |
| 4151 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4152 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4153 | && |
| 4154 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 4155 | && |
| 4156 | (b = block_rule(p)) // block |
| 4157 | && |
| 4158 | (el = else_block_rule(p), 1) // else_block? |
| 4159 | ) |
| 4160 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4161 | 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?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4162 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4163 | if (_token == NULL) { |
| 4164 | D(p->level--); |
| 4165 | return NULL; |
| 4166 | } |
| 4167 | int _end_lineno = _token->end_lineno; |
| 4168 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4169 | int _end_col_offset = _token->end_col_offset; |
| 4170 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 4171 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4172 | if (_res == NULL && PyErr_Occurred()) { |
| 4173 | p->error_indicator = 1; |
| 4174 | D(p->level--); |
| 4175 | return NULL; |
| 4176 | } |
| 4177 | goto done; |
| 4178 | } |
| 4179 | p->mark = _mark; |
| 4180 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4181 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4182 | if (_cut_var) { |
| 4183 | D(p->level--); |
| 4184 | return NULL; |
| 4185 | } |
| 4186 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 4187 | if (p->call_invalid_rules) { // invalid_for_target |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4188 | if (p->error_indicator) { |
| 4189 | D(p->level--); |
| 4190 | return NULL; |
| 4191 | } |
| 4192 | D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
| 4193 | void *invalid_for_target_var; |
| 4194 | if ( |
| 4195 | (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target |
| 4196 | ) |
| 4197 | { |
| 4198 | D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
| 4199 | _res = invalid_for_target_var; |
| 4200 | goto done; |
| 4201 | } |
| 4202 | p->mark = _mark; |
| 4203 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4204 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4205 | } |
| 4206 | _res = NULL; |
| 4207 | done: |
| 4208 | D(p->level--); |
| 4209 | return _res; |
| 4210 | } |
| 4211 | |
| 4212 | // with_stmt: |
| 4213 | // | 'with' '(' ','.with_item+ ','? ')' ':' block |
| 4214 | // | 'with' ','.with_item+ ':' TYPE_COMMENT? block |
| 4215 | // | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
| 4216 | // | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4217 | // | invalid_with_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4218 | static stmt_ty |
| 4219 | with_stmt_rule(Parser *p) |
| 4220 | { |
| 4221 | D(p->level++); |
| 4222 | if (p->error_indicator) { |
| 4223 | D(p->level--); |
| 4224 | return NULL; |
| 4225 | } |
| 4226 | stmt_ty _res = NULL; |
| 4227 | int _mark = p->mark; |
| 4228 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4229 | p->error_indicator = 1; |
| 4230 | D(p->level--); |
| 4231 | return NULL; |
| 4232 | } |
| 4233 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4234 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4235 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4236 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 4237 | { // 'with' '(' ','.with_item+ ','? ')' ':' block |
| 4238 | if (p->error_indicator) { |
| 4239 | D(p->level--); |
| 4240 | return NULL; |
| 4241 | } |
| 4242 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4243 | Token * _keyword; |
| 4244 | Token * _literal; |
| 4245 | Token * _literal_1; |
| 4246 | Token * _literal_2; |
| 4247 | void *_opt_var; |
| 4248 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4249 | asdl_withitem_seq* a; |
| 4250 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4251 | if ( |
| 4252 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 4253 | && |
| 4254 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 4255 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4256 | (a = (asdl_withitem_seq*)_gather_39_rule(p)) // ','.with_item+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4257 | && |
| 4258 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 4259 | && |
| 4260 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 4261 | && |
| 4262 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
| 4263 | && |
| 4264 | (b = block_rule(p)) // block |
| 4265 | ) |
| 4266 | { |
| 4267 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4268 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4269 | if (_token == NULL) { |
| 4270 | D(p->level--); |
| 4271 | return NULL; |
| 4272 | } |
| 4273 | int _end_lineno = _token->end_lineno; |
| 4274 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4275 | int _end_col_offset = _token->end_col_offset; |
| 4276 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4277 | _res = _Py_With ( a , b , NULL , EXTRA ); |
| 4278 | if (_res == NULL && PyErr_Occurred()) { |
| 4279 | p->error_indicator = 1; |
| 4280 | D(p->level--); |
| 4281 | return NULL; |
| 4282 | } |
| 4283 | goto done; |
| 4284 | } |
| 4285 | p->mark = _mark; |
| 4286 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4287 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4288 | } |
| 4289 | { // 'with' ','.with_item+ ':' TYPE_COMMENT? block |
| 4290 | if (p->error_indicator) { |
| 4291 | D(p->level--); |
| 4292 | return NULL; |
| 4293 | } |
| 4294 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4295 | Token * _keyword; |
| 4296 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4297 | asdl_withitem_seq* a; |
| 4298 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4299 | void *tc; |
| 4300 | if ( |
| 4301 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 4302 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4303 | (a = (asdl_withitem_seq*)_gather_41_rule(p)) // ','.with_item+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4304 | && |
| 4305 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 4306 | && |
| 4307 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 4308 | && |
| 4309 | (b = block_rule(p)) // block |
| 4310 | ) |
| 4311 | { |
| 4312 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4313 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4314 | if (_token == NULL) { |
| 4315 | D(p->level--); |
| 4316 | return NULL; |
| 4317 | } |
| 4318 | int _end_lineno = _token->end_lineno; |
| 4319 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4320 | int _end_col_offset = _token->end_col_offset; |
| 4321 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4322 | _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 4323 | if (_res == NULL && PyErr_Occurred()) { |
| 4324 | p->error_indicator = 1; |
| 4325 | D(p->level--); |
| 4326 | return NULL; |
| 4327 | } |
| 4328 | goto done; |
| 4329 | } |
| 4330 | p->mark = _mark; |
| 4331 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4332 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4333 | } |
| 4334 | { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
| 4335 | if (p->error_indicator) { |
| 4336 | D(p->level--); |
| 4337 | return NULL; |
| 4338 | } |
| 4339 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4340 | Token * _keyword; |
| 4341 | Token * _literal; |
| 4342 | Token * _literal_1; |
| 4343 | Token * _literal_2; |
| 4344 | void *_opt_var; |
| 4345 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4346 | asdl_withitem_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4347 | Token * async_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4348 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4349 | if ( |
| 4350 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 4351 | && |
| 4352 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 4353 | && |
| 4354 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 4355 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4356 | (a = (asdl_withitem_seq*)_gather_43_rule(p)) // ','.with_item+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4357 | && |
| 4358 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 4359 | && |
| 4360 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 4361 | && |
| 4362 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
| 4363 | && |
| 4364 | (b = block_rule(p)) // block |
| 4365 | ) |
| 4366 | { |
| 4367 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4368 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4369 | if (_token == NULL) { |
| 4370 | D(p->level--); |
| 4371 | return NULL; |
| 4372 | } |
| 4373 | int _end_lineno = _token->end_lineno; |
| 4374 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4375 | int _end_col_offset = _token->end_col_offset; |
| 4376 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 4377 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4378 | if (_res == NULL && PyErr_Occurred()) { |
| 4379 | p->error_indicator = 1; |
| 4380 | D(p->level--); |
| 4381 | return NULL; |
| 4382 | } |
| 4383 | goto done; |
| 4384 | } |
| 4385 | p->mark = _mark; |
| 4386 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4387 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4388 | } |
| 4389 | { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
| 4390 | if (p->error_indicator) { |
| 4391 | D(p->level--); |
| 4392 | return NULL; |
| 4393 | } |
| 4394 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4395 | Token * _keyword; |
| 4396 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4397 | asdl_withitem_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4398 | Token * async_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4399 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4400 | void *tc; |
| 4401 | if ( |
| 4402 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 4403 | && |
| 4404 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 4405 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4406 | (a = (asdl_withitem_seq*)_gather_45_rule(p)) // ','.with_item+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4407 | && |
| 4408 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 4409 | && |
| 4410 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 4411 | && |
| 4412 | (b = block_rule(p)) // block |
| 4413 | ) |
| 4414 | { |
| 4415 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4416 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4417 | if (_token == NULL) { |
| 4418 | D(p->level--); |
| 4419 | return NULL; |
| 4420 | } |
| 4421 | int _end_lineno = _token->end_lineno; |
| 4422 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4423 | int _end_col_offset = _token->end_col_offset; |
| 4424 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 4425 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4426 | if (_res == NULL && PyErr_Occurred()) { |
| 4427 | p->error_indicator = 1; |
| 4428 | D(p->level--); |
| 4429 | return NULL; |
| 4430 | } |
| 4431 | goto done; |
| 4432 | } |
| 4433 | p->mark = _mark; |
| 4434 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4435 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4436 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4437 | if (p->call_invalid_rules) { // invalid_with_stmt |
| 4438 | if (p->error_indicator) { |
| 4439 | D(p->level--); |
| 4440 | return NULL; |
| 4441 | } |
| 4442 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt")); |
| 4443 | void *invalid_with_stmt_var; |
| 4444 | if ( |
| 4445 | (invalid_with_stmt_var = invalid_with_stmt_rule(p)) // invalid_with_stmt |
| 4446 | ) |
| 4447 | { |
| 4448 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt")); |
| 4449 | _res = invalid_with_stmt_var; |
| 4450 | goto done; |
| 4451 | } |
| 4452 | p->mark = _mark; |
| 4453 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4454 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt")); |
| 4455 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4456 | _res = NULL; |
| 4457 | done: |
| 4458 | D(p->level--); |
| 4459 | return _res; |
| 4460 | } |
| 4461 | |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4462 | // with_item: |
| 4463 | // | expression 'as' star_target &(',' | ')' | ':') |
| 4464 | // | invalid_with_item |
| 4465 | // | expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4466 | static withitem_ty |
| 4467 | with_item_rule(Parser *p) |
| 4468 | { |
| 4469 | D(p->level++); |
| 4470 | if (p->error_indicator) { |
| 4471 | D(p->level--); |
| 4472 | return NULL; |
| 4473 | } |
| 4474 | withitem_ty _res = NULL; |
| 4475 | int _mark = p->mark; |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4476 | { // expression 'as' star_target &(',' | ')' | ':') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4477 | if (p->error_indicator) { |
| 4478 | D(p->level--); |
| 4479 | return NULL; |
| 4480 | } |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4481 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4482 | Token * _keyword; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4483 | expr_ty e; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4484 | expr_ty t; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4485 | if ( |
| 4486 | (e = expression_rule(p)) // expression |
| 4487 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4488 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 4489 | && |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4490 | (t = star_target_rule(p)) // star_target |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4491 | && |
| 4492 | _PyPegen_lookahead(1, _tmp_47_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4493 | ) |
| 4494 | { |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4495 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4496 | _res = _Py_withitem ( e , t , p -> arena ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4497 | if (_res == NULL && PyErr_Occurred()) { |
| 4498 | p->error_indicator = 1; |
| 4499 | D(p->level--); |
| 4500 | return NULL; |
| 4501 | } |
| 4502 | goto done; |
| 4503 | } |
| 4504 | p->mark = _mark; |
| 4505 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4506 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4507 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 4508 | if (p->call_invalid_rules) { // invalid_with_item |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4509 | if (p->error_indicator) { |
| 4510 | D(p->level--); |
| 4511 | return NULL; |
| 4512 | } |
| 4513 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item")); |
| 4514 | void *invalid_with_item_var; |
| 4515 | if ( |
| 4516 | (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item |
| 4517 | ) |
| 4518 | { |
| 4519 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item")); |
| 4520 | _res = invalid_with_item_var; |
| 4521 | goto done; |
| 4522 | } |
| 4523 | p->mark = _mark; |
| 4524 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
| 4525 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item")); |
| 4526 | } |
| 4527 | { // expression |
| 4528 | if (p->error_indicator) { |
| 4529 | D(p->level--); |
| 4530 | return NULL; |
| 4531 | } |
| 4532 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
| 4533 | expr_ty e; |
| 4534 | if ( |
| 4535 | (e = expression_rule(p)) // expression |
| 4536 | ) |
| 4537 | { |
| 4538 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
| 4539 | _res = _Py_withitem ( e , NULL , p -> arena ); |
| 4540 | if (_res == NULL && PyErr_Occurred()) { |
| 4541 | p->error_indicator = 1; |
| 4542 | D(p->level--); |
| 4543 | return NULL; |
| 4544 | } |
| 4545 | goto done; |
| 4546 | } |
| 4547 | p->mark = _mark; |
| 4548 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
| 4549 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4550 | } |
| 4551 | _res = NULL; |
| 4552 | done: |
| 4553 | D(p->level--); |
| 4554 | return _res; |
| 4555 | } |
| 4556 | |
| 4557 | // try_stmt: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4558 | // | 'try' &&':' block finally_block |
| 4559 | // | 'try' &&':' block except_block+ else_block? finally_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4560 | static stmt_ty |
| 4561 | try_stmt_rule(Parser *p) |
| 4562 | { |
| 4563 | D(p->level++); |
| 4564 | if (p->error_indicator) { |
| 4565 | D(p->level--); |
| 4566 | return NULL; |
| 4567 | } |
| 4568 | stmt_ty _res = NULL; |
| 4569 | int _mark = p->mark; |
| 4570 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4571 | p->error_indicator = 1; |
| 4572 | D(p->level--); |
| 4573 | return NULL; |
| 4574 | } |
| 4575 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4576 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4577 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4578 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4579 | { // 'try' &&':' block finally_block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4580 | if (p->error_indicator) { |
| 4581 | D(p->level--); |
| 4582 | return NULL; |
| 4583 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4584 | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4585 | Token * _keyword; |
| 4586 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4587 | asdl_stmt_seq* b; |
| 4588 | asdl_stmt_seq* f; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4589 | if ( |
| 4590 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
| 4591 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4592 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4593 | && |
| 4594 | (b = block_rule(p)) // block |
| 4595 | && |
| 4596 | (f = finally_block_rule(p)) // finally_block |
| 4597 | ) |
| 4598 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4599 | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4600 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4601 | if (_token == NULL) { |
| 4602 | D(p->level--); |
| 4603 | return NULL; |
| 4604 | } |
| 4605 | int _end_lineno = _token->end_lineno; |
| 4606 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4607 | int _end_col_offset = _token->end_col_offset; |
| 4608 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4609 | _res = _Py_Try ( b , NULL , NULL , f , EXTRA ); |
| 4610 | if (_res == NULL && PyErr_Occurred()) { |
| 4611 | p->error_indicator = 1; |
| 4612 | D(p->level--); |
| 4613 | return NULL; |
| 4614 | } |
| 4615 | goto done; |
| 4616 | } |
| 4617 | p->mark = _mark; |
| 4618 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4619 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block finally_block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4620 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4621 | { // 'try' &&':' block except_block+ else_block? finally_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4622 | if (p->error_indicator) { |
| 4623 | D(p->level--); |
| 4624 | return NULL; |
| 4625 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4626 | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4627 | Token * _keyword; |
| 4628 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4629 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4630 | void *el; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4631 | asdl_excepthandler_seq* ex; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4632 | void *f; |
| 4633 | if ( |
| 4634 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
| 4635 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4636 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4637 | && |
| 4638 | (b = block_rule(p)) // block |
| 4639 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4640 | (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p)) // except_block+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4641 | && |
| 4642 | (el = else_block_rule(p), 1) // else_block? |
| 4643 | && |
| 4644 | (f = finally_block_rule(p), 1) // finally_block? |
| 4645 | ) |
| 4646 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4647 | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4648 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4649 | if (_token == NULL) { |
| 4650 | D(p->level--); |
| 4651 | return NULL; |
| 4652 | } |
| 4653 | int _end_lineno = _token->end_lineno; |
| 4654 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4655 | int _end_col_offset = _token->end_col_offset; |
| 4656 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4657 | _res = _Py_Try ( b , ex , el , f , EXTRA ); |
| 4658 | if (_res == NULL && PyErr_Occurred()) { |
| 4659 | p->error_indicator = 1; |
| 4660 | D(p->level--); |
| 4661 | return NULL; |
| 4662 | } |
| 4663 | goto done; |
| 4664 | } |
| 4665 | p->mark = _mark; |
| 4666 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4667 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4668 | } |
| 4669 | _res = NULL; |
| 4670 | done: |
| 4671 | D(p->level--); |
| 4672 | return _res; |
| 4673 | } |
| 4674 | |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4675 | // except_block: |
| 4676 | // | 'except' expression ['as' NAME] ':' block |
| 4677 | // | 'except' ':' block |
| 4678 | // | invalid_except_block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4679 | static excepthandler_ty |
| 4680 | except_block_rule(Parser *p) |
| 4681 | { |
| 4682 | D(p->level++); |
| 4683 | if (p->error_indicator) { |
| 4684 | D(p->level--); |
| 4685 | return NULL; |
| 4686 | } |
| 4687 | excepthandler_ty _res = NULL; |
| 4688 | int _mark = p->mark; |
| 4689 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4690 | p->error_indicator = 1; |
| 4691 | D(p->level--); |
| 4692 | return NULL; |
| 4693 | } |
| 4694 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4695 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4696 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4697 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4698 | { // 'except' expression ['as' NAME] ':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4699 | if (p->error_indicator) { |
| 4700 | D(p->level--); |
| 4701 | return NULL; |
| 4702 | } |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4703 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4704 | Token * _keyword; |
| 4705 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4706 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4707 | expr_ty e; |
| 4708 | void *t; |
| 4709 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4710 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4711 | && |
| 4712 | (e = expression_rule(p)) // expression |
| 4713 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4714 | (t = _tmp_49_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4715 | && |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4716 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4717 | && |
| 4718 | (b = block_rule(p)) // block |
| 4719 | ) |
| 4720 | { |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4721 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4722 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4723 | if (_token == NULL) { |
| 4724 | D(p->level--); |
| 4725 | return NULL; |
| 4726 | } |
| 4727 | int _end_lineno = _token->end_lineno; |
| 4728 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4729 | int _end_col_offset = _token->end_col_offset; |
| 4730 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4731 | _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA ); |
| 4732 | if (_res == NULL && PyErr_Occurred()) { |
| 4733 | p->error_indicator = 1; |
| 4734 | D(p->level--); |
| 4735 | return NULL; |
| 4736 | } |
| 4737 | goto done; |
| 4738 | } |
| 4739 | p->mark = _mark; |
| 4740 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4741 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4742 | } |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4743 | { // 'except' ':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4744 | if (p->error_indicator) { |
| 4745 | D(p->level--); |
| 4746 | return NULL; |
| 4747 | } |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4748 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4749 | Token * _keyword; |
| 4750 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4751 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4752 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4753 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4754 | && |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4755 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4756 | && |
| 4757 | (b = block_rule(p)) // block |
| 4758 | ) |
| 4759 | { |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4760 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4761 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4762 | if (_token == NULL) { |
| 4763 | D(p->level--); |
| 4764 | return NULL; |
| 4765 | } |
| 4766 | int _end_lineno = _token->end_lineno; |
| 4767 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4768 | int _end_col_offset = _token->end_col_offset; |
| 4769 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4770 | _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA ); |
| 4771 | if (_res == NULL && PyErr_Occurred()) { |
| 4772 | p->error_indicator = 1; |
| 4773 | D(p->level--); |
| 4774 | return NULL; |
| 4775 | } |
| 4776 | goto done; |
| 4777 | } |
| 4778 | p->mark = _mark; |
| 4779 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4780 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block")); |
| 4781 | } |
| 4782 | if (p->call_invalid_rules) { // invalid_except_block |
| 4783 | if (p->error_indicator) { |
| 4784 | D(p->level--); |
| 4785 | return NULL; |
| 4786 | } |
| 4787 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_block")); |
| 4788 | void *invalid_except_block_var; |
| 4789 | if ( |
| 4790 | (invalid_except_block_var = invalid_except_block_rule(p)) // invalid_except_block |
| 4791 | ) |
| 4792 | { |
| 4793 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_block")); |
| 4794 | _res = invalid_except_block_var; |
| 4795 | goto done; |
| 4796 | } |
| 4797 | p->mark = _mark; |
| 4798 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4799 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4800 | } |
| 4801 | _res = NULL; |
| 4802 | done: |
| 4803 | D(p->level--); |
| 4804 | return _res; |
| 4805 | } |
| 4806 | |
| 4807 | // finally_block: 'finally' ':' block |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4808 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4809 | finally_block_rule(Parser *p) |
| 4810 | { |
| 4811 | D(p->level++); |
| 4812 | if (p->error_indicator) { |
| 4813 | D(p->level--); |
| 4814 | return NULL; |
| 4815 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4816 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4817 | int _mark = p->mark; |
| 4818 | { // 'finally' ':' block |
| 4819 | if (p->error_indicator) { |
| 4820 | D(p->level--); |
| 4821 | return NULL; |
| 4822 | } |
| 4823 | D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block")); |
| 4824 | Token * _keyword; |
| 4825 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4826 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4827 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4828 | (_keyword = _PyPegen_expect_token(p, 522)) // token='finally' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4829 | && |
| 4830 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 4831 | && |
| 4832 | (a = block_rule(p)) // block |
| 4833 | ) |
| 4834 | { |
| 4835 | D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block")); |
| 4836 | _res = a; |
| 4837 | if (_res == NULL && PyErr_Occurred()) { |
| 4838 | p->error_indicator = 1; |
| 4839 | D(p->level--); |
| 4840 | return NULL; |
| 4841 | } |
| 4842 | goto done; |
| 4843 | } |
| 4844 | p->mark = _mark; |
| 4845 | D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4846 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block")); |
| 4847 | } |
| 4848 | _res = NULL; |
| 4849 | done: |
| 4850 | D(p->level--); |
| 4851 | return _res; |
| 4852 | } |
| 4853 | |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 4854 | // match_stmt: |
| 4855 | // | "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT |
| 4856 | // | invalid_match_stmt |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 4857 | static stmt_ty |
| 4858 | match_stmt_rule(Parser *p) |
| 4859 | { |
| 4860 | D(p->level++); |
| 4861 | if (p->error_indicator) { |
| 4862 | D(p->level--); |
| 4863 | return NULL; |
| 4864 | } |
| 4865 | stmt_ty _res = NULL; |
| 4866 | int _mark = p->mark; |
| 4867 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4868 | p->error_indicator = 1; |
| 4869 | D(p->level--); |
| 4870 | return NULL; |
| 4871 | } |
| 4872 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4873 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4874 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4875 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 4876 | { // "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT |
| 4877 | if (p->error_indicator) { |
| 4878 | D(p->level--); |
| 4879 | return NULL; |
| 4880 | } |
| 4881 | D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
| 4882 | expr_ty _keyword; |
| 4883 | Token * _literal; |
| 4884 | asdl_match_case_seq* cases; |
| 4885 | Token * dedent_var; |
| 4886 | Token * indent_var; |
| 4887 | Token * newline_var; |
| 4888 | expr_ty subject; |
| 4889 | if ( |
| 4890 | (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' |
| 4891 | && |
| 4892 | (subject = subject_expr_rule(p)) // subject_expr |
| 4893 | && |
| 4894 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 4895 | && |
| 4896 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 4897 | && |
| 4898 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
| 4899 | && |
| 4900 | (cases = (asdl_match_case_seq*)_loop1_50_rule(p)) // case_block+ |
| 4901 | && |
| 4902 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
| 4903 | ) |
| 4904 | { |
| 4905 | D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
| 4906 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4907 | if (_token == NULL) { |
| 4908 | D(p->level--); |
| 4909 | return NULL; |
| 4910 | } |
| 4911 | int _end_lineno = _token->end_lineno; |
| 4912 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4913 | int _end_col_offset = _token->end_col_offset; |
| 4914 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4915 | _res = CHECK_VERSION ( stmt_ty , 10 , "Pattern matching is" , _Py_Match ( subject , cases , EXTRA ) ); |
| 4916 | if (_res == NULL && PyErr_Occurred()) { |
| 4917 | p->error_indicator = 1; |
| 4918 | D(p->level--); |
| 4919 | return NULL; |
| 4920 | } |
| 4921 | goto done; |
| 4922 | } |
| 4923 | p->mark = _mark; |
| 4924 | D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4925 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
| 4926 | } |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 4927 | if (p->call_invalid_rules) { // invalid_match_stmt |
| 4928 | if (p->error_indicator) { |
| 4929 | D(p->level--); |
| 4930 | return NULL; |
| 4931 | } |
| 4932 | D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt")); |
| 4933 | void *invalid_match_stmt_var; |
| 4934 | if ( |
| 4935 | (invalid_match_stmt_var = invalid_match_stmt_rule(p)) // invalid_match_stmt |
| 4936 | ) |
| 4937 | { |
| 4938 | D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt")); |
| 4939 | _res = invalid_match_stmt_var; |
| 4940 | goto done; |
| 4941 | } |
| 4942 | p->mark = _mark; |
| 4943 | D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4944 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_match_stmt")); |
| 4945 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 4946 | _res = NULL; |
| 4947 | done: |
| 4948 | D(p->level--); |
| 4949 | return _res; |
| 4950 | } |
| 4951 | |
| 4952 | // subject_expr: star_named_expression ',' star_named_expressions? | named_expression |
| 4953 | static expr_ty |
| 4954 | subject_expr_rule(Parser *p) |
| 4955 | { |
| 4956 | D(p->level++); |
| 4957 | if (p->error_indicator) { |
| 4958 | D(p->level--); |
| 4959 | return NULL; |
| 4960 | } |
| 4961 | expr_ty _res = NULL; |
| 4962 | int _mark = p->mark; |
| 4963 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4964 | p->error_indicator = 1; |
| 4965 | D(p->level--); |
| 4966 | return NULL; |
| 4967 | } |
| 4968 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4969 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4970 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4971 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 4972 | { // star_named_expression ',' star_named_expressions? |
| 4973 | if (p->error_indicator) { |
| 4974 | D(p->level--); |
| 4975 | return NULL; |
| 4976 | } |
| 4977 | D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
| 4978 | Token * _literal; |
| 4979 | expr_ty value; |
| 4980 | void *values; |
| 4981 | if ( |
| 4982 | (value = star_named_expression_rule(p)) // star_named_expression |
| 4983 | && |
| 4984 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 4985 | && |
| 4986 | (values = star_named_expressions_rule(p), 1) // star_named_expressions? |
| 4987 | ) |
| 4988 | { |
| 4989 | D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
| 4990 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4991 | if (_token == NULL) { |
| 4992 | D(p->level--); |
| 4993 | return NULL; |
| 4994 | } |
| 4995 | int _end_lineno = _token->end_lineno; |
| 4996 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4997 | int _end_col_offset = _token->end_col_offset; |
| 4998 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4999 | _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); |
| 5000 | if (_res == NULL && PyErr_Occurred()) { |
| 5001 | p->error_indicator = 1; |
| 5002 | D(p->level--); |
| 5003 | return NULL; |
| 5004 | } |
| 5005 | goto done; |
| 5006 | } |
| 5007 | p->mark = _mark; |
| 5008 | D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 5009 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
| 5010 | } |
| 5011 | { // named_expression |
| 5012 | if (p->error_indicator) { |
| 5013 | D(p->level--); |
| 5014 | return NULL; |
| 5015 | } |
| 5016 | D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
| 5017 | expr_ty named_expression_var; |
| 5018 | if ( |
| 5019 | (named_expression_var = named_expression_rule(p)) // named_expression |
| 5020 | ) |
| 5021 | { |
| 5022 | D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
| 5023 | _res = named_expression_var; |
| 5024 | goto done; |
| 5025 | } |
| 5026 | p->mark = _mark; |
| 5027 | D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 5028 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
| 5029 | } |
| 5030 | _res = NULL; |
| 5031 | done: |
| 5032 | D(p->level--); |
| 5033 | return _res; |
| 5034 | } |
| 5035 | |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 5036 | // case_block: "case" patterns guard? ':' block | invalid_case_block |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 5037 | static match_case_ty |
| 5038 | case_block_rule(Parser *p) |
| 5039 | { |
| 5040 | D(p->level++); |
| 5041 | if (p->error_indicator) { |
| 5042 | D(p->level--); |
| 5043 | return NULL; |
| 5044 | } |
| 5045 | match_case_ty _res = NULL; |
| 5046 | int _mark = p->mark; |
| 5047 | { // "case" patterns guard? ':' block |
| 5048 | if (p->error_indicator) { |
| 5049 | D(p->level--); |
| 5050 | return NULL; |
| 5051 | } |
| 5052 | D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); |
| 5053 | expr_ty _keyword; |
| 5054 | Token * _literal; |
| 5055 | asdl_stmt_seq* body; |
| 5056 | void *guard; |
| 5057 | expr_ty pattern; |
| 5058 | if ( |
| 5059 | (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' |
| 5060 | && |
| 5061 | (pattern = patterns_rule(p)) // patterns |
| 5062 | && |
| 5063 | (guard = guard_rule(p), 1) // guard? |
| 5064 | && |
| 5065 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 5066 | && |
| 5067 | (body = block_rule(p)) // block |
| 5068 | ) |
| 5069 | { |
| 5070 | D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); |
| 5071 | _res = _Py_match_case ( pattern , guard , body , p -> arena ); |
| 5072 | if (_res == NULL && PyErr_Occurred()) { |
| 5073 | p->error_indicator = 1; |
| 5074 | D(p->level--); |
| 5075 | return NULL; |
| 5076 | } |
| 5077 | goto done; |
| 5078 | } |
| 5079 | p->mark = _mark; |
| 5080 | D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 5081 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' block")); |
| 5082 | } |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 5083 | if (p->call_invalid_rules) { // invalid_case_block |
| 5084 | if (p->error_indicator) { |
| 5085 | D(p->level--); |
| 5086 | return NULL; |
| 5087 | } |
| 5088 | D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_case_block")); |
| 5089 | void *invalid_case_block_var; |
| 5090 | if ( |
| 5091 | (invalid_case_block_var = invalid_case_block_rule(p)) // invalid_case_block |
| 5092 | ) |
| 5093 | { |
| 5094 | D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_case_block")); |
| 5095 | _res = invalid_case_block_var; |
| 5096 | goto done; |
| 5097 | } |
| 5098 | p->mark = _mark; |
| 5099 | D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 5100 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_case_block")); |
| 5101 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 5102 | _res = NULL; |
| 5103 | done: |
| 5104 | D(p->level--); |
| 5105 | return _res; |
| 5106 | } |
| 5107 | |
| 5108 | // guard: 'if' named_expression |
| 5109 | static expr_ty |
| 5110 | guard_rule(Parser *p) |
| 5111 | { |
| 5112 | D(p->level++); |
| 5113 | if (p->error_indicator) { |
| 5114 | D(p->level--); |
| 5115 | return NULL; |
| 5116 | } |
| 5117 | expr_ty _res = NULL; |
| 5118 | int _mark = p->mark; |
| 5119 | { // 'if' named_expression |
| 5120 | if (p->error_indicator) { |
| 5121 | D(p->level--); |
| 5122 | return NULL; |
| 5123 | } |
| 5124 | D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); |
| 5125 | Token * _keyword; |
| 5126 | expr_ty guard; |
| 5127 | if ( |
| 5128 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 5129 | && |
| 5130 | (guard = named_expression_rule(p)) // named_expression |
| 5131 | ) |
| 5132 | { |
| 5133 | D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); |
| 5134 | _res = guard; |
| 5135 | if (_res == NULL && PyErr_Occurred()) { |
| 5136 | p->error_indicator = 1; |
| 5137 | D(p->level--); |
| 5138 | return NULL; |
| 5139 | } |
| 5140 | goto done; |
| 5141 | } |
| 5142 | p->mark = _mark; |
| 5143 | D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ', |
| 5144 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression")); |
| 5145 | } |
| 5146 | _res = NULL; |
| 5147 | done: |
| 5148 | D(p->level--); |
| 5149 | return _res; |
| 5150 | } |
| 5151 | |
| 5152 | // patterns: open_sequence_pattern | pattern |
| 5153 | static expr_ty |
| 5154 | patterns_rule(Parser *p) |
| 5155 | { |
| 5156 | D(p->level++); |
| 5157 | if (p->error_indicator) { |
| 5158 | D(p->level--); |
| 5159 | return NULL; |
| 5160 | } |
| 5161 | expr_ty _res = NULL; |
| 5162 | int _mark = p->mark; |
| 5163 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5164 | p->error_indicator = 1; |
| 5165 | D(p->level--); |
| 5166 | return NULL; |
| 5167 | } |
| 5168 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5169 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5170 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5171 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5172 | { // open_sequence_pattern |
| 5173 | if (p->error_indicator) { |
| 5174 | D(p->level--); |
| 5175 | return NULL; |
| 5176 | } |
| 5177 | D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); |
| 5178 | asdl_expr_seq* values; |
| 5179 | if ( |
| 5180 | (values = (asdl_expr_seq*)open_sequence_pattern_rule(p)) // open_sequence_pattern |
| 5181 | ) |
| 5182 | { |
| 5183 | D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); |
| 5184 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5185 | if (_token == NULL) { |
| 5186 | D(p->level--); |
| 5187 | return NULL; |
| 5188 | } |
| 5189 | int _end_lineno = _token->end_lineno; |
| 5190 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5191 | int _end_col_offset = _token->end_col_offset; |
| 5192 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5193 | _res = _Py_Tuple ( values , Load , EXTRA ); |
| 5194 | if (_res == NULL && PyErr_Occurred()) { |
| 5195 | p->error_indicator = 1; |
| 5196 | D(p->level--); |
| 5197 | return NULL; |
| 5198 | } |
| 5199 | goto done; |
| 5200 | } |
| 5201 | p->mark = _mark; |
| 5202 | D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', |
| 5203 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "open_sequence_pattern")); |
| 5204 | } |
| 5205 | { // pattern |
| 5206 | if (p->error_indicator) { |
| 5207 | D(p->level--); |
| 5208 | return NULL; |
| 5209 | } |
| 5210 | D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); |
| 5211 | expr_ty pattern_var; |
| 5212 | if ( |
| 5213 | (pattern_var = pattern_rule(p)) // pattern |
| 5214 | ) |
| 5215 | { |
| 5216 | D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); |
| 5217 | _res = pattern_var; |
| 5218 | goto done; |
| 5219 | } |
| 5220 | p->mark = _mark; |
| 5221 | D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', |
| 5222 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); |
| 5223 | } |
| 5224 | _res = NULL; |
| 5225 | done: |
| 5226 | D(p->level--); |
| 5227 | return _res; |
| 5228 | } |
| 5229 | |
| 5230 | // pattern: as_pattern | or_pattern |
| 5231 | static expr_ty |
| 5232 | pattern_rule(Parser *p) |
| 5233 | { |
| 5234 | D(p->level++); |
| 5235 | if (p->error_indicator) { |
| 5236 | D(p->level--); |
| 5237 | return NULL; |
| 5238 | } |
| 5239 | expr_ty _res = NULL; |
| 5240 | int _mark = p->mark; |
| 5241 | { // as_pattern |
| 5242 | if (p->error_indicator) { |
| 5243 | D(p->level--); |
| 5244 | return NULL; |
| 5245 | } |
| 5246 | D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "as_pattern")); |
| 5247 | expr_ty as_pattern_var; |
| 5248 | if ( |
| 5249 | (as_pattern_var = as_pattern_rule(p)) // as_pattern |
| 5250 | ) |
| 5251 | { |
| 5252 | D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "as_pattern")); |
| 5253 | _res = as_pattern_var; |
| 5254 | goto done; |
| 5255 | } |
| 5256 | p->mark = _mark; |
| 5257 | D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5258 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "as_pattern")); |
| 5259 | } |
| 5260 | { // or_pattern |
| 5261 | if (p->error_indicator) { |
| 5262 | D(p->level--); |
| 5263 | return NULL; |
| 5264 | } |
| 5265 | D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern")); |
| 5266 | expr_ty or_pattern_var; |
| 5267 | if ( |
| 5268 | (or_pattern_var = or_pattern_rule(p)) // or_pattern |
| 5269 | ) |
| 5270 | { |
| 5271 | D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern")); |
| 5272 | _res = or_pattern_var; |
| 5273 | goto done; |
| 5274 | } |
| 5275 | p->mark = _mark; |
| 5276 | D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5277 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern")); |
| 5278 | } |
| 5279 | _res = NULL; |
| 5280 | done: |
| 5281 | D(p->level--); |
| 5282 | return _res; |
| 5283 | } |
| 5284 | |
| 5285 | // as_pattern: or_pattern 'as' capture_pattern |
| 5286 | static expr_ty |
| 5287 | as_pattern_rule(Parser *p) |
| 5288 | { |
| 5289 | D(p->level++); |
| 5290 | if (p->error_indicator) { |
| 5291 | D(p->level--); |
| 5292 | return NULL; |
| 5293 | } |
| 5294 | expr_ty _res = NULL; |
| 5295 | int _mark = p->mark; |
| 5296 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5297 | p->error_indicator = 1; |
| 5298 | D(p->level--); |
| 5299 | return NULL; |
| 5300 | } |
| 5301 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5302 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5303 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5304 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5305 | { // or_pattern 'as' capture_pattern |
| 5306 | if (p->error_indicator) { |
| 5307 | D(p->level--); |
| 5308 | return NULL; |
| 5309 | } |
| 5310 | D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' capture_pattern")); |
| 5311 | Token * _keyword; |
| 5312 | expr_ty pattern; |
| 5313 | expr_ty target; |
| 5314 | if ( |
| 5315 | (pattern = or_pattern_rule(p)) // or_pattern |
| 5316 | && |
| 5317 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 5318 | && |
| 5319 | (target = capture_pattern_rule(p)) // capture_pattern |
| 5320 | ) |
| 5321 | { |
| 5322 | D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' capture_pattern")); |
| 5323 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5324 | if (_token == NULL) { |
| 5325 | D(p->level--); |
| 5326 | return NULL; |
| 5327 | } |
| 5328 | int _end_lineno = _token->end_lineno; |
| 5329 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5330 | int _end_col_offset = _token->end_col_offset; |
| 5331 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5332 | _res = _Py_MatchAs ( pattern , target -> v . Name . id , EXTRA ); |
| 5333 | if (_res == NULL && PyErr_Occurred()) { |
| 5334 | p->error_indicator = 1; |
| 5335 | D(p->level--); |
| 5336 | return NULL; |
| 5337 | } |
| 5338 | goto done; |
| 5339 | } |
| 5340 | p->mark = _mark; |
| 5341 | D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5342 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' capture_pattern")); |
| 5343 | } |
| 5344 | _res = NULL; |
| 5345 | done: |
| 5346 | D(p->level--); |
| 5347 | return _res; |
| 5348 | } |
| 5349 | |
| 5350 | // or_pattern: '|'.closed_pattern+ |
| 5351 | static expr_ty |
| 5352 | or_pattern_rule(Parser *p) |
| 5353 | { |
| 5354 | D(p->level++); |
| 5355 | if (p->error_indicator) { |
| 5356 | D(p->level--); |
| 5357 | return NULL; |
| 5358 | } |
| 5359 | expr_ty _res = NULL; |
| 5360 | int _mark = p->mark; |
| 5361 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5362 | p->error_indicator = 1; |
| 5363 | D(p->level--); |
| 5364 | return NULL; |
| 5365 | } |
| 5366 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5367 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5368 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5369 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5370 | { // '|'.closed_pattern+ |
| 5371 | if (p->error_indicator) { |
| 5372 | D(p->level--); |
| 5373 | return NULL; |
| 5374 | } |
| 5375 | D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); |
| 5376 | asdl_expr_seq* patterns; |
| 5377 | if ( |
| 5378 | (patterns = (asdl_expr_seq*)_gather_51_rule(p)) // '|'.closed_pattern+ |
| 5379 | ) |
| 5380 | { |
| 5381 | D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); |
| 5382 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5383 | if (_token == NULL) { |
| 5384 | D(p->level--); |
| 5385 | return NULL; |
| 5386 | } |
| 5387 | int _end_lineno = _token->end_lineno; |
| 5388 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5389 | int _end_col_offset = _token->end_col_offset; |
| 5390 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5391 | _res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _Py_MatchOr ( patterns , EXTRA ); |
| 5392 | if (_res == NULL && PyErr_Occurred()) { |
| 5393 | p->error_indicator = 1; |
| 5394 | D(p->level--); |
| 5395 | return NULL; |
| 5396 | } |
| 5397 | goto done; |
| 5398 | } |
| 5399 | p->mark = _mark; |
| 5400 | D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5401 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+")); |
| 5402 | } |
| 5403 | _res = NULL; |
| 5404 | done: |
| 5405 | D(p->level--); |
| 5406 | return _res; |
| 5407 | } |
| 5408 | |
| 5409 | // closed_pattern: |
| 5410 | // | literal_pattern |
| 5411 | // | capture_pattern |
| 5412 | // | wildcard_pattern |
| 5413 | // | value_pattern |
| 5414 | // | group_pattern |
| 5415 | // | sequence_pattern |
| 5416 | // | mapping_pattern |
| 5417 | // | class_pattern |
| 5418 | static expr_ty |
| 5419 | closed_pattern_rule(Parser *p) |
| 5420 | { |
| 5421 | D(p->level++); |
| 5422 | if (p->error_indicator) { |
| 5423 | D(p->level--); |
| 5424 | return NULL; |
| 5425 | } |
| 5426 | expr_ty _res = NULL; |
| 5427 | int _mark = p->mark; |
| 5428 | { // literal_pattern |
| 5429 | if (p->error_indicator) { |
| 5430 | D(p->level--); |
| 5431 | return NULL; |
| 5432 | } |
| 5433 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
| 5434 | expr_ty literal_pattern_var; |
| 5435 | if ( |
| 5436 | (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern |
| 5437 | ) |
| 5438 | { |
| 5439 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
| 5440 | _res = literal_pattern_var; |
| 5441 | goto done; |
| 5442 | } |
| 5443 | p->mark = _mark; |
| 5444 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5445 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); |
| 5446 | } |
| 5447 | { // capture_pattern |
| 5448 | if (p->error_indicator) { |
| 5449 | D(p->level--); |
| 5450 | return NULL; |
| 5451 | } |
| 5452 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
| 5453 | expr_ty capture_pattern_var; |
| 5454 | if ( |
| 5455 | (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern |
| 5456 | ) |
| 5457 | { |
| 5458 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
| 5459 | _res = capture_pattern_var; |
| 5460 | goto done; |
| 5461 | } |
| 5462 | p->mark = _mark; |
| 5463 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5464 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern")); |
| 5465 | } |
| 5466 | { // wildcard_pattern |
| 5467 | if (p->error_indicator) { |
| 5468 | D(p->level--); |
| 5469 | return NULL; |
| 5470 | } |
| 5471 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
| 5472 | expr_ty wildcard_pattern_var; |
| 5473 | if ( |
| 5474 | (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern |
| 5475 | ) |
| 5476 | { |
| 5477 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
| 5478 | _res = wildcard_pattern_var; |
| 5479 | goto done; |
| 5480 | } |
| 5481 | p->mark = _mark; |
| 5482 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5483 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern")); |
| 5484 | } |
| 5485 | { // value_pattern |
| 5486 | if (p->error_indicator) { |
| 5487 | D(p->level--); |
| 5488 | return NULL; |
| 5489 | } |
| 5490 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
| 5491 | expr_ty value_pattern_var; |
| 5492 | if ( |
| 5493 | (value_pattern_var = value_pattern_rule(p)) // value_pattern |
| 5494 | ) |
| 5495 | { |
| 5496 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
| 5497 | _res = value_pattern_var; |
| 5498 | goto done; |
| 5499 | } |
| 5500 | p->mark = _mark; |
| 5501 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5502 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern")); |
| 5503 | } |
| 5504 | { // group_pattern |
| 5505 | if (p->error_indicator) { |
| 5506 | D(p->level--); |
| 5507 | return NULL; |
| 5508 | } |
| 5509 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group_pattern")); |
| 5510 | expr_ty group_pattern_var; |
| 5511 | if ( |
| 5512 | (group_pattern_var = group_pattern_rule(p)) // group_pattern |
| 5513 | ) |
| 5514 | { |
| 5515 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group_pattern")); |
| 5516 | _res = group_pattern_var; |
| 5517 | goto done; |
| 5518 | } |
| 5519 | p->mark = _mark; |
| 5520 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5521 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group_pattern")); |
| 5522 | } |
| 5523 | { // sequence_pattern |
| 5524 | if (p->error_indicator) { |
| 5525 | D(p->level--); |
| 5526 | return NULL; |
| 5527 | } |
| 5528 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); |
| 5529 | expr_ty sequence_pattern_var; |
| 5530 | if ( |
| 5531 | (sequence_pattern_var = sequence_pattern_rule(p)) // sequence_pattern |
| 5532 | ) |
| 5533 | { |
| 5534 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); |
| 5535 | _res = sequence_pattern_var; |
| 5536 | goto done; |
| 5537 | } |
| 5538 | p->mark = _mark; |
| 5539 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5540 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sequence_pattern")); |
| 5541 | } |
| 5542 | { // mapping_pattern |
| 5543 | if (p->error_indicator) { |
| 5544 | D(p->level--); |
| 5545 | return NULL; |
| 5546 | } |
| 5547 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); |
| 5548 | expr_ty mapping_pattern_var; |
| 5549 | if ( |
| 5550 | (mapping_pattern_var = mapping_pattern_rule(p)) // mapping_pattern |
| 5551 | ) |
| 5552 | { |
| 5553 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); |
| 5554 | _res = mapping_pattern_var; |
| 5555 | goto done; |
| 5556 | } |
| 5557 | p->mark = _mark; |
| 5558 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5559 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "mapping_pattern")); |
| 5560 | } |
| 5561 | { // class_pattern |
| 5562 | if (p->error_indicator) { |
| 5563 | D(p->level--); |
| 5564 | return NULL; |
| 5565 | } |
| 5566 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_pattern")); |
| 5567 | expr_ty class_pattern_var; |
| 5568 | if ( |
| 5569 | (class_pattern_var = class_pattern_rule(p)) // class_pattern |
| 5570 | ) |
| 5571 | { |
| 5572 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_pattern")); |
| 5573 | _res = class_pattern_var; |
| 5574 | goto done; |
| 5575 | } |
| 5576 | p->mark = _mark; |
| 5577 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5578 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_pattern")); |
| 5579 | } |
| 5580 | _res = NULL; |
| 5581 | done: |
| 5582 | D(p->level--); |
| 5583 | return _res; |
| 5584 | } |
| 5585 | |
| 5586 | // literal_pattern: |
| 5587 | // | signed_number !('+' | '-') |
| 5588 | // | signed_number '+' NUMBER |
| 5589 | // | signed_number '-' NUMBER |
| 5590 | // | strings |
| 5591 | // | 'None' |
| 5592 | // | 'True' |
| 5593 | // | 'False' |
| 5594 | static expr_ty |
| 5595 | literal_pattern_rule(Parser *p) |
| 5596 | { |
| 5597 | D(p->level++); |
| 5598 | if (p->error_indicator) { |
| 5599 | D(p->level--); |
| 5600 | return NULL; |
| 5601 | } |
| 5602 | expr_ty _res = NULL; |
| 5603 | int _mark = p->mark; |
| 5604 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5605 | p->error_indicator = 1; |
| 5606 | D(p->level--); |
| 5607 | return NULL; |
| 5608 | } |
| 5609 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5610 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5611 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5612 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5613 | { // signed_number !('+' | '-') |
| 5614 | if (p->error_indicator) { |
| 5615 | D(p->level--); |
| 5616 | return NULL; |
| 5617 | } |
| 5618 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); |
| 5619 | expr_ty signed_number_var; |
| 5620 | if ( |
| 5621 | (signed_number_var = signed_number_rule(p)) // signed_number |
| 5622 | && |
| 5623 | _PyPegen_lookahead(0, _tmp_53_rule, p) |
| 5624 | ) |
| 5625 | { |
| 5626 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); |
| 5627 | _res = signed_number_var; |
| 5628 | goto done; |
| 5629 | } |
| 5630 | p->mark = _mark; |
| 5631 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5632 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')")); |
| 5633 | } |
| 5634 | { // signed_number '+' NUMBER |
| 5635 | if (p->error_indicator) { |
| 5636 | D(p->level--); |
| 5637 | return NULL; |
| 5638 | } |
| 5639 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number '+' NUMBER")); |
| 5640 | Token * _literal; |
| 5641 | expr_ty imag; |
| 5642 | expr_ty real; |
| 5643 | if ( |
| 5644 | (real = signed_number_rule(p)) // signed_number |
| 5645 | && |
| 5646 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
| 5647 | && |
| 5648 | (imag = _PyPegen_number_token(p)) // NUMBER |
| 5649 | ) |
| 5650 | { |
| 5651 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number '+' NUMBER")); |
| 5652 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5653 | if (_token == NULL) { |
| 5654 | D(p->level--); |
| 5655 | return NULL; |
| 5656 | } |
| 5657 | int _end_lineno = _token->end_lineno; |
| 5658 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5659 | int _end_col_offset = _token->end_col_offset; |
| 5660 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5661 | _res = _Py_BinOp ( real , Add , imag , EXTRA ); |
| 5662 | if (_res == NULL && PyErr_Occurred()) { |
| 5663 | p->error_indicator = 1; |
| 5664 | D(p->level--); |
| 5665 | return NULL; |
| 5666 | } |
| 5667 | goto done; |
| 5668 | } |
| 5669 | p->mark = _mark; |
| 5670 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5671 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number '+' NUMBER")); |
| 5672 | } |
| 5673 | { // signed_number '-' NUMBER |
| 5674 | if (p->error_indicator) { |
| 5675 | D(p->level--); |
| 5676 | return NULL; |
| 5677 | } |
| 5678 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number '-' NUMBER")); |
| 5679 | Token * _literal; |
| 5680 | expr_ty imag; |
| 5681 | expr_ty real; |
| 5682 | if ( |
| 5683 | (real = signed_number_rule(p)) // signed_number |
| 5684 | && |
| 5685 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 5686 | && |
| 5687 | (imag = _PyPegen_number_token(p)) // NUMBER |
| 5688 | ) |
| 5689 | { |
| 5690 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number '-' NUMBER")); |
| 5691 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5692 | if (_token == NULL) { |
| 5693 | D(p->level--); |
| 5694 | return NULL; |
| 5695 | } |
| 5696 | int _end_lineno = _token->end_lineno; |
| 5697 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5698 | int _end_col_offset = _token->end_col_offset; |
| 5699 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5700 | _res = _Py_BinOp ( real , Sub , imag , EXTRA ); |
| 5701 | if (_res == NULL && PyErr_Occurred()) { |
| 5702 | p->error_indicator = 1; |
| 5703 | D(p->level--); |
| 5704 | return NULL; |
| 5705 | } |
| 5706 | goto done; |
| 5707 | } |
| 5708 | p->mark = _mark; |
| 5709 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5710 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number '-' NUMBER")); |
| 5711 | } |
| 5712 | { // strings |
| 5713 | if (p->error_indicator) { |
| 5714 | D(p->level--); |
| 5715 | return NULL; |
| 5716 | } |
| 5717 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings")); |
| 5718 | expr_ty strings_var; |
| 5719 | if ( |
| 5720 | (strings_var = strings_rule(p)) // strings |
| 5721 | ) |
| 5722 | { |
| 5723 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings")); |
| 5724 | _res = strings_var; |
| 5725 | goto done; |
| 5726 | } |
| 5727 | p->mark = _mark; |
| 5728 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5729 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings")); |
| 5730 | } |
| 5731 | { // 'None' |
| 5732 | if (p->error_indicator) { |
| 5733 | D(p->level--); |
| 5734 | return NULL; |
| 5735 | } |
| 5736 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
| 5737 | Token * _keyword; |
| 5738 | if ( |
| 5739 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
| 5740 | ) |
| 5741 | { |
| 5742 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
| 5743 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5744 | if (_token == NULL) { |
| 5745 | D(p->level--); |
| 5746 | return NULL; |
| 5747 | } |
| 5748 | int _end_lineno = _token->end_lineno; |
| 5749 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5750 | int _end_col_offset = _token->end_col_offset; |
| 5751 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5752 | _res = _Py_Constant ( Py_None , NULL , EXTRA ); |
| 5753 | if (_res == NULL && PyErr_Occurred()) { |
| 5754 | p->error_indicator = 1; |
| 5755 | D(p->level--); |
| 5756 | return NULL; |
| 5757 | } |
| 5758 | goto done; |
| 5759 | } |
| 5760 | p->mark = _mark; |
| 5761 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5762 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
| 5763 | } |
| 5764 | { // 'True' |
| 5765 | if (p->error_indicator) { |
| 5766 | D(p->level--); |
| 5767 | return NULL; |
| 5768 | } |
| 5769 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
| 5770 | Token * _keyword; |
| 5771 | if ( |
| 5772 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
| 5773 | ) |
| 5774 | { |
| 5775 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
| 5776 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5777 | if (_token == NULL) { |
| 5778 | D(p->level--); |
| 5779 | return NULL; |
| 5780 | } |
| 5781 | int _end_lineno = _token->end_lineno; |
| 5782 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5783 | int _end_col_offset = _token->end_col_offset; |
| 5784 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5785 | _res = _Py_Constant ( Py_True , NULL , EXTRA ); |
| 5786 | if (_res == NULL && PyErr_Occurred()) { |
| 5787 | p->error_indicator = 1; |
| 5788 | D(p->level--); |
| 5789 | return NULL; |
| 5790 | } |
| 5791 | goto done; |
| 5792 | } |
| 5793 | p->mark = _mark; |
| 5794 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5795 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
| 5796 | } |
| 5797 | { // 'False' |
| 5798 | if (p->error_indicator) { |
| 5799 | D(p->level--); |
| 5800 | return NULL; |
| 5801 | } |
| 5802 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
| 5803 | Token * _keyword; |
| 5804 | if ( |
| 5805 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
| 5806 | ) |
| 5807 | { |
| 5808 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
| 5809 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5810 | if (_token == NULL) { |
| 5811 | D(p->level--); |
| 5812 | return NULL; |
| 5813 | } |
| 5814 | int _end_lineno = _token->end_lineno; |
| 5815 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5816 | int _end_col_offset = _token->end_col_offset; |
| 5817 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5818 | _res = _Py_Constant ( Py_False , NULL , EXTRA ); |
| 5819 | if (_res == NULL && PyErr_Occurred()) { |
| 5820 | p->error_indicator = 1; |
| 5821 | D(p->level--); |
| 5822 | return NULL; |
| 5823 | } |
| 5824 | goto done; |
| 5825 | } |
| 5826 | p->mark = _mark; |
| 5827 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5828 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
| 5829 | } |
| 5830 | _res = NULL; |
| 5831 | done: |
| 5832 | D(p->level--); |
| 5833 | return _res; |
| 5834 | } |
| 5835 | |
| 5836 | // signed_number: NUMBER | '-' NUMBER |
| 5837 | static expr_ty |
| 5838 | signed_number_rule(Parser *p) |
| 5839 | { |
| 5840 | D(p->level++); |
| 5841 | if (p->error_indicator) { |
| 5842 | D(p->level--); |
| 5843 | return NULL; |
| 5844 | } |
| 5845 | expr_ty _res = NULL; |
| 5846 | int _mark = p->mark; |
| 5847 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5848 | p->error_indicator = 1; |
| 5849 | D(p->level--); |
| 5850 | return NULL; |
| 5851 | } |
| 5852 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5853 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5854 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5855 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5856 | { // NUMBER |
| 5857 | if (p->error_indicator) { |
| 5858 | D(p->level--); |
| 5859 | return NULL; |
| 5860 | } |
| 5861 | D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
| 5862 | expr_ty number_var; |
| 5863 | if ( |
| 5864 | (number_var = _PyPegen_number_token(p)) // NUMBER |
| 5865 | ) |
| 5866 | { |
| 5867 | D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
| 5868 | _res = number_var; |
| 5869 | goto done; |
| 5870 | } |
| 5871 | p->mark = _mark; |
| 5872 | D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', |
| 5873 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
| 5874 | } |
| 5875 | { // '-' NUMBER |
| 5876 | if (p->error_indicator) { |
| 5877 | D(p->level--); |
| 5878 | return NULL; |
| 5879 | } |
| 5880 | D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); |
| 5881 | Token * _literal; |
| 5882 | expr_ty number; |
| 5883 | if ( |
| 5884 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 5885 | && |
| 5886 | (number = _PyPegen_number_token(p)) // NUMBER |
| 5887 | ) |
| 5888 | { |
| 5889 | D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); |
| 5890 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5891 | if (_token == NULL) { |
| 5892 | D(p->level--); |
| 5893 | return NULL; |
| 5894 | } |
| 5895 | int _end_lineno = _token->end_lineno; |
| 5896 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5897 | int _end_col_offset = _token->end_col_offset; |
| 5898 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5899 | _res = _Py_UnaryOp ( USub , number , EXTRA ); |
| 5900 | if (_res == NULL && PyErr_Occurred()) { |
| 5901 | p->error_indicator = 1; |
| 5902 | D(p->level--); |
| 5903 | return NULL; |
| 5904 | } |
| 5905 | goto done; |
| 5906 | } |
| 5907 | p->mark = _mark; |
| 5908 | D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', |
| 5909 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER")); |
| 5910 | } |
| 5911 | _res = NULL; |
| 5912 | done: |
| 5913 | D(p->level--); |
| 5914 | return _res; |
| 5915 | } |
| 5916 | |
| 5917 | // capture_pattern: !"_" NAME !('.' | '(' | '=') |
| 5918 | static expr_ty |
| 5919 | capture_pattern_rule(Parser *p) |
| 5920 | { |
| 5921 | D(p->level++); |
| 5922 | if (p->error_indicator) { |
| 5923 | D(p->level--); |
| 5924 | return NULL; |
| 5925 | } |
| 5926 | expr_ty _res = NULL; |
| 5927 | int _mark = p->mark; |
| 5928 | { // !"_" NAME !('.' | '(' | '=') |
| 5929 | if (p->error_indicator) { |
| 5930 | D(p->level--); |
| 5931 | return NULL; |
| 5932 | } |
| 5933 | D(fprintf(stderr, "%*c> capture_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
| 5934 | expr_ty name; |
| 5935 | if ( |
| 5936 | _PyPegen_lookahead_with_string(0, _PyPegen_expect_soft_keyword, p, "_") |
| 5937 | && |
| 5938 | (name = _PyPegen_name_token(p)) // NAME |
| 5939 | && |
| 5940 | _PyPegen_lookahead(0, _tmp_54_rule, p) |
| 5941 | ) |
| 5942 | { |
| 5943 | D(fprintf(stderr, "%*c+ capture_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
| 5944 | _res = _PyPegen_set_expr_context ( p , name , Store ); |
| 5945 | if (_res == NULL && PyErr_Occurred()) { |
| 5946 | p->error_indicator = 1; |
| 5947 | D(p->level--); |
| 5948 | return NULL; |
| 5949 | } |
| 5950 | goto done; |
| 5951 | } |
| 5952 | p->mark = _mark; |
| 5953 | D(fprintf(stderr, "%*c%s capture_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5954 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
| 5955 | } |
| 5956 | _res = NULL; |
| 5957 | done: |
| 5958 | D(p->level--); |
| 5959 | return _res; |
| 5960 | } |
| 5961 | |
| 5962 | // wildcard_pattern: "_" |
| 5963 | static expr_ty |
| 5964 | wildcard_pattern_rule(Parser *p) |
| 5965 | { |
| 5966 | D(p->level++); |
| 5967 | if (p->error_indicator) { |
| 5968 | D(p->level--); |
| 5969 | return NULL; |
| 5970 | } |
| 5971 | expr_ty _res = NULL; |
| 5972 | int _mark = p->mark; |
| 5973 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5974 | p->error_indicator = 1; |
| 5975 | D(p->level--); |
| 5976 | return NULL; |
| 5977 | } |
| 5978 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5979 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5980 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5981 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5982 | { // "_" |
| 5983 | if (p->error_indicator) { |
| 5984 | D(p->level--); |
| 5985 | return NULL; |
| 5986 | } |
| 5987 | D(fprintf(stderr, "%*c> wildcard_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"_\"")); |
| 5988 | expr_ty _keyword; |
| 5989 | if ( |
| 5990 | (_keyword = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"' |
| 5991 | ) |
| 5992 | { |
| 5993 | D(fprintf(stderr, "%*c+ wildcard_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"_\"")); |
| 5994 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5995 | if (_token == NULL) { |
| 5996 | D(p->level--); |
| 5997 | return NULL; |
| 5998 | } |
| 5999 | int _end_lineno = _token->end_lineno; |
| 6000 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6001 | int _end_col_offset = _token->end_col_offset; |
| 6002 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6003 | _res = _Py_Name ( CHECK ( PyObject * , _PyPegen_new_identifier ( p , "_" ) ) , Store , EXTRA ); |
| 6004 | if (_res == NULL && PyErr_Occurred()) { |
| 6005 | p->error_indicator = 1; |
| 6006 | D(p->level--); |
| 6007 | return NULL; |
| 6008 | } |
| 6009 | goto done; |
| 6010 | } |
| 6011 | p->mark = _mark; |
| 6012 | D(fprintf(stderr, "%*c%s wildcard_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6013 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"_\"")); |
| 6014 | } |
| 6015 | _res = NULL; |
| 6016 | done: |
| 6017 | D(p->level--); |
| 6018 | return _res; |
| 6019 | } |
| 6020 | |
| 6021 | // value_pattern: attr !('.' | '(' | '=') |
| 6022 | static expr_ty |
| 6023 | value_pattern_rule(Parser *p) |
| 6024 | { |
| 6025 | D(p->level++); |
| 6026 | if (p->error_indicator) { |
| 6027 | D(p->level--); |
| 6028 | return NULL; |
| 6029 | } |
| 6030 | expr_ty _res = NULL; |
| 6031 | int _mark = p->mark; |
| 6032 | { // attr !('.' | '(' | '=') |
| 6033 | if (p->error_indicator) { |
| 6034 | D(p->level--); |
| 6035 | return NULL; |
| 6036 | } |
| 6037 | D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); |
| 6038 | expr_ty attr; |
| 6039 | if ( |
| 6040 | (attr = attr_rule(p)) // attr |
| 6041 | && |
| 6042 | _PyPegen_lookahead(0, _tmp_55_rule, p) |
| 6043 | ) |
| 6044 | { |
| 6045 | D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); |
| 6046 | _res = attr; |
| 6047 | if (_res == NULL && PyErr_Occurred()) { |
| 6048 | p->error_indicator = 1; |
| 6049 | D(p->level--); |
| 6050 | return NULL; |
| 6051 | } |
| 6052 | goto done; |
| 6053 | } |
| 6054 | p->mark = _mark; |
| 6055 | D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6056 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')")); |
| 6057 | } |
| 6058 | _res = NULL; |
| 6059 | done: |
| 6060 | D(p->level--); |
| 6061 | return _res; |
| 6062 | } |
| 6063 | |
| 6064 | // Left-recursive |
| 6065 | // attr: name_or_attr '.' NAME |
| 6066 | static expr_ty attr_raw(Parser *); |
| 6067 | static expr_ty |
| 6068 | attr_rule(Parser *p) |
| 6069 | { |
| 6070 | D(p->level++); |
| 6071 | expr_ty _res = NULL; |
| 6072 | if (_PyPegen_is_memoized(p, attr_type, &_res)) { |
| 6073 | D(p->level--); |
| 6074 | return _res; |
| 6075 | } |
| 6076 | int _mark = p->mark; |
| 6077 | int _resmark = p->mark; |
| 6078 | while (1) { |
| 6079 | int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res); |
| 6080 | if (tmpvar_1) { |
| 6081 | D(p->level--); |
| 6082 | return _res; |
| 6083 | } |
| 6084 | p->mark = _mark; |
| 6085 | void *_raw = attr_raw(p); |
| 6086 | if (p->error_indicator) |
| 6087 | return NULL; |
| 6088 | if (_raw == NULL || p->mark <= _resmark) |
| 6089 | break; |
| 6090 | _resmark = p->mark; |
| 6091 | _res = _raw; |
| 6092 | } |
| 6093 | p->mark = _resmark; |
| 6094 | D(p->level--); |
| 6095 | return _res; |
| 6096 | } |
| 6097 | static expr_ty |
| 6098 | attr_raw(Parser *p) |
| 6099 | { |
| 6100 | D(p->level++); |
| 6101 | if (p->error_indicator) { |
| 6102 | D(p->level--); |
| 6103 | return NULL; |
| 6104 | } |
| 6105 | expr_ty _res = NULL; |
| 6106 | int _mark = p->mark; |
| 6107 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6108 | p->error_indicator = 1; |
| 6109 | D(p->level--); |
| 6110 | return NULL; |
| 6111 | } |
| 6112 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6113 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6114 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6115 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6116 | { // name_or_attr '.' NAME |
| 6117 | if (p->error_indicator) { |
| 6118 | D(p->level--); |
| 6119 | return NULL; |
| 6120 | } |
| 6121 | D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); |
| 6122 | Token * _literal; |
| 6123 | expr_ty attr; |
| 6124 | expr_ty value; |
| 6125 | if ( |
| 6126 | (value = name_or_attr_rule(p)) // name_or_attr |
| 6127 | && |
| 6128 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 6129 | && |
| 6130 | (attr = _PyPegen_name_token(p)) // NAME |
| 6131 | ) |
| 6132 | { |
| 6133 | D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); |
| 6134 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6135 | if (_token == NULL) { |
| 6136 | D(p->level--); |
| 6137 | return NULL; |
| 6138 | } |
| 6139 | int _end_lineno = _token->end_lineno; |
| 6140 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6141 | int _end_col_offset = _token->end_col_offset; |
| 6142 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6143 | _res = _Py_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); |
| 6144 | if (_res == NULL && PyErr_Occurred()) { |
| 6145 | p->error_indicator = 1; |
| 6146 | D(p->level--); |
| 6147 | return NULL; |
| 6148 | } |
| 6149 | goto done; |
| 6150 | } |
| 6151 | p->mark = _mark; |
| 6152 | D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ', |
| 6153 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME")); |
| 6154 | } |
| 6155 | _res = NULL; |
| 6156 | done: |
| 6157 | D(p->level--); |
| 6158 | return _res; |
| 6159 | } |
| 6160 | |
| 6161 | // Left-recursive |
| 6162 | // name_or_attr: attr | NAME |
| 6163 | static expr_ty |
| 6164 | name_or_attr_rule(Parser *p) |
| 6165 | { |
| 6166 | D(p->level++); |
| 6167 | if (p->error_indicator) { |
| 6168 | D(p->level--); |
| 6169 | return NULL; |
| 6170 | } |
| 6171 | expr_ty _res = NULL; |
| 6172 | int _mark = p->mark; |
| 6173 | { // attr |
| 6174 | if (p->error_indicator) { |
| 6175 | D(p->level--); |
| 6176 | return NULL; |
| 6177 | } |
| 6178 | D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); |
| 6179 | expr_ty attr_var; |
| 6180 | if ( |
| 6181 | (attr_var = attr_rule(p)) // attr |
| 6182 | ) |
| 6183 | { |
| 6184 | D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr")); |
| 6185 | _res = attr_var; |
| 6186 | goto done; |
| 6187 | } |
| 6188 | p->mark = _mark; |
| 6189 | D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', |
| 6190 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr")); |
| 6191 | } |
| 6192 | { // NAME |
| 6193 | if (p->error_indicator) { |
| 6194 | D(p->level--); |
| 6195 | return NULL; |
| 6196 | } |
| 6197 | D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 6198 | expr_ty name_var; |
| 6199 | if ( |
| 6200 | (name_var = _PyPegen_name_token(p)) // NAME |
| 6201 | ) |
| 6202 | { |
| 6203 | D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 6204 | _res = name_var; |
| 6205 | goto done; |
| 6206 | } |
| 6207 | p->mark = _mark; |
| 6208 | D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', |
| 6209 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 6210 | } |
| 6211 | _res = NULL; |
| 6212 | done: |
| 6213 | D(p->level--); |
| 6214 | return _res; |
| 6215 | } |
| 6216 | |
| 6217 | // group_pattern: '(' pattern ')' |
| 6218 | static expr_ty |
| 6219 | group_pattern_rule(Parser *p) |
| 6220 | { |
| 6221 | D(p->level++); |
| 6222 | if (p->error_indicator) { |
| 6223 | D(p->level--); |
| 6224 | return NULL; |
| 6225 | } |
| 6226 | expr_ty _res = NULL; |
| 6227 | int _mark = p->mark; |
| 6228 | { // '(' pattern ')' |
| 6229 | if (p->error_indicator) { |
| 6230 | D(p->level--); |
| 6231 | return NULL; |
| 6232 | } |
| 6233 | D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); |
| 6234 | Token * _literal; |
| 6235 | Token * _literal_1; |
| 6236 | expr_ty pattern; |
| 6237 | if ( |
| 6238 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6239 | && |
| 6240 | (pattern = pattern_rule(p)) // pattern |
| 6241 | && |
| 6242 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6243 | ) |
| 6244 | { |
| 6245 | D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); |
| 6246 | _res = pattern; |
| 6247 | if (_res == NULL && PyErr_Occurred()) { |
| 6248 | p->error_indicator = 1; |
| 6249 | D(p->level--); |
| 6250 | return NULL; |
| 6251 | } |
| 6252 | goto done; |
| 6253 | } |
| 6254 | p->mark = _mark; |
| 6255 | D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6256 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'")); |
| 6257 | } |
| 6258 | _res = NULL; |
| 6259 | done: |
| 6260 | D(p->level--); |
| 6261 | return _res; |
| 6262 | } |
| 6263 | |
| 6264 | // sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')' |
| 6265 | static expr_ty |
| 6266 | sequence_pattern_rule(Parser *p) |
| 6267 | { |
| 6268 | D(p->level++); |
| 6269 | if (p->error_indicator) { |
| 6270 | D(p->level--); |
| 6271 | return NULL; |
| 6272 | } |
| 6273 | expr_ty _res = NULL; |
| 6274 | int _mark = p->mark; |
| 6275 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6276 | p->error_indicator = 1; |
| 6277 | D(p->level--); |
| 6278 | return NULL; |
| 6279 | } |
| 6280 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6281 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6282 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6283 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6284 | { // '[' maybe_sequence_pattern? ']' |
| 6285 | if (p->error_indicator) { |
| 6286 | D(p->level--); |
| 6287 | return NULL; |
| 6288 | } |
| 6289 | D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
| 6290 | Token * _literal; |
| 6291 | Token * _literal_1; |
| 6292 | void *values; |
| 6293 | if ( |
| 6294 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 6295 | && |
| 6296 | (values = maybe_sequence_pattern_rule(p), 1) // maybe_sequence_pattern? |
| 6297 | && |
| 6298 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 6299 | ) |
| 6300 | { |
| 6301 | D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
| 6302 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6303 | if (_token == NULL) { |
| 6304 | D(p->level--); |
| 6305 | return NULL; |
| 6306 | } |
| 6307 | int _end_lineno = _token->end_lineno; |
| 6308 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6309 | int _end_col_offset = _token->end_col_offset; |
| 6310 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6311 | _res = _Py_List ( values , Load , EXTRA ); |
| 6312 | if (_res == NULL && PyErr_Occurred()) { |
| 6313 | p->error_indicator = 1; |
| 6314 | D(p->level--); |
| 6315 | return NULL; |
| 6316 | } |
| 6317 | goto done; |
| 6318 | } |
| 6319 | p->mark = _mark; |
| 6320 | D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6321 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
| 6322 | } |
| 6323 | { // '(' open_sequence_pattern? ')' |
| 6324 | if (p->error_indicator) { |
| 6325 | D(p->level--); |
| 6326 | return NULL; |
| 6327 | } |
| 6328 | D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
| 6329 | Token * _literal; |
| 6330 | Token * _literal_1; |
| 6331 | void *values; |
| 6332 | if ( |
| 6333 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6334 | && |
| 6335 | (values = open_sequence_pattern_rule(p), 1) // open_sequence_pattern? |
| 6336 | && |
| 6337 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6338 | ) |
| 6339 | { |
| 6340 | D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
| 6341 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6342 | if (_token == NULL) { |
| 6343 | D(p->level--); |
| 6344 | return NULL; |
| 6345 | } |
| 6346 | int _end_lineno = _token->end_lineno; |
| 6347 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6348 | int _end_col_offset = _token->end_col_offset; |
| 6349 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6350 | _res = _Py_Tuple ( values , Load , EXTRA ); |
| 6351 | if (_res == NULL && PyErr_Occurred()) { |
| 6352 | p->error_indicator = 1; |
| 6353 | D(p->level--); |
| 6354 | return NULL; |
| 6355 | } |
| 6356 | goto done; |
| 6357 | } |
| 6358 | p->mark = _mark; |
| 6359 | D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6360 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
| 6361 | } |
| 6362 | _res = NULL; |
| 6363 | done: |
| 6364 | D(p->level--); |
| 6365 | return _res; |
| 6366 | } |
| 6367 | |
| 6368 | // open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern? |
| 6369 | static asdl_seq* |
| 6370 | open_sequence_pattern_rule(Parser *p) |
| 6371 | { |
| 6372 | D(p->level++); |
| 6373 | if (p->error_indicator) { |
| 6374 | D(p->level--); |
| 6375 | return NULL; |
| 6376 | } |
| 6377 | asdl_seq* _res = NULL; |
| 6378 | int _mark = p->mark; |
| 6379 | { // maybe_star_pattern ',' maybe_sequence_pattern? |
| 6380 | if (p->error_indicator) { |
| 6381 | D(p->level--); |
| 6382 | return NULL; |
| 6383 | } |
| 6384 | D(fprintf(stderr, "%*c> open_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
| 6385 | Token * _literal; |
| 6386 | expr_ty value; |
| 6387 | void *values; |
| 6388 | if ( |
| 6389 | (value = maybe_star_pattern_rule(p)) // maybe_star_pattern |
| 6390 | && |
| 6391 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 6392 | && |
| 6393 | (values = maybe_sequence_pattern_rule(p), 1) // maybe_sequence_pattern? |
| 6394 | ) |
| 6395 | { |
| 6396 | D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
| 6397 | _res = _PyPegen_seq_insert_in_front ( p , value , values ); |
| 6398 | if (_res == NULL && PyErr_Occurred()) { |
| 6399 | p->error_indicator = 1; |
| 6400 | D(p->level--); |
| 6401 | return NULL; |
| 6402 | } |
| 6403 | goto done; |
| 6404 | } |
| 6405 | p->mark = _mark; |
| 6406 | D(fprintf(stderr, "%*c%s open_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6407 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
| 6408 | } |
| 6409 | _res = NULL; |
| 6410 | done: |
| 6411 | D(p->level--); |
| 6412 | return _res; |
| 6413 | } |
| 6414 | |
| 6415 | // maybe_sequence_pattern: ','.maybe_star_pattern+ ','? |
| 6416 | static asdl_seq* |
| 6417 | maybe_sequence_pattern_rule(Parser *p) |
| 6418 | { |
| 6419 | D(p->level++); |
| 6420 | if (p->error_indicator) { |
| 6421 | D(p->level--); |
| 6422 | return NULL; |
| 6423 | } |
| 6424 | asdl_seq* _res = NULL; |
| 6425 | int _mark = p->mark; |
| 6426 | { // ','.maybe_star_pattern+ ','? |
| 6427 | if (p->error_indicator) { |
| 6428 | D(p->level--); |
| 6429 | return NULL; |
| 6430 | } |
| 6431 | D(fprintf(stderr, "%*c> maybe_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
| 6432 | void *_opt_var; |
| 6433 | UNUSED(_opt_var); // Silence compiler warnings |
| 6434 | asdl_seq * values; |
| 6435 | if ( |
| 6436 | (values = _gather_56_rule(p)) // ','.maybe_star_pattern+ |
| 6437 | && |
| 6438 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6439 | ) |
| 6440 | { |
| 6441 | D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
| 6442 | _res = values; |
| 6443 | if (_res == NULL && PyErr_Occurred()) { |
| 6444 | p->error_indicator = 1; |
| 6445 | D(p->level--); |
| 6446 | return NULL; |
| 6447 | } |
| 6448 | goto done; |
| 6449 | } |
| 6450 | p->mark = _mark; |
| 6451 | D(fprintf(stderr, "%*c%s maybe_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6452 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
| 6453 | } |
| 6454 | _res = NULL; |
| 6455 | done: |
| 6456 | D(p->level--); |
| 6457 | return _res; |
| 6458 | } |
| 6459 | |
| 6460 | // maybe_star_pattern: star_pattern | pattern |
| 6461 | static expr_ty |
| 6462 | maybe_star_pattern_rule(Parser *p) |
| 6463 | { |
| 6464 | D(p->level++); |
| 6465 | if (p->error_indicator) { |
| 6466 | D(p->level--); |
| 6467 | return NULL; |
| 6468 | } |
| 6469 | expr_ty _res = NULL; |
| 6470 | int _mark = p->mark; |
| 6471 | { // star_pattern |
| 6472 | if (p->error_indicator) { |
| 6473 | D(p->level--); |
| 6474 | return NULL; |
| 6475 | } |
| 6476 | D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_pattern")); |
| 6477 | expr_ty star_pattern_var; |
| 6478 | if ( |
| 6479 | (star_pattern_var = star_pattern_rule(p)) // star_pattern |
| 6480 | ) |
| 6481 | { |
| 6482 | D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_pattern")); |
| 6483 | _res = star_pattern_var; |
| 6484 | goto done; |
| 6485 | } |
| 6486 | p->mark = _mark; |
| 6487 | D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6488 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_pattern")); |
| 6489 | } |
| 6490 | { // pattern |
| 6491 | if (p->error_indicator) { |
| 6492 | D(p->level--); |
| 6493 | return NULL; |
| 6494 | } |
| 6495 | D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); |
| 6496 | expr_ty pattern_var; |
| 6497 | if ( |
| 6498 | (pattern_var = pattern_rule(p)) // pattern |
| 6499 | ) |
| 6500 | { |
| 6501 | D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); |
| 6502 | _res = pattern_var; |
| 6503 | goto done; |
| 6504 | } |
| 6505 | p->mark = _mark; |
| 6506 | D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6507 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); |
| 6508 | } |
| 6509 | _res = NULL; |
| 6510 | done: |
| 6511 | D(p->level--); |
| 6512 | return _res; |
| 6513 | } |
| 6514 | |
| 6515 | // star_pattern: '*' (capture_pattern | wildcard_pattern) |
| 6516 | static expr_ty |
| 6517 | star_pattern_rule(Parser *p) |
| 6518 | { |
| 6519 | D(p->level++); |
| 6520 | if (p->error_indicator) { |
| 6521 | D(p->level--); |
| 6522 | return NULL; |
| 6523 | } |
| 6524 | expr_ty _res = NULL; |
| 6525 | int _mark = p->mark; |
| 6526 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6527 | p->error_indicator = 1; |
| 6528 | D(p->level--); |
| 6529 | return NULL; |
| 6530 | } |
| 6531 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6532 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6533 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6534 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6535 | { // '*' (capture_pattern | wildcard_pattern) |
| 6536 | if (p->error_indicator) { |
| 6537 | D(p->level--); |
| 6538 | return NULL; |
| 6539 | } |
| 6540 | D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); |
| 6541 | Token * _literal; |
| 6542 | void *value; |
| 6543 | if ( |
| 6544 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 6545 | && |
| 6546 | (value = _tmp_58_rule(p)) // capture_pattern | wildcard_pattern |
| 6547 | ) |
| 6548 | { |
| 6549 | D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); |
| 6550 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6551 | if (_token == NULL) { |
| 6552 | D(p->level--); |
| 6553 | return NULL; |
| 6554 | } |
| 6555 | int _end_lineno = _token->end_lineno; |
| 6556 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6557 | int _end_col_offset = _token->end_col_offset; |
| 6558 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6559 | _res = _Py_Starred ( value , Store , EXTRA ); |
| 6560 | if (_res == NULL && PyErr_Occurred()) { |
| 6561 | p->error_indicator = 1; |
| 6562 | D(p->level--); |
| 6563 | return NULL; |
| 6564 | } |
| 6565 | goto done; |
| 6566 | } |
| 6567 | p->mark = _mark; |
| 6568 | D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6569 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); |
| 6570 | } |
| 6571 | _res = NULL; |
| 6572 | done: |
| 6573 | D(p->level--); |
| 6574 | return _res; |
| 6575 | } |
| 6576 | |
| 6577 | // mapping_pattern: '{' items_pattern? '}' |
| 6578 | static expr_ty |
| 6579 | mapping_pattern_rule(Parser *p) |
| 6580 | { |
| 6581 | D(p->level++); |
| 6582 | if (p->error_indicator) { |
| 6583 | D(p->level--); |
| 6584 | return NULL; |
| 6585 | } |
| 6586 | expr_ty _res = NULL; |
| 6587 | int _mark = p->mark; |
| 6588 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6589 | p->error_indicator = 1; |
| 6590 | D(p->level--); |
| 6591 | return NULL; |
| 6592 | } |
| 6593 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6594 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6595 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6596 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6597 | { // '{' items_pattern? '}' |
| 6598 | if (p->error_indicator) { |
| 6599 | D(p->level--); |
| 6600 | return NULL; |
| 6601 | } |
| 6602 | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); |
| 6603 | Token * _literal; |
| 6604 | Token * _literal_1; |
| 6605 | void *items; |
| 6606 | if ( |
| 6607 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 6608 | && |
| 6609 | (items = items_pattern_rule(p), 1) // items_pattern? |
| 6610 | && |
| 6611 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 6612 | ) |
| 6613 | { |
| 6614 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); |
| 6615 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6616 | if (_token == NULL) { |
| 6617 | D(p->level--); |
| 6618 | return NULL; |
| 6619 | } |
| 6620 | int _end_lineno = _token->end_lineno; |
| 6621 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6622 | int _end_col_offset = _token->end_col_offset; |
| 6623 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6624 | _res = _Py_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , items ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , items ) ) , EXTRA ); |
| 6625 | if (_res == NULL && PyErr_Occurred()) { |
| 6626 | p->error_indicator = 1; |
| 6627 | D(p->level--); |
| 6628 | return NULL; |
| 6629 | } |
| 6630 | goto done; |
| 6631 | } |
| 6632 | p->mark = _mark; |
| 6633 | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6634 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern? '}'")); |
| 6635 | } |
| 6636 | _res = NULL; |
| 6637 | done: |
| 6638 | D(p->level--); |
| 6639 | return _res; |
| 6640 | } |
| 6641 | |
| 6642 | // items_pattern: ','.key_value_pattern+ ','? |
| 6643 | static asdl_seq* |
| 6644 | items_pattern_rule(Parser *p) |
| 6645 | { |
| 6646 | D(p->level++); |
| 6647 | if (p->error_indicator) { |
| 6648 | D(p->level--); |
| 6649 | return NULL; |
| 6650 | } |
| 6651 | asdl_seq* _res = NULL; |
| 6652 | int _mark = p->mark; |
| 6653 | { // ','.key_value_pattern+ ','? |
| 6654 | if (p->error_indicator) { |
| 6655 | D(p->level--); |
| 6656 | return NULL; |
| 6657 | } |
| 6658 | D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+ ','?")); |
| 6659 | void *_opt_var; |
| 6660 | UNUSED(_opt_var); // Silence compiler warnings |
| 6661 | asdl_seq * items; |
| 6662 | if ( |
| 6663 | (items = _gather_59_rule(p)) // ','.key_value_pattern+ |
| 6664 | && |
| 6665 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6666 | ) |
| 6667 | { |
| 6668 | D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+ ','?")); |
| 6669 | _res = items; |
| 6670 | if (_res == NULL && PyErr_Occurred()) { |
| 6671 | p->error_indicator = 1; |
| 6672 | D(p->level--); |
| 6673 | return NULL; |
| 6674 | } |
| 6675 | goto done; |
| 6676 | } |
| 6677 | p->mark = _mark; |
| 6678 | D(fprintf(stderr, "%*c%s items_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6679 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.key_value_pattern+ ','?")); |
| 6680 | } |
| 6681 | _res = NULL; |
| 6682 | done: |
| 6683 | D(p->level--); |
| 6684 | return _res; |
| 6685 | } |
| 6686 | |
| 6687 | // key_value_pattern: (literal_pattern | value_pattern) ':' pattern | double_star_pattern |
| 6688 | static KeyValuePair* |
| 6689 | key_value_pattern_rule(Parser *p) |
| 6690 | { |
| 6691 | D(p->level++); |
| 6692 | if (p->error_indicator) { |
| 6693 | D(p->level--); |
| 6694 | return NULL; |
| 6695 | } |
| 6696 | KeyValuePair* _res = NULL; |
| 6697 | int _mark = p->mark; |
| 6698 | { // (literal_pattern | value_pattern) ':' pattern |
| 6699 | if (p->error_indicator) { |
| 6700 | D(p->level--); |
| 6701 | return NULL; |
| 6702 | } |
| 6703 | D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); |
| 6704 | Token * _literal; |
| 6705 | void *key; |
| 6706 | expr_ty value; |
| 6707 | if ( |
| 6708 | (key = _tmp_61_rule(p)) // literal_pattern | value_pattern |
| 6709 | && |
| 6710 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 6711 | && |
| 6712 | (value = pattern_rule(p)) // pattern |
| 6713 | ) |
| 6714 | { |
| 6715 | D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); |
| 6716 | _res = _PyPegen_key_value_pair ( p , key , value ); |
| 6717 | if (_res == NULL && PyErr_Occurred()) { |
| 6718 | p->error_indicator = 1; |
| 6719 | D(p->level--); |
| 6720 | return NULL; |
| 6721 | } |
| 6722 | goto done; |
| 6723 | } |
| 6724 | p->mark = _mark; |
| 6725 | D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6726 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); |
| 6727 | } |
| 6728 | { // double_star_pattern |
| 6729 | if (p->error_indicator) { |
| 6730 | D(p->level--); |
| 6731 | return NULL; |
| 6732 | } |
| 6733 | D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_star_pattern")); |
| 6734 | KeyValuePair* double_star_pattern_var; |
| 6735 | if ( |
| 6736 | (double_star_pattern_var = double_star_pattern_rule(p)) // double_star_pattern |
| 6737 | ) |
| 6738 | { |
| 6739 | D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_star_pattern")); |
| 6740 | _res = double_star_pattern_var; |
| 6741 | goto done; |
| 6742 | } |
| 6743 | p->mark = _mark; |
| 6744 | D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6745 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_star_pattern")); |
| 6746 | } |
| 6747 | _res = NULL; |
| 6748 | done: |
| 6749 | D(p->level--); |
| 6750 | return _res; |
| 6751 | } |
| 6752 | |
| 6753 | // double_star_pattern: '**' capture_pattern |
| 6754 | static KeyValuePair* |
| 6755 | double_star_pattern_rule(Parser *p) |
| 6756 | { |
| 6757 | D(p->level++); |
| 6758 | if (p->error_indicator) { |
| 6759 | D(p->level--); |
| 6760 | return NULL; |
| 6761 | } |
| 6762 | KeyValuePair* _res = NULL; |
| 6763 | int _mark = p->mark; |
| 6764 | { // '**' capture_pattern |
| 6765 | if (p->error_indicator) { |
| 6766 | D(p->level--); |
| 6767 | return NULL; |
| 6768 | } |
| 6769 | D(fprintf(stderr, "%*c> double_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' capture_pattern")); |
| 6770 | Token * _literal; |
| 6771 | expr_ty value; |
| 6772 | if ( |
| 6773 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 6774 | && |
| 6775 | (value = capture_pattern_rule(p)) // capture_pattern |
| 6776 | ) |
| 6777 | { |
| 6778 | D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' capture_pattern")); |
| 6779 | _res = _PyPegen_key_value_pair ( p , NULL , value ); |
| 6780 | if (_res == NULL && PyErr_Occurred()) { |
| 6781 | p->error_indicator = 1; |
| 6782 | D(p->level--); |
| 6783 | return NULL; |
| 6784 | } |
| 6785 | goto done; |
| 6786 | } |
| 6787 | p->mark = _mark; |
| 6788 | D(fprintf(stderr, "%*c%s double_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6789 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' capture_pattern")); |
| 6790 | } |
| 6791 | _res = NULL; |
| 6792 | done: |
| 6793 | D(p->level--); |
| 6794 | return _res; |
| 6795 | } |
| 6796 | |
| 6797 | // class_pattern: |
| 6798 | // | name_or_attr '(' ')' |
| 6799 | // | name_or_attr '(' positional_patterns ','? ')' |
| 6800 | // | name_or_attr '(' keyword_patterns ','? ')' |
| 6801 | // | name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' |
| 6802 | static expr_ty |
| 6803 | class_pattern_rule(Parser *p) |
| 6804 | { |
| 6805 | D(p->level++); |
| 6806 | if (p->error_indicator) { |
| 6807 | D(p->level--); |
| 6808 | return NULL; |
| 6809 | } |
| 6810 | expr_ty _res = NULL; |
| 6811 | int _mark = p->mark; |
| 6812 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6813 | p->error_indicator = 1; |
| 6814 | D(p->level--); |
| 6815 | return NULL; |
| 6816 | } |
| 6817 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6818 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6819 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6820 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6821 | { // name_or_attr '(' ')' |
| 6822 | if (p->error_indicator) { |
| 6823 | D(p->level--); |
| 6824 | return NULL; |
| 6825 | } |
| 6826 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); |
| 6827 | Token * _literal; |
| 6828 | Token * _literal_1; |
| 6829 | expr_ty func; |
| 6830 | if ( |
| 6831 | (func = name_or_attr_rule(p)) // name_or_attr |
| 6832 | && |
| 6833 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6834 | && |
| 6835 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6836 | ) |
| 6837 | { |
| 6838 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); |
| 6839 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6840 | if (_token == NULL) { |
| 6841 | D(p->level--); |
| 6842 | return NULL; |
| 6843 | } |
| 6844 | int _end_lineno = _token->end_lineno; |
| 6845 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6846 | int _end_col_offset = _token->end_col_offset; |
| 6847 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6848 | _res = _Py_Call ( func , NULL , NULL , EXTRA ); |
| 6849 | if (_res == NULL && PyErr_Occurred()) { |
| 6850 | p->error_indicator = 1; |
| 6851 | D(p->level--); |
| 6852 | return NULL; |
| 6853 | } |
| 6854 | goto done; |
| 6855 | } |
| 6856 | p->mark = _mark; |
| 6857 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6858 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'")); |
| 6859 | } |
| 6860 | { // name_or_attr '(' positional_patterns ','? ')' |
| 6861 | if (p->error_indicator) { |
| 6862 | D(p->level--); |
| 6863 | return NULL; |
| 6864 | } |
| 6865 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
| 6866 | Token * _literal; |
| 6867 | Token * _literal_1; |
| 6868 | void *_opt_var; |
| 6869 | UNUSED(_opt_var); // Silence compiler warnings |
| 6870 | asdl_expr_seq* args; |
| 6871 | expr_ty func; |
| 6872 | if ( |
| 6873 | (func = name_or_attr_rule(p)) // name_or_attr |
| 6874 | && |
| 6875 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6876 | && |
| 6877 | (args = positional_patterns_rule(p)) // positional_patterns |
| 6878 | && |
| 6879 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6880 | && |
| 6881 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6882 | ) |
| 6883 | { |
| 6884 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
| 6885 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6886 | if (_token == NULL) { |
| 6887 | D(p->level--); |
| 6888 | return NULL; |
| 6889 | } |
| 6890 | int _end_lineno = _token->end_lineno; |
| 6891 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6892 | int _end_col_offset = _token->end_col_offset; |
| 6893 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6894 | _res = _Py_Call ( func , args , NULL , EXTRA ); |
| 6895 | if (_res == NULL && PyErr_Occurred()) { |
| 6896 | p->error_indicator = 1; |
| 6897 | D(p->level--); |
| 6898 | return NULL; |
| 6899 | } |
| 6900 | goto done; |
| 6901 | } |
| 6902 | p->mark = _mark; |
| 6903 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6904 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
| 6905 | } |
| 6906 | { // name_or_attr '(' keyword_patterns ','? ')' |
| 6907 | if (p->error_indicator) { |
| 6908 | D(p->level--); |
| 6909 | return NULL; |
| 6910 | } |
| 6911 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
| 6912 | Token * _literal; |
| 6913 | Token * _literal_1; |
| 6914 | void *_opt_var; |
| 6915 | UNUSED(_opt_var); // Silence compiler warnings |
| 6916 | expr_ty func; |
| 6917 | asdl_keyword_seq* keywords; |
| 6918 | if ( |
| 6919 | (func = name_or_attr_rule(p)) // name_or_attr |
| 6920 | && |
| 6921 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6922 | && |
| 6923 | (keywords = keyword_patterns_rule(p)) // keyword_patterns |
| 6924 | && |
| 6925 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6926 | && |
| 6927 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6928 | ) |
| 6929 | { |
| 6930 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
| 6931 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6932 | if (_token == NULL) { |
| 6933 | D(p->level--); |
| 6934 | return NULL; |
| 6935 | } |
| 6936 | int _end_lineno = _token->end_lineno; |
| 6937 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6938 | int _end_col_offset = _token->end_col_offset; |
| 6939 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6940 | _res = _Py_Call ( func , NULL , keywords , EXTRA ); |
| 6941 | if (_res == NULL && PyErr_Occurred()) { |
| 6942 | p->error_indicator = 1; |
| 6943 | D(p->level--); |
| 6944 | return NULL; |
| 6945 | } |
| 6946 | goto done; |
| 6947 | } |
| 6948 | p->mark = _mark; |
| 6949 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6950 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
| 6951 | } |
| 6952 | { // name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' |
| 6953 | if (p->error_indicator) { |
| 6954 | D(p->level--); |
| 6955 | return NULL; |
| 6956 | } |
| 6957 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
| 6958 | Token * _literal; |
| 6959 | Token * _literal_1; |
| 6960 | Token * _literal_2; |
| 6961 | void *_opt_var; |
| 6962 | UNUSED(_opt_var); // Silence compiler warnings |
| 6963 | asdl_expr_seq* args; |
| 6964 | expr_ty func; |
| 6965 | asdl_keyword_seq* keywords; |
| 6966 | if ( |
| 6967 | (func = name_or_attr_rule(p)) // name_or_attr |
| 6968 | && |
| 6969 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6970 | && |
| 6971 | (args = positional_patterns_rule(p)) // positional_patterns |
| 6972 | && |
| 6973 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 6974 | && |
| 6975 | (keywords = keyword_patterns_rule(p)) // keyword_patterns |
| 6976 | && |
| 6977 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6978 | && |
| 6979 | (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6980 | ) |
| 6981 | { |
| 6982 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
| 6983 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6984 | if (_token == NULL) { |
| 6985 | D(p->level--); |
| 6986 | return NULL; |
| 6987 | } |
| 6988 | int _end_lineno = _token->end_lineno; |
| 6989 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6990 | int _end_col_offset = _token->end_col_offset; |
| 6991 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6992 | _res = _Py_Call ( func , args , keywords , EXTRA ); |
| 6993 | if (_res == NULL && PyErr_Occurred()) { |
| 6994 | p->error_indicator = 1; |
| 6995 | D(p->level--); |
| 6996 | return NULL; |
| 6997 | } |
| 6998 | goto done; |
| 6999 | } |
| 7000 | p->mark = _mark; |
| 7001 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 7002 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
| 7003 | } |
| 7004 | _res = NULL; |
| 7005 | done: |
| 7006 | D(p->level--); |
| 7007 | return _res; |
| 7008 | } |
| 7009 | |
| 7010 | // positional_patterns: ','.pattern+ |
| 7011 | static asdl_expr_seq* |
| 7012 | positional_patterns_rule(Parser *p) |
| 7013 | { |
| 7014 | D(p->level++); |
| 7015 | if (p->error_indicator) { |
| 7016 | D(p->level--); |
| 7017 | return NULL; |
| 7018 | } |
| 7019 | asdl_expr_seq* _res = NULL; |
| 7020 | int _mark = p->mark; |
| 7021 | { // ','.pattern+ |
| 7022 | if (p->error_indicator) { |
| 7023 | D(p->level--); |
| 7024 | return NULL; |
| 7025 | } |
| 7026 | D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+")); |
| 7027 | asdl_expr_seq* args; |
| 7028 | if ( |
| 7029 | (args = (asdl_expr_seq*)_gather_62_rule(p)) // ','.pattern+ |
| 7030 | ) |
| 7031 | { |
| 7032 | D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+")); |
| 7033 | _res = args; |
| 7034 | if (_res == NULL && PyErr_Occurred()) { |
| 7035 | p->error_indicator = 1; |
| 7036 | D(p->level--); |
| 7037 | return NULL; |
| 7038 | } |
| 7039 | goto done; |
| 7040 | } |
| 7041 | p->mark = _mark; |
| 7042 | D(fprintf(stderr, "%*c%s positional_patterns[%d-%d]: %s failed!\n", p->level, ' ', |
| 7043 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+")); |
| 7044 | } |
| 7045 | _res = NULL; |
| 7046 | done: |
| 7047 | D(p->level--); |
| 7048 | return _res; |
| 7049 | } |
| 7050 | |
| 7051 | // keyword_patterns: ','.keyword_pattern+ |
| 7052 | static asdl_keyword_seq* |
| 7053 | keyword_patterns_rule(Parser *p) |
| 7054 | { |
| 7055 | D(p->level++); |
| 7056 | if (p->error_indicator) { |
| 7057 | D(p->level--); |
| 7058 | return NULL; |
| 7059 | } |
| 7060 | asdl_keyword_seq* _res = NULL; |
| 7061 | int _mark = p->mark; |
| 7062 | { // ','.keyword_pattern+ |
| 7063 | if (p->error_indicator) { |
| 7064 | D(p->level--); |
| 7065 | return NULL; |
| 7066 | } |
| 7067 | D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); |
| 7068 | asdl_keyword_seq* keywords; |
| 7069 | if ( |
| 7070 | (keywords = (asdl_keyword_seq*)_gather_64_rule(p)) // ','.keyword_pattern+ |
| 7071 | ) |
| 7072 | { |
| 7073 | D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); |
| 7074 | _res = keywords; |
| 7075 | if (_res == NULL && PyErr_Occurred()) { |
| 7076 | p->error_indicator = 1; |
| 7077 | D(p->level--); |
| 7078 | return NULL; |
| 7079 | } |
| 7080 | goto done; |
| 7081 | } |
| 7082 | p->mark = _mark; |
| 7083 | D(fprintf(stderr, "%*c%s keyword_patterns[%d-%d]: %s failed!\n", p->level, ' ', |
| 7084 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.keyword_pattern+")); |
| 7085 | } |
| 7086 | _res = NULL; |
| 7087 | done: |
| 7088 | D(p->level--); |
| 7089 | return _res; |
| 7090 | } |
| 7091 | |
| 7092 | // keyword_pattern: NAME '=' pattern |
| 7093 | static keyword_ty |
| 7094 | keyword_pattern_rule(Parser *p) |
| 7095 | { |
| 7096 | D(p->level++); |
| 7097 | if (p->error_indicator) { |
| 7098 | D(p->level--); |
| 7099 | return NULL; |
| 7100 | } |
| 7101 | keyword_ty _res = NULL; |
| 7102 | int _mark = p->mark; |
| 7103 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7104 | p->error_indicator = 1; |
| 7105 | D(p->level--); |
| 7106 | return NULL; |
| 7107 | } |
| 7108 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7109 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7110 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7111 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 7112 | { // NAME '=' pattern |
| 7113 | if (p->error_indicator) { |
| 7114 | D(p->level--); |
| 7115 | return NULL; |
| 7116 | } |
| 7117 | D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); |
| 7118 | Token * _literal; |
| 7119 | expr_ty arg; |
| 7120 | expr_ty value; |
| 7121 | if ( |
| 7122 | (arg = _PyPegen_name_token(p)) // NAME |
| 7123 | && |
| 7124 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 7125 | && |
| 7126 | (value = pattern_rule(p)) // pattern |
| 7127 | ) |
| 7128 | { |
| 7129 | D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); |
| 7130 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7131 | if (_token == NULL) { |
| 7132 | D(p->level--); |
| 7133 | return NULL; |
| 7134 | } |
| 7135 | int _end_lineno = _token->end_lineno; |
| 7136 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7137 | int _end_col_offset = _token->end_col_offset; |
| 7138 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7139 | _res = _Py_keyword ( arg -> v . Name . id , value , EXTRA ); |
| 7140 | if (_res == NULL && PyErr_Occurred()) { |
| 7141 | p->error_indicator = 1; |
| 7142 | D(p->level--); |
| 7143 | return NULL; |
| 7144 | } |
| 7145 | goto done; |
| 7146 | } |
| 7147 | p->mark = _mark; |
| 7148 | D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 7149 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern")); |
| 7150 | } |
| 7151 | _res = NULL; |
| 7152 | done: |
| 7153 | D(p->level--); |
| 7154 | return _res; |
| 7155 | } |
| 7156 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7157 | // return_stmt: 'return' star_expressions? |
| 7158 | static stmt_ty |
| 7159 | return_stmt_rule(Parser *p) |
| 7160 | { |
| 7161 | D(p->level++); |
| 7162 | if (p->error_indicator) { |
| 7163 | D(p->level--); |
| 7164 | return NULL; |
| 7165 | } |
| 7166 | stmt_ty _res = NULL; |
| 7167 | int _mark = p->mark; |
| 7168 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7169 | p->error_indicator = 1; |
| 7170 | D(p->level--); |
| 7171 | return NULL; |
| 7172 | } |
| 7173 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7174 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7175 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7176 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 7177 | { // 'return' star_expressions? |
| 7178 | if (p->error_indicator) { |
| 7179 | D(p->level--); |
| 7180 | return NULL; |
| 7181 | } |
| 7182 | D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); |
| 7183 | Token * _keyword; |
| 7184 | void *a; |
| 7185 | if ( |
| 7186 | (_keyword = _PyPegen_expect_token(p, 500)) // token='return' |
| 7187 | && |
| 7188 | (a = star_expressions_rule(p), 1) // star_expressions? |
| 7189 | ) |
| 7190 | { |
| 7191 | D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); |
| 7192 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7193 | if (_token == NULL) { |
| 7194 | D(p->level--); |
| 7195 | return NULL; |
| 7196 | } |
| 7197 | int _end_lineno = _token->end_lineno; |
| 7198 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7199 | int _end_col_offset = _token->end_col_offset; |
| 7200 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7201 | _res = _Py_Return ( a , EXTRA ); |
| 7202 | if (_res == NULL && PyErr_Occurred()) { |
| 7203 | p->error_indicator = 1; |
| 7204 | D(p->level--); |
| 7205 | return NULL; |
| 7206 | } |
| 7207 | goto done; |
| 7208 | } |
| 7209 | p->mark = _mark; |
| 7210 | D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 7211 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); |
| 7212 | } |
| 7213 | _res = NULL; |
| 7214 | done: |
| 7215 | D(p->level--); |
| 7216 | return _res; |
| 7217 | } |
| 7218 | |
| 7219 | // raise_stmt: 'raise' expression ['from' expression] | 'raise' |
| 7220 | static stmt_ty |
| 7221 | raise_stmt_rule(Parser *p) |
| 7222 | { |
| 7223 | D(p->level++); |
| 7224 | if (p->error_indicator) { |
| 7225 | D(p->level--); |
| 7226 | return NULL; |
| 7227 | } |
| 7228 | stmt_ty _res = NULL; |
| 7229 | int _mark = p->mark; |
| 7230 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7231 | p->error_indicator = 1; |
| 7232 | D(p->level--); |
| 7233 | return NULL; |
| 7234 | } |
| 7235 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7236 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7237 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7238 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 7239 | { // 'raise' expression ['from' expression] |
| 7240 | if (p->error_indicator) { |
| 7241 | D(p->level--); |
| 7242 | return NULL; |
| 7243 | } |
| 7244 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); |
| 7245 | Token * _keyword; |
| 7246 | expr_ty a; |
| 7247 | void *b; |
| 7248 | if ( |
| 7249 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
| 7250 | && |
| 7251 | (a = expression_rule(p)) // expression |
| 7252 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7253 | (b = _tmp_66_rule(p), 1) // ['from' expression] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7254 | ) |
| 7255 | { |
| 7256 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); |
| 7257 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7258 | if (_token == NULL) { |
| 7259 | D(p->level--); |
| 7260 | return NULL; |
| 7261 | } |
| 7262 | int _end_lineno = _token->end_lineno; |
| 7263 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7264 | int _end_col_offset = _token->end_col_offset; |
| 7265 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7266 | _res = _Py_Raise ( a , b , EXTRA ); |
| 7267 | if (_res == NULL && PyErr_Occurred()) { |
| 7268 | p->error_indicator = 1; |
| 7269 | D(p->level--); |
| 7270 | return NULL; |
| 7271 | } |
| 7272 | goto done; |
| 7273 | } |
| 7274 | p->mark = _mark; |
| 7275 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 7276 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]")); |
| 7277 | } |
| 7278 | { // 'raise' |
| 7279 | if (p->error_indicator) { |
| 7280 | D(p->level--); |
| 7281 | return NULL; |
| 7282 | } |
| 7283 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'")); |
| 7284 | Token * _keyword; |
| 7285 | if ( |
| 7286 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
| 7287 | ) |
| 7288 | { |
| 7289 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'")); |
| 7290 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7291 | if (_token == NULL) { |
| 7292 | D(p->level--); |
| 7293 | return NULL; |
| 7294 | } |
| 7295 | int _end_lineno = _token->end_lineno; |
| 7296 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7297 | int _end_col_offset = _token->end_col_offset; |
| 7298 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7299 | _res = _Py_Raise ( NULL , NULL , EXTRA ); |
| 7300 | if (_res == NULL && PyErr_Occurred()) { |
| 7301 | p->error_indicator = 1; |
| 7302 | D(p->level--); |
| 7303 | return NULL; |
| 7304 | } |
| 7305 | goto done; |
| 7306 | } |
| 7307 | p->mark = _mark; |
| 7308 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 7309 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); |
| 7310 | } |
| 7311 | _res = NULL; |
| 7312 | done: |
| 7313 | D(p->level--); |
| 7314 | return _res; |
| 7315 | } |
| 7316 | |
| 7317 | // function_def: decorators function_def_raw | function_def_raw |
| 7318 | static stmt_ty |
| 7319 | function_def_rule(Parser *p) |
| 7320 | { |
| 7321 | D(p->level++); |
| 7322 | if (p->error_indicator) { |
| 7323 | D(p->level--); |
| 7324 | return NULL; |
| 7325 | } |
| 7326 | stmt_ty _res = NULL; |
| 7327 | int _mark = p->mark; |
| 7328 | { // decorators function_def_raw |
| 7329 | if (p->error_indicator) { |
| 7330 | D(p->level--); |
| 7331 | return NULL; |
| 7332 | } |
| 7333 | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7334 | asdl_expr_seq* d; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7335 | stmt_ty f; |
| 7336 | if ( |
| 7337 | (d = decorators_rule(p)) // decorators |
| 7338 | && |
| 7339 | (f = function_def_raw_rule(p)) // function_def_raw |
| 7340 | ) |
| 7341 | { |
| 7342 | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); |
| 7343 | _res = _PyPegen_function_def_decorators ( p , d , f ); |
| 7344 | if (_res == NULL && PyErr_Occurred()) { |
| 7345 | p->error_indicator = 1; |
| 7346 | D(p->level--); |
| 7347 | return NULL; |
| 7348 | } |
| 7349 | goto done; |
| 7350 | } |
| 7351 | p->mark = _mark; |
| 7352 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 7353 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw")); |
| 7354 | } |
| 7355 | { // function_def_raw |
| 7356 | if (p->error_indicator) { |
| 7357 | D(p->level--); |
| 7358 | return NULL; |
| 7359 | } |
| 7360 | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw")); |
| 7361 | stmt_ty function_def_raw_var; |
| 7362 | if ( |
| 7363 | (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw |
| 7364 | ) |
| 7365 | { |
| 7366 | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw")); |
| 7367 | _res = function_def_raw_var; |
| 7368 | goto done; |
| 7369 | } |
| 7370 | p->mark = _mark; |
| 7371 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 7372 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw")); |
| 7373 | } |
| 7374 | _res = NULL; |
| 7375 | done: |
| 7376 | D(p->level--); |
| 7377 | return _res; |
| 7378 | } |
| 7379 | |
| 7380 | // function_def_raw: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7381 | // | 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
| 7382 | // | ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7383 | static stmt_ty |
| 7384 | function_def_raw_rule(Parser *p) |
| 7385 | { |
| 7386 | D(p->level++); |
| 7387 | if (p->error_indicator) { |
| 7388 | D(p->level--); |
| 7389 | return NULL; |
| 7390 | } |
| 7391 | stmt_ty _res = NULL; |
| 7392 | int _mark = p->mark; |
| 7393 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7394 | p->error_indicator = 1; |
| 7395 | D(p->level--); |
| 7396 | return NULL; |
| 7397 | } |
| 7398 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7399 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7400 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7401 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7402 | { // 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7403 | if (p->error_indicator) { |
| 7404 | D(p->level--); |
| 7405 | return NULL; |
| 7406 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7407 | D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7408 | Token * _keyword; |
| 7409 | Token * _literal; |
| 7410 | Token * _literal_1; |
| 7411 | Token * _literal_2; |
| 7412 | void *a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7413 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7414 | expr_ty n; |
| 7415 | void *params; |
| 7416 | void *tc; |
| 7417 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7418 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7419 | && |
| 7420 | (n = _PyPegen_name_token(p)) // NAME |
| 7421 | && |
| 7422 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 7423 | && |
| 7424 | (params = params_rule(p), 1) // params? |
| 7425 | && |
| 7426 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 7427 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7428 | (a = _tmp_67_rule(p), 1) // ['->' expression] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7429 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7430 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7431 | && |
| 7432 | (tc = func_type_comment_rule(p), 1) // func_type_comment? |
| 7433 | && |
| 7434 | (b = block_rule(p)) // block |
| 7435 | ) |
| 7436 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7437 | D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7438 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7439 | if (_token == NULL) { |
| 7440 | D(p->level--); |
| 7441 | return NULL; |
| 7442 | } |
| 7443 | int _end_lineno = _token->end_lineno; |
| 7444 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7445 | int _end_col_offset = _token->end_col_offset; |
| 7446 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 7447 | _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7448 | if (_res == NULL && PyErr_Occurred()) { |
| 7449 | p->error_indicator = 1; |
| 7450 | D(p->level--); |
| 7451 | return NULL; |
| 7452 | } |
| 7453 | goto done; |
| 7454 | } |
| 7455 | p->mark = _mark; |
| 7456 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7457 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7458 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7459 | { // ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7460 | if (p->error_indicator) { |
| 7461 | D(p->level--); |
| 7462 | return NULL; |
| 7463 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7464 | D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7465 | Token * _keyword; |
| 7466 | Token * _literal; |
| 7467 | Token * _literal_1; |
| 7468 | Token * _literal_2; |
| 7469 | void *a; |
| 7470 | Token * async_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7471 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7472 | expr_ty n; |
| 7473 | void *params; |
| 7474 | void *tc; |
| 7475 | if ( |
| 7476 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 7477 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7478 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7479 | && |
| 7480 | (n = _PyPegen_name_token(p)) // NAME |
| 7481 | && |
| 7482 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 7483 | && |
| 7484 | (params = params_rule(p), 1) // params? |
| 7485 | && |
| 7486 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 7487 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7488 | (a = _tmp_68_rule(p), 1) // ['->' expression] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7489 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7490 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7491 | && |
| 7492 | (tc = func_type_comment_rule(p), 1) // func_type_comment? |
| 7493 | && |
| 7494 | (b = block_rule(p)) // block |
| 7495 | ) |
| 7496 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7497 | D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7498 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7499 | if (_token == NULL) { |
| 7500 | D(p->level--); |
| 7501 | return NULL; |
| 7502 | } |
| 7503 | int _end_lineno = _token->end_lineno; |
| 7504 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7505 | int _end_col_offset = _token->end_col_offset; |
| 7506 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 7507 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7508 | if (_res == NULL && PyErr_Occurred()) { |
| 7509 | p->error_indicator = 1; |
| 7510 | D(p->level--); |
| 7511 | return NULL; |
| 7512 | } |
| 7513 | goto done; |
| 7514 | } |
| 7515 | p->mark = _mark; |
| 7516 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7517 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7518 | } |
| 7519 | _res = NULL; |
| 7520 | done: |
| 7521 | D(p->level--); |
| 7522 | return _res; |
| 7523 | } |
| 7524 | |
| 7525 | // func_type_comment: |
| 7526 | // | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
| 7527 | // | invalid_double_type_comments |
| 7528 | // | TYPE_COMMENT |
| 7529 | static Token* |
| 7530 | func_type_comment_rule(Parser *p) |
| 7531 | { |
| 7532 | D(p->level++); |
| 7533 | if (p->error_indicator) { |
| 7534 | D(p->level--); |
| 7535 | return NULL; |
| 7536 | } |
| 7537 | Token* _res = NULL; |
| 7538 | int _mark = p->mark; |
| 7539 | { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
| 7540 | if (p->error_indicator) { |
| 7541 | D(p->level--); |
| 7542 | return NULL; |
| 7543 | } |
| 7544 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
| 7545 | Token * newline_var; |
| 7546 | Token * t; |
| 7547 | if ( |
| 7548 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 7549 | && |
| 7550 | (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 7551 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7552 | _PyPegen_lookahead(1, _tmp_69_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7553 | ) |
| 7554 | { |
| 7555 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
| 7556 | _res = t; |
| 7557 | if (_res == NULL && PyErr_Occurred()) { |
| 7558 | p->error_indicator = 1; |
| 7559 | D(p->level--); |
| 7560 | return NULL; |
| 7561 | } |
| 7562 | goto done; |
| 7563 | } |
| 7564 | p->mark = _mark; |
| 7565 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 7566 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
| 7567 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 7568 | if (p->call_invalid_rules) { // invalid_double_type_comments |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7569 | if (p->error_indicator) { |
| 7570 | D(p->level--); |
| 7571 | return NULL; |
| 7572 | } |
| 7573 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); |
| 7574 | void *invalid_double_type_comments_var; |
| 7575 | if ( |
| 7576 | (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments |
| 7577 | ) |
| 7578 | { |
| 7579 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); |
| 7580 | _res = invalid_double_type_comments_var; |
| 7581 | goto done; |
| 7582 | } |
| 7583 | p->mark = _mark; |
| 7584 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 7585 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments")); |
| 7586 | } |
| 7587 | { // TYPE_COMMENT |
| 7588 | if (p->error_indicator) { |
| 7589 | D(p->level--); |
| 7590 | return NULL; |
| 7591 | } |
| 7592 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); |
| 7593 | Token * type_comment_var; |
| 7594 | if ( |
| 7595 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 7596 | ) |
| 7597 | { |
| 7598 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); |
| 7599 | _res = type_comment_var; |
| 7600 | goto done; |
| 7601 | } |
| 7602 | p->mark = _mark; |
| 7603 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 7604 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT")); |
| 7605 | } |
| 7606 | _res = NULL; |
| 7607 | done: |
| 7608 | D(p->level--); |
| 7609 | return _res; |
| 7610 | } |
| 7611 | |
| 7612 | // params: invalid_parameters | parameters |
| 7613 | static arguments_ty |
| 7614 | params_rule(Parser *p) |
| 7615 | { |
| 7616 | D(p->level++); |
| 7617 | if (p->error_indicator) { |
| 7618 | D(p->level--); |
| 7619 | return NULL; |
| 7620 | } |
| 7621 | arguments_ty _res = NULL; |
| 7622 | int _mark = p->mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 7623 | if (p->call_invalid_rules) { // invalid_parameters |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7624 | if (p->error_indicator) { |
| 7625 | D(p->level--); |
| 7626 | return NULL; |
| 7627 | } |
| 7628 | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); |
| 7629 | void *invalid_parameters_var; |
| 7630 | if ( |
| 7631 | (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters |
| 7632 | ) |
| 7633 | { |
| 7634 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); |
| 7635 | _res = invalid_parameters_var; |
| 7636 | goto done; |
| 7637 | } |
| 7638 | p->mark = _mark; |
| 7639 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
| 7640 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters")); |
| 7641 | } |
| 7642 | { // parameters |
| 7643 | if (p->error_indicator) { |
| 7644 | D(p->level--); |
| 7645 | return NULL; |
| 7646 | } |
| 7647 | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters")); |
| 7648 | arguments_ty parameters_var; |
| 7649 | if ( |
| 7650 | (parameters_var = parameters_rule(p)) // parameters |
| 7651 | ) |
| 7652 | { |
| 7653 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters")); |
| 7654 | _res = parameters_var; |
| 7655 | goto done; |
| 7656 | } |
| 7657 | p->mark = _mark; |
| 7658 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
| 7659 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters")); |
| 7660 | } |
| 7661 | _res = NULL; |
| 7662 | done: |
| 7663 | D(p->level--); |
| 7664 | return _res; |
| 7665 | } |
| 7666 | |
| 7667 | // parameters: |
| 7668 | // | slash_no_default param_no_default* param_with_default* star_etc? |
| 7669 | // | slash_with_default param_with_default* star_etc? |
| 7670 | // | param_no_default+ param_with_default* star_etc? |
| 7671 | // | param_with_default+ star_etc? |
| 7672 | // | star_etc |
| 7673 | static arguments_ty |
| 7674 | parameters_rule(Parser *p) |
| 7675 | { |
| 7676 | D(p->level++); |
| 7677 | if (p->error_indicator) { |
| 7678 | D(p->level--); |
| 7679 | return NULL; |
| 7680 | } |
| 7681 | arguments_ty _res = NULL; |
| 7682 | int _mark = p->mark; |
| 7683 | { // slash_no_default param_no_default* param_with_default* star_etc? |
| 7684 | if (p->error_indicator) { |
| 7685 | D(p->level--); |
| 7686 | return NULL; |
| 7687 | } |
| 7688 | 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?")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7689 | asdl_arg_seq* a; |
| 7690 | asdl_arg_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7691 | asdl_seq * c; |
| 7692 | void *d; |
| 7693 | if ( |
| 7694 | (a = slash_no_default_rule(p)) // slash_no_default |
| 7695 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7696 | (b = (asdl_arg_seq*)_loop0_70_rule(p)) // param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7697 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7698 | (c = _loop0_71_rule(p)) // param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7699 | && |
| 7700 | (d = star_etc_rule(p), 1) // star_etc? |
| 7701 | ) |
| 7702 | { |
| 7703 | 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?")); |
| 7704 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
| 7705 | if (_res == NULL && PyErr_Occurred()) { |
| 7706 | p->error_indicator = 1; |
| 7707 | D(p->level--); |
| 7708 | return NULL; |
| 7709 | } |
| 7710 | goto done; |
| 7711 | } |
| 7712 | p->mark = _mark; |
| 7713 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7714 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); |
| 7715 | } |
| 7716 | { // slash_with_default param_with_default* star_etc? |
| 7717 | if (p->error_indicator) { |
| 7718 | D(p->level--); |
| 7719 | return NULL; |
| 7720 | } |
| 7721 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
| 7722 | SlashWithDefault* a; |
| 7723 | asdl_seq * b; |
| 7724 | void *c; |
| 7725 | if ( |
| 7726 | (a = slash_with_default_rule(p)) // slash_with_default |
| 7727 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7728 | (b = _loop0_72_rule(p)) // param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7729 | && |
| 7730 | (c = star_etc_rule(p), 1) // star_etc? |
| 7731 | ) |
| 7732 | { |
| 7733 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
| 7734 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
| 7735 | if (_res == NULL && PyErr_Occurred()) { |
| 7736 | p->error_indicator = 1; |
| 7737 | D(p->level--); |
| 7738 | return NULL; |
| 7739 | } |
| 7740 | goto done; |
| 7741 | } |
| 7742 | p->mark = _mark; |
| 7743 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7744 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
| 7745 | } |
| 7746 | { // param_no_default+ param_with_default* star_etc? |
| 7747 | if (p->error_indicator) { |
| 7748 | D(p->level--); |
| 7749 | return NULL; |
| 7750 | } |
| 7751 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7752 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7753 | asdl_seq * b; |
| 7754 | void *c; |
| 7755 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7756 | (a = (asdl_arg_seq*)_loop1_73_rule(p)) // param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7757 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7758 | (b = _loop0_74_rule(p)) // param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7759 | && |
| 7760 | (c = star_etc_rule(p), 1) // star_etc? |
| 7761 | ) |
| 7762 | { |
| 7763 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
| 7764 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
| 7765 | if (_res == NULL && PyErr_Occurred()) { |
| 7766 | p->error_indicator = 1; |
| 7767 | D(p->level--); |
| 7768 | return NULL; |
| 7769 | } |
| 7770 | goto done; |
| 7771 | } |
| 7772 | p->mark = _mark; |
| 7773 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7774 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
| 7775 | } |
| 7776 | { // param_with_default+ star_etc? |
| 7777 | if (p->error_indicator) { |
| 7778 | D(p->level--); |
| 7779 | return NULL; |
| 7780 | } |
| 7781 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); |
| 7782 | asdl_seq * a; |
| 7783 | void *b; |
| 7784 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7785 | (a = _loop1_75_rule(p)) // param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7786 | && |
| 7787 | (b = star_etc_rule(p), 1) // star_etc? |
| 7788 | ) |
| 7789 | { |
| 7790 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); |
| 7791 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
| 7792 | if (_res == NULL && PyErr_Occurred()) { |
| 7793 | p->error_indicator = 1; |
| 7794 | D(p->level--); |
| 7795 | return NULL; |
| 7796 | } |
| 7797 | goto done; |
| 7798 | } |
| 7799 | p->mark = _mark; |
| 7800 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7801 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?")); |
| 7802 | } |
| 7803 | { // star_etc |
| 7804 | if (p->error_indicator) { |
| 7805 | D(p->level--); |
| 7806 | return NULL; |
| 7807 | } |
| 7808 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc")); |
| 7809 | StarEtc* a; |
| 7810 | if ( |
| 7811 | (a = star_etc_rule(p)) // star_etc |
| 7812 | ) |
| 7813 | { |
| 7814 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc")); |
| 7815 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
| 7816 | if (_res == NULL && PyErr_Occurred()) { |
| 7817 | p->error_indicator = 1; |
| 7818 | D(p->level--); |
| 7819 | return NULL; |
| 7820 | } |
| 7821 | goto done; |
| 7822 | } |
| 7823 | p->mark = _mark; |
| 7824 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7825 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc")); |
| 7826 | } |
| 7827 | _res = NULL; |
| 7828 | done: |
| 7829 | D(p->level--); |
| 7830 | return _res; |
| 7831 | } |
| 7832 | |
| 7833 | // slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')' |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7834 | static asdl_arg_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7835 | slash_no_default_rule(Parser *p) |
| 7836 | { |
| 7837 | D(p->level++); |
| 7838 | if (p->error_indicator) { |
| 7839 | D(p->level--); |
| 7840 | return NULL; |
| 7841 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7842 | asdl_arg_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7843 | int _mark = p->mark; |
| 7844 | { // param_no_default+ '/' ',' |
| 7845 | if (p->error_indicator) { |
| 7846 | D(p->level--); |
| 7847 | return NULL; |
| 7848 | } |
| 7849 | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); |
| 7850 | Token * _literal; |
| 7851 | Token * _literal_1; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7852 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7853 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7854 | (a = (asdl_arg_seq*)_loop1_76_rule(p)) // param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7855 | && |
| 7856 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 7857 | && |
| 7858 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 7859 | ) |
| 7860 | { |
| 7861 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); |
| 7862 | _res = a; |
| 7863 | if (_res == NULL && PyErr_Occurred()) { |
| 7864 | p->error_indicator = 1; |
| 7865 | D(p->level--); |
| 7866 | return NULL; |
| 7867 | } |
| 7868 | goto done; |
| 7869 | } |
| 7870 | p->mark = _mark; |
| 7871 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7872 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','")); |
| 7873 | } |
| 7874 | { // param_no_default+ '/' &')' |
| 7875 | if (p->error_indicator) { |
| 7876 | D(p->level--); |
| 7877 | return NULL; |
| 7878 | } |
| 7879 | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); |
| 7880 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7881 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7882 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7883 | (a = (asdl_arg_seq*)_loop1_77_rule(p)) // param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7884 | && |
| 7885 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 7886 | && |
| 7887 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 7888 | ) |
| 7889 | { |
| 7890 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); |
| 7891 | _res = a; |
| 7892 | if (_res == NULL && PyErr_Occurred()) { |
| 7893 | p->error_indicator = 1; |
| 7894 | D(p->level--); |
| 7895 | return NULL; |
| 7896 | } |
| 7897 | goto done; |
| 7898 | } |
| 7899 | p->mark = _mark; |
| 7900 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7901 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'")); |
| 7902 | } |
| 7903 | _res = NULL; |
| 7904 | done: |
| 7905 | D(p->level--); |
| 7906 | return _res; |
| 7907 | } |
| 7908 | |
| 7909 | // slash_with_default: |
| 7910 | // | param_no_default* param_with_default+ '/' ',' |
| 7911 | // | param_no_default* param_with_default+ '/' &')' |
| 7912 | static SlashWithDefault* |
| 7913 | slash_with_default_rule(Parser *p) |
| 7914 | { |
| 7915 | D(p->level++); |
| 7916 | if (p->error_indicator) { |
| 7917 | D(p->level--); |
| 7918 | return NULL; |
| 7919 | } |
| 7920 | SlashWithDefault* _res = NULL; |
| 7921 | int _mark = p->mark; |
| 7922 | { // param_no_default* param_with_default+ '/' ',' |
| 7923 | if (p->error_indicator) { |
| 7924 | D(p->level--); |
| 7925 | return NULL; |
| 7926 | } |
| 7927 | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
| 7928 | Token * _literal; |
| 7929 | Token * _literal_1; |
| 7930 | asdl_seq * a; |
| 7931 | asdl_seq * b; |
| 7932 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7933 | (a = _loop0_78_rule(p)) // param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7934 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7935 | (b = _loop1_79_rule(p)) // param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7936 | && |
| 7937 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 7938 | && |
| 7939 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 7940 | ) |
| 7941 | { |
| 7942 | D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7943 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7944 | if (_res == NULL && PyErr_Occurred()) { |
| 7945 | p->error_indicator = 1; |
| 7946 | D(p->level--); |
| 7947 | return NULL; |
| 7948 | } |
| 7949 | goto done; |
| 7950 | } |
| 7951 | p->mark = _mark; |
| 7952 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7953 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
| 7954 | } |
| 7955 | { // param_no_default* param_with_default+ '/' &')' |
| 7956 | if (p->error_indicator) { |
| 7957 | D(p->level--); |
| 7958 | return NULL; |
| 7959 | } |
| 7960 | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
| 7961 | Token * _literal; |
| 7962 | asdl_seq * a; |
| 7963 | asdl_seq * b; |
| 7964 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7965 | (a = _loop0_80_rule(p)) // param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7966 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7967 | (b = _loop1_81_rule(p)) // param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7968 | && |
| 7969 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 7970 | && |
| 7971 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 7972 | ) |
| 7973 | { |
| 7974 | D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7975 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7976 | if (_res == NULL && PyErr_Occurred()) { |
| 7977 | p->error_indicator = 1; |
| 7978 | D(p->level--); |
| 7979 | return NULL; |
| 7980 | } |
| 7981 | goto done; |
| 7982 | } |
| 7983 | p->mark = _mark; |
| 7984 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7985 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
| 7986 | } |
| 7987 | _res = NULL; |
| 7988 | done: |
| 7989 | D(p->level--); |
| 7990 | return _res; |
| 7991 | } |
| 7992 | |
| 7993 | // star_etc: |
| 7994 | // | '*' param_no_default param_maybe_default* kwds? |
| 7995 | // | '*' ',' param_maybe_default+ kwds? |
| 7996 | // | kwds |
| 7997 | // | invalid_star_etc |
| 7998 | static StarEtc* |
| 7999 | star_etc_rule(Parser *p) |
| 8000 | { |
| 8001 | D(p->level++); |
| 8002 | if (p->error_indicator) { |
| 8003 | D(p->level--); |
| 8004 | return NULL; |
| 8005 | } |
| 8006 | StarEtc* _res = NULL; |
| 8007 | int _mark = p->mark; |
| 8008 | { // '*' param_no_default param_maybe_default* kwds? |
| 8009 | if (p->error_indicator) { |
| 8010 | D(p->level--); |
| 8011 | return NULL; |
| 8012 | } |
| 8013 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
| 8014 | Token * _literal; |
| 8015 | arg_ty a; |
| 8016 | asdl_seq * b; |
| 8017 | void *c; |
| 8018 | if ( |
| 8019 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 8020 | && |
| 8021 | (a = param_no_default_rule(p)) // param_no_default |
| 8022 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8023 | (b = _loop0_82_rule(p)) // param_maybe_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8024 | && |
| 8025 | (c = kwds_rule(p), 1) // kwds? |
| 8026 | ) |
| 8027 | { |
| 8028 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
| 8029 | _res = _PyPegen_star_etc ( p , a , b , c ); |
| 8030 | if (_res == NULL && PyErr_Occurred()) { |
| 8031 | p->error_indicator = 1; |
| 8032 | D(p->level--); |
| 8033 | return NULL; |
| 8034 | } |
| 8035 | goto done; |
| 8036 | } |
| 8037 | p->mark = _mark; |
| 8038 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 8039 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
| 8040 | } |
| 8041 | { // '*' ',' param_maybe_default+ kwds? |
| 8042 | if (p->error_indicator) { |
| 8043 | D(p->level--); |
| 8044 | return NULL; |
| 8045 | } |
| 8046 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
| 8047 | Token * _literal; |
| 8048 | Token * _literal_1; |
| 8049 | asdl_seq * b; |
| 8050 | void *c; |
| 8051 | if ( |
| 8052 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 8053 | && |
| 8054 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 8055 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8056 | (b = _loop1_83_rule(p)) // param_maybe_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8057 | && |
| 8058 | (c = kwds_rule(p), 1) // kwds? |
| 8059 | ) |
| 8060 | { |
| 8061 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
| 8062 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
| 8063 | if (_res == NULL && PyErr_Occurred()) { |
| 8064 | p->error_indicator = 1; |
| 8065 | D(p->level--); |
| 8066 | return NULL; |
| 8067 | } |
| 8068 | goto done; |
| 8069 | } |
| 8070 | p->mark = _mark; |
| 8071 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 8072 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
| 8073 | } |
| 8074 | { // kwds |
| 8075 | if (p->error_indicator) { |
| 8076 | D(p->level--); |
| 8077 | return NULL; |
| 8078 | } |
| 8079 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds")); |
| 8080 | arg_ty a; |
| 8081 | if ( |
| 8082 | (a = kwds_rule(p)) // kwds |
| 8083 | ) |
| 8084 | { |
| 8085 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds")); |
| 8086 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
| 8087 | if (_res == NULL && PyErr_Occurred()) { |
| 8088 | p->error_indicator = 1; |
| 8089 | D(p->level--); |
| 8090 | return NULL; |
| 8091 | } |
| 8092 | goto done; |
| 8093 | } |
| 8094 | p->mark = _mark; |
| 8095 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 8096 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds")); |
| 8097 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 8098 | if (p->call_invalid_rules) { // invalid_star_etc |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8099 | if (p->error_indicator) { |
| 8100 | D(p->level--); |
| 8101 | return NULL; |
| 8102 | } |
| 8103 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); |
| 8104 | void *invalid_star_etc_var; |
| 8105 | if ( |
| 8106 | (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc |
| 8107 | ) |
| 8108 | { |
| 8109 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); |
| 8110 | _res = invalid_star_etc_var; |
| 8111 | goto done; |
| 8112 | } |
| 8113 | p->mark = _mark; |
| 8114 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 8115 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc")); |
| 8116 | } |
| 8117 | _res = NULL; |
| 8118 | done: |
| 8119 | D(p->level--); |
| 8120 | return _res; |
| 8121 | } |
| 8122 | |
| 8123 | // kwds: '**' param_no_default |
| 8124 | static arg_ty |
| 8125 | kwds_rule(Parser *p) |
| 8126 | { |
| 8127 | D(p->level++); |
| 8128 | if (p->error_indicator) { |
| 8129 | D(p->level--); |
| 8130 | return NULL; |
| 8131 | } |
| 8132 | arg_ty _res = NULL; |
| 8133 | int _mark = p->mark; |
| 8134 | { // '**' param_no_default |
| 8135 | if (p->error_indicator) { |
| 8136 | D(p->level--); |
| 8137 | return NULL; |
| 8138 | } |
| 8139 | D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); |
| 8140 | Token * _literal; |
| 8141 | arg_ty a; |
| 8142 | if ( |
| 8143 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 8144 | && |
| 8145 | (a = param_no_default_rule(p)) // param_no_default |
| 8146 | ) |
| 8147 | { |
| 8148 | D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); |
| 8149 | _res = a; |
| 8150 | if (_res == NULL && PyErr_Occurred()) { |
| 8151 | p->error_indicator = 1; |
| 8152 | D(p->level--); |
| 8153 | return NULL; |
| 8154 | } |
| 8155 | goto done; |
| 8156 | } |
| 8157 | p->mark = _mark; |
| 8158 | D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ', |
| 8159 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default")); |
| 8160 | } |
| 8161 | _res = NULL; |
| 8162 | done: |
| 8163 | D(p->level--); |
| 8164 | return _res; |
| 8165 | } |
| 8166 | |
| 8167 | // param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')' |
| 8168 | static arg_ty |
| 8169 | param_no_default_rule(Parser *p) |
| 8170 | { |
| 8171 | D(p->level++); |
| 8172 | if (p->error_indicator) { |
| 8173 | D(p->level--); |
| 8174 | return NULL; |
| 8175 | } |
| 8176 | arg_ty _res = NULL; |
| 8177 | int _mark = p->mark; |
| 8178 | { // param ',' TYPE_COMMENT? |
| 8179 | if (p->error_indicator) { |
| 8180 | D(p->level--); |
| 8181 | return NULL; |
| 8182 | } |
| 8183 | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); |
| 8184 | Token * _literal; |
| 8185 | arg_ty a; |
| 8186 | void *tc; |
| 8187 | if ( |
| 8188 | (a = param_rule(p)) // param |
| 8189 | && |
| 8190 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 8191 | && |
| 8192 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8193 | ) |
| 8194 | { |
| 8195 | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); |
| 8196 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
| 8197 | if (_res == NULL && PyErr_Occurred()) { |
| 8198 | p->error_indicator = 1; |
| 8199 | D(p->level--); |
| 8200 | return NULL; |
| 8201 | } |
| 8202 | goto done; |
| 8203 | } |
| 8204 | p->mark = _mark; |
| 8205 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8206 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?")); |
| 8207 | } |
| 8208 | { // param TYPE_COMMENT? &')' |
| 8209 | if (p->error_indicator) { |
| 8210 | D(p->level--); |
| 8211 | return NULL; |
| 8212 | } |
| 8213 | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); |
| 8214 | arg_ty a; |
| 8215 | void *tc; |
| 8216 | if ( |
| 8217 | (a = param_rule(p)) // param |
| 8218 | && |
| 8219 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8220 | && |
| 8221 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 8222 | ) |
| 8223 | { |
| 8224 | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); |
| 8225 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
| 8226 | if (_res == NULL && PyErr_Occurred()) { |
| 8227 | p->error_indicator = 1; |
| 8228 | D(p->level--); |
| 8229 | return NULL; |
| 8230 | } |
| 8231 | goto done; |
| 8232 | } |
| 8233 | p->mark = _mark; |
| 8234 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8235 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'")); |
| 8236 | } |
| 8237 | _res = NULL; |
| 8238 | done: |
| 8239 | D(p->level--); |
| 8240 | return _res; |
| 8241 | } |
| 8242 | |
| 8243 | // param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')' |
| 8244 | static NameDefaultPair* |
| 8245 | param_with_default_rule(Parser *p) |
| 8246 | { |
| 8247 | D(p->level++); |
| 8248 | if (p->error_indicator) { |
| 8249 | D(p->level--); |
| 8250 | return NULL; |
| 8251 | } |
| 8252 | NameDefaultPair* _res = NULL; |
| 8253 | int _mark = p->mark; |
| 8254 | { // param default ',' TYPE_COMMENT? |
| 8255 | if (p->error_indicator) { |
| 8256 | D(p->level--); |
| 8257 | return NULL; |
| 8258 | } |
| 8259 | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
| 8260 | Token * _literal; |
| 8261 | arg_ty a; |
| 8262 | expr_ty c; |
| 8263 | void *tc; |
| 8264 | if ( |
| 8265 | (a = param_rule(p)) // param |
| 8266 | && |
| 8267 | (c = default_rule(p)) // default |
| 8268 | && |
| 8269 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 8270 | && |
| 8271 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8272 | ) |
| 8273 | { |
| 8274 | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
| 8275 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 8276 | if (_res == NULL && PyErr_Occurred()) { |
| 8277 | p->error_indicator = 1; |
| 8278 | D(p->level--); |
| 8279 | return NULL; |
| 8280 | } |
| 8281 | goto done; |
| 8282 | } |
| 8283 | p->mark = _mark; |
| 8284 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8285 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
| 8286 | } |
| 8287 | { // param default TYPE_COMMENT? &')' |
| 8288 | if (p->error_indicator) { |
| 8289 | D(p->level--); |
| 8290 | return NULL; |
| 8291 | } |
| 8292 | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
| 8293 | arg_ty a; |
| 8294 | expr_ty c; |
| 8295 | void *tc; |
| 8296 | if ( |
| 8297 | (a = param_rule(p)) // param |
| 8298 | && |
| 8299 | (c = default_rule(p)) // default |
| 8300 | && |
| 8301 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8302 | && |
| 8303 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 8304 | ) |
| 8305 | { |
| 8306 | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
| 8307 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 8308 | if (_res == NULL && PyErr_Occurred()) { |
| 8309 | p->error_indicator = 1; |
| 8310 | D(p->level--); |
| 8311 | return NULL; |
| 8312 | } |
| 8313 | goto done; |
| 8314 | } |
| 8315 | p->mark = _mark; |
| 8316 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8317 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
| 8318 | } |
| 8319 | _res = NULL; |
| 8320 | done: |
| 8321 | D(p->level--); |
| 8322 | return _res; |
| 8323 | } |
| 8324 | |
| 8325 | // param_maybe_default: |
| 8326 | // | param default? ',' TYPE_COMMENT? |
| 8327 | // | param default? TYPE_COMMENT? &')' |
| 8328 | static NameDefaultPair* |
| 8329 | param_maybe_default_rule(Parser *p) |
| 8330 | { |
| 8331 | D(p->level++); |
| 8332 | if (p->error_indicator) { |
| 8333 | D(p->level--); |
| 8334 | return NULL; |
| 8335 | } |
| 8336 | NameDefaultPair* _res = NULL; |
| 8337 | int _mark = p->mark; |
| 8338 | { // param default? ',' TYPE_COMMENT? |
| 8339 | if (p->error_indicator) { |
| 8340 | D(p->level--); |
| 8341 | return NULL; |
| 8342 | } |
| 8343 | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
| 8344 | Token * _literal; |
| 8345 | arg_ty a; |
| 8346 | void *c; |
| 8347 | void *tc; |
| 8348 | if ( |
| 8349 | (a = param_rule(p)) // param |
| 8350 | && |
| 8351 | (c = default_rule(p), 1) // default? |
| 8352 | && |
| 8353 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 8354 | && |
| 8355 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8356 | ) |
| 8357 | { |
| 8358 | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
| 8359 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 8360 | if (_res == NULL && PyErr_Occurred()) { |
| 8361 | p->error_indicator = 1; |
| 8362 | D(p->level--); |
| 8363 | return NULL; |
| 8364 | } |
| 8365 | goto done; |
| 8366 | } |
| 8367 | p->mark = _mark; |
| 8368 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8369 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
| 8370 | } |
| 8371 | { // param default? TYPE_COMMENT? &')' |
| 8372 | if (p->error_indicator) { |
| 8373 | D(p->level--); |
| 8374 | return NULL; |
| 8375 | } |
| 8376 | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
| 8377 | arg_ty a; |
| 8378 | void *c; |
| 8379 | void *tc; |
| 8380 | if ( |
| 8381 | (a = param_rule(p)) // param |
| 8382 | && |
| 8383 | (c = default_rule(p), 1) // default? |
| 8384 | && |
| 8385 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8386 | && |
| 8387 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 8388 | ) |
| 8389 | { |
| 8390 | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
| 8391 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 8392 | if (_res == NULL && PyErr_Occurred()) { |
| 8393 | p->error_indicator = 1; |
| 8394 | D(p->level--); |
| 8395 | return NULL; |
| 8396 | } |
| 8397 | goto done; |
| 8398 | } |
| 8399 | p->mark = _mark; |
| 8400 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8401 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
| 8402 | } |
| 8403 | _res = NULL; |
| 8404 | done: |
| 8405 | D(p->level--); |
| 8406 | return _res; |
| 8407 | } |
| 8408 | |
| 8409 | // param: NAME annotation? |
| 8410 | static arg_ty |
| 8411 | param_rule(Parser *p) |
| 8412 | { |
| 8413 | D(p->level++); |
| 8414 | if (p->error_indicator) { |
| 8415 | D(p->level--); |
| 8416 | return NULL; |
| 8417 | } |
| 8418 | arg_ty _res = NULL; |
| 8419 | int _mark = p->mark; |
| 8420 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8421 | p->error_indicator = 1; |
| 8422 | D(p->level--); |
| 8423 | return NULL; |
| 8424 | } |
| 8425 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8426 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8427 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8428 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 8429 | { // NAME annotation? |
| 8430 | if (p->error_indicator) { |
| 8431 | D(p->level--); |
| 8432 | return NULL; |
| 8433 | } |
| 8434 | D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); |
| 8435 | expr_ty a; |
| 8436 | void *b; |
| 8437 | if ( |
| 8438 | (a = _PyPegen_name_token(p)) // NAME |
| 8439 | && |
| 8440 | (b = annotation_rule(p), 1) // annotation? |
| 8441 | ) |
| 8442 | { |
| 8443 | D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); |
| 8444 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8445 | if (_token == NULL) { |
| 8446 | D(p->level--); |
| 8447 | return NULL; |
| 8448 | } |
| 8449 | int _end_lineno = _token->end_lineno; |
| 8450 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8451 | int _end_col_offset = _token->end_col_offset; |
| 8452 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8453 | _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA ); |
| 8454 | if (_res == NULL && PyErr_Occurred()) { |
| 8455 | p->error_indicator = 1; |
| 8456 | D(p->level--); |
| 8457 | return NULL; |
| 8458 | } |
| 8459 | goto done; |
| 8460 | } |
| 8461 | p->mark = _mark; |
| 8462 | D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ', |
| 8463 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?")); |
| 8464 | } |
| 8465 | _res = NULL; |
| 8466 | done: |
| 8467 | D(p->level--); |
| 8468 | return _res; |
| 8469 | } |
| 8470 | |
| 8471 | // annotation: ':' expression |
| 8472 | static expr_ty |
| 8473 | annotation_rule(Parser *p) |
| 8474 | { |
| 8475 | D(p->level++); |
| 8476 | if (p->error_indicator) { |
| 8477 | D(p->level--); |
| 8478 | return NULL; |
| 8479 | } |
| 8480 | expr_ty _res = NULL; |
| 8481 | int _mark = p->mark; |
| 8482 | { // ':' expression |
| 8483 | if (p->error_indicator) { |
| 8484 | D(p->level--); |
| 8485 | return NULL; |
| 8486 | } |
| 8487 | D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression")); |
| 8488 | Token * _literal; |
| 8489 | expr_ty a; |
| 8490 | if ( |
| 8491 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 8492 | && |
| 8493 | (a = expression_rule(p)) // expression |
| 8494 | ) |
| 8495 | { |
| 8496 | D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression")); |
| 8497 | _res = a; |
| 8498 | if (_res == NULL && PyErr_Occurred()) { |
| 8499 | p->error_indicator = 1; |
| 8500 | D(p->level--); |
| 8501 | return NULL; |
| 8502 | } |
| 8503 | goto done; |
| 8504 | } |
| 8505 | p->mark = _mark; |
| 8506 | D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ', |
| 8507 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression")); |
| 8508 | } |
| 8509 | _res = NULL; |
| 8510 | done: |
| 8511 | D(p->level--); |
| 8512 | return _res; |
| 8513 | } |
| 8514 | |
| 8515 | // default: '=' expression |
| 8516 | static expr_ty |
| 8517 | default_rule(Parser *p) |
| 8518 | { |
| 8519 | D(p->level++); |
| 8520 | if (p->error_indicator) { |
| 8521 | D(p->level--); |
| 8522 | return NULL; |
| 8523 | } |
| 8524 | expr_ty _res = NULL; |
| 8525 | int _mark = p->mark; |
| 8526 | { // '=' expression |
| 8527 | if (p->error_indicator) { |
| 8528 | D(p->level--); |
| 8529 | return NULL; |
| 8530 | } |
| 8531 | D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
| 8532 | Token * _literal; |
| 8533 | expr_ty a; |
| 8534 | if ( |
| 8535 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 8536 | && |
| 8537 | (a = expression_rule(p)) // expression |
| 8538 | ) |
| 8539 | { |
| 8540 | D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
| 8541 | _res = a; |
| 8542 | if (_res == NULL && PyErr_Occurred()) { |
| 8543 | p->error_indicator = 1; |
| 8544 | D(p->level--); |
| 8545 | return NULL; |
| 8546 | } |
| 8547 | goto done; |
| 8548 | } |
| 8549 | p->mark = _mark; |
| 8550 | D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8551 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression")); |
| 8552 | } |
| 8553 | _res = NULL; |
| 8554 | done: |
| 8555 | D(p->level--); |
| 8556 | return _res; |
| 8557 | } |
| 8558 | |
| 8559 | // decorators: (('@' named_expression NEWLINE))+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8560 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8561 | decorators_rule(Parser *p) |
| 8562 | { |
| 8563 | D(p->level++); |
| 8564 | if (p->error_indicator) { |
| 8565 | D(p->level--); |
| 8566 | return NULL; |
| 8567 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8568 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8569 | int _mark = p->mark; |
| 8570 | { // (('@' named_expression NEWLINE))+ |
| 8571 | if (p->error_indicator) { |
| 8572 | D(p->level--); |
| 8573 | return NULL; |
| 8574 | } |
| 8575 | D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8576 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8577 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8578 | (a = (asdl_expr_seq*)_loop1_84_rule(p)) // (('@' named_expression NEWLINE))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8579 | ) |
| 8580 | { |
| 8581 | D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
| 8582 | _res = a; |
| 8583 | if (_res == NULL && PyErr_Occurred()) { |
| 8584 | p->error_indicator = 1; |
| 8585 | D(p->level--); |
| 8586 | return NULL; |
| 8587 | } |
| 8588 | goto done; |
| 8589 | } |
| 8590 | p->mark = _mark; |
| 8591 | D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ', |
| 8592 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
| 8593 | } |
| 8594 | _res = NULL; |
| 8595 | done: |
| 8596 | D(p->level--); |
| 8597 | return _res; |
| 8598 | } |
| 8599 | |
| 8600 | // class_def: decorators class_def_raw | class_def_raw |
| 8601 | static stmt_ty |
| 8602 | class_def_rule(Parser *p) |
| 8603 | { |
| 8604 | D(p->level++); |
| 8605 | if (p->error_indicator) { |
| 8606 | D(p->level--); |
| 8607 | return NULL; |
| 8608 | } |
| 8609 | stmt_ty _res = NULL; |
| 8610 | int _mark = p->mark; |
| 8611 | { // decorators class_def_raw |
| 8612 | if (p->error_indicator) { |
| 8613 | D(p->level--); |
| 8614 | return NULL; |
| 8615 | } |
| 8616 | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8617 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8618 | stmt_ty b; |
| 8619 | if ( |
| 8620 | (a = decorators_rule(p)) // decorators |
| 8621 | && |
| 8622 | (b = class_def_raw_rule(p)) // class_def_raw |
| 8623 | ) |
| 8624 | { |
| 8625 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); |
| 8626 | _res = _PyPegen_class_def_decorators ( p , a , b ); |
| 8627 | if (_res == NULL && PyErr_Occurred()) { |
| 8628 | p->error_indicator = 1; |
| 8629 | D(p->level--); |
| 8630 | return NULL; |
| 8631 | } |
| 8632 | goto done; |
| 8633 | } |
| 8634 | p->mark = _mark; |
| 8635 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 8636 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw")); |
| 8637 | } |
| 8638 | { // class_def_raw |
| 8639 | if (p->error_indicator) { |
| 8640 | D(p->level--); |
| 8641 | return NULL; |
| 8642 | } |
| 8643 | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw")); |
| 8644 | stmt_ty class_def_raw_var; |
| 8645 | if ( |
| 8646 | (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw |
| 8647 | ) |
| 8648 | { |
| 8649 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw")); |
| 8650 | _res = class_def_raw_var; |
| 8651 | goto done; |
| 8652 | } |
| 8653 | p->mark = _mark; |
| 8654 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 8655 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw")); |
| 8656 | } |
| 8657 | _res = NULL; |
| 8658 | done: |
| 8659 | D(p->level--); |
| 8660 | return _res; |
| 8661 | } |
| 8662 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8663 | // class_def_raw: 'class' NAME ['(' arguments? ')'] &&':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8664 | static stmt_ty |
| 8665 | class_def_raw_rule(Parser *p) |
| 8666 | { |
| 8667 | D(p->level++); |
| 8668 | if (p->error_indicator) { |
| 8669 | D(p->level--); |
| 8670 | return NULL; |
| 8671 | } |
| 8672 | stmt_ty _res = NULL; |
| 8673 | int _mark = p->mark; |
| 8674 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8675 | p->error_indicator = 1; |
| 8676 | D(p->level--); |
| 8677 | return NULL; |
| 8678 | } |
| 8679 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8680 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8681 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8682 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8683 | { // 'class' NAME ['(' arguments? ')'] &&':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8684 | if (p->error_indicator) { |
| 8685 | D(p->level--); |
| 8686 | return NULL; |
| 8687 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8688 | D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8689 | Token * _keyword; |
| 8690 | Token * _literal; |
| 8691 | expr_ty a; |
| 8692 | void *b; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8693 | asdl_stmt_seq* c; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8694 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8695 | (_keyword = _PyPegen_expect_token(p, 527)) // token='class' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8696 | && |
| 8697 | (a = _PyPegen_name_token(p)) // NAME |
| 8698 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8699 | (b = _tmp_85_rule(p), 1) // ['(' arguments? ')'] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8700 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8701 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8702 | && |
| 8703 | (c = block_rule(p)) // block |
| 8704 | ) |
| 8705 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8706 | D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8707 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8708 | if (_token == NULL) { |
| 8709 | D(p->level--); |
| 8710 | return NULL; |
| 8711 | } |
| 8712 | int _end_lineno = _token->end_lineno; |
| 8713 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8714 | int _end_col_offset = _token->end_col_offset; |
| 8715 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8716 | _res = _Py_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA ); |
| 8717 | if (_res == NULL && PyErr_Occurred()) { |
| 8718 | p->error_indicator = 1; |
| 8719 | D(p->level--); |
| 8720 | return NULL; |
| 8721 | } |
| 8722 | goto done; |
| 8723 | } |
| 8724 | p->mark = _mark; |
| 8725 | D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8726 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8727 | } |
| 8728 | _res = NULL; |
| 8729 | done: |
| 8730 | D(p->level--); |
| 8731 | return _res; |
| 8732 | } |
| 8733 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8734 | // block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8735 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8736 | block_rule(Parser *p) |
| 8737 | { |
| 8738 | D(p->level++); |
| 8739 | if (p->error_indicator) { |
| 8740 | D(p->level--); |
| 8741 | return NULL; |
| 8742 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8743 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8744 | if (_PyPegen_is_memoized(p, block_type, &_res)) { |
| 8745 | D(p->level--); |
| 8746 | return _res; |
| 8747 | } |
| 8748 | int _mark = p->mark; |
| 8749 | { // NEWLINE INDENT statements DEDENT |
| 8750 | if (p->error_indicator) { |
| 8751 | D(p->level--); |
| 8752 | return NULL; |
| 8753 | } |
| 8754 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8755 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8756 | Token * dedent_var; |
| 8757 | Token * indent_var; |
| 8758 | Token * newline_var; |
| 8759 | if ( |
| 8760 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 8761 | && |
| 8762 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
| 8763 | && |
| 8764 | (a = statements_rule(p)) // statements |
| 8765 | && |
| 8766 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
| 8767 | ) |
| 8768 | { |
| 8769 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
| 8770 | _res = a; |
| 8771 | if (_res == NULL && PyErr_Occurred()) { |
| 8772 | p->error_indicator = 1; |
| 8773 | D(p->level--); |
| 8774 | return NULL; |
| 8775 | } |
| 8776 | goto done; |
| 8777 | } |
| 8778 | p->mark = _mark; |
| 8779 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 8780 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
| 8781 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8782 | { // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8783 | if (p->error_indicator) { |
| 8784 | D(p->level--); |
| 8785 | return NULL; |
| 8786 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8787 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
| 8788 | asdl_stmt_seq* simple_stmts_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8789 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8790 | (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8791 | ) |
| 8792 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8793 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
| 8794 | _res = simple_stmts_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8795 | goto done; |
| 8796 | } |
| 8797 | p->mark = _mark; |
| 8798 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8799 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8800 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 8801 | if (p->call_invalid_rules) { // invalid_block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8802 | if (p->error_indicator) { |
| 8803 | D(p->level--); |
| 8804 | return NULL; |
| 8805 | } |
| 8806 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block")); |
| 8807 | void *invalid_block_var; |
| 8808 | if ( |
| 8809 | (invalid_block_var = invalid_block_rule(p)) // invalid_block |
| 8810 | ) |
| 8811 | { |
| 8812 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block")); |
| 8813 | _res = invalid_block_var; |
| 8814 | goto done; |
| 8815 | } |
| 8816 | p->mark = _mark; |
| 8817 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 8818 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block")); |
| 8819 | } |
| 8820 | _res = NULL; |
| 8821 | done: |
| 8822 | _PyPegen_insert_memo(p, _mark, block_type, _res); |
| 8823 | D(p->level--); |
| 8824 | return _res; |
| 8825 | } |
| 8826 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8827 | // star_expressions: |
| 8828 | // | star_expression ((',' star_expression))+ ','? |
| 8829 | // | star_expression ',' |
| 8830 | // | star_expression |
| 8831 | static expr_ty |
| 8832 | star_expressions_rule(Parser *p) |
| 8833 | { |
| 8834 | D(p->level++); |
| 8835 | if (p->error_indicator) { |
| 8836 | D(p->level--); |
| 8837 | return NULL; |
| 8838 | } |
| 8839 | expr_ty _res = NULL; |
| 8840 | int _mark = p->mark; |
| 8841 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8842 | p->error_indicator = 1; |
| 8843 | D(p->level--); |
| 8844 | return NULL; |
| 8845 | } |
| 8846 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8847 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8848 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8849 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 8850 | { // star_expression ((',' star_expression))+ ','? |
| 8851 | if (p->error_indicator) { |
| 8852 | D(p->level--); |
| 8853 | return NULL; |
| 8854 | } |
| 8855 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
| 8856 | void *_opt_var; |
| 8857 | UNUSED(_opt_var); // Silence compiler warnings |
| 8858 | expr_ty a; |
| 8859 | asdl_seq * b; |
| 8860 | if ( |
| 8861 | (a = star_expression_rule(p)) // star_expression |
| 8862 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8863 | (b = _loop1_86_rule(p)) // ((',' star_expression))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8864 | && |
| 8865 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 8866 | ) |
| 8867 | { |
| 8868 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
| 8869 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8870 | if (_token == NULL) { |
| 8871 | D(p->level--); |
| 8872 | return NULL; |
| 8873 | } |
| 8874 | int _end_lineno = _token->end_lineno; |
| 8875 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8876 | int _end_col_offset = _token->end_col_offset; |
| 8877 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 8878 | _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8879 | if (_res == NULL && PyErr_Occurred()) { |
| 8880 | p->error_indicator = 1; |
| 8881 | D(p->level--); |
| 8882 | return NULL; |
| 8883 | } |
| 8884 | goto done; |
| 8885 | } |
| 8886 | p->mark = _mark; |
| 8887 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 8888 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
| 8889 | } |
| 8890 | { // star_expression ',' |
| 8891 | if (p->error_indicator) { |
| 8892 | D(p->level--); |
| 8893 | return NULL; |
| 8894 | } |
| 8895 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','")); |
| 8896 | Token * _literal; |
| 8897 | expr_ty a; |
| 8898 | if ( |
| 8899 | (a = star_expression_rule(p)) // star_expression |
| 8900 | && |
| 8901 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 8902 | ) |
| 8903 | { |
| 8904 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','")); |
| 8905 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8906 | if (_token == NULL) { |
| 8907 | D(p->level--); |
| 8908 | return NULL; |
| 8909 | } |
| 8910 | int _end_lineno = _token->end_lineno; |
| 8911 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8912 | int _end_col_offset = _token->end_col_offset; |
| 8913 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 8914 | _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8915 | if (_res == NULL && PyErr_Occurred()) { |
| 8916 | p->error_indicator = 1; |
| 8917 | D(p->level--); |
| 8918 | return NULL; |
| 8919 | } |
| 8920 | goto done; |
| 8921 | } |
| 8922 | p->mark = _mark; |
| 8923 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 8924 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','")); |
| 8925 | } |
| 8926 | { // star_expression |
| 8927 | if (p->error_indicator) { |
| 8928 | D(p->level--); |
| 8929 | return NULL; |
| 8930 | } |
| 8931 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression")); |
| 8932 | expr_ty star_expression_var; |
| 8933 | if ( |
| 8934 | (star_expression_var = star_expression_rule(p)) // star_expression |
| 8935 | ) |
| 8936 | { |
| 8937 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression")); |
| 8938 | _res = star_expression_var; |
| 8939 | goto done; |
| 8940 | } |
| 8941 | p->mark = _mark; |
| 8942 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 8943 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression")); |
| 8944 | } |
| 8945 | _res = NULL; |
| 8946 | done: |
| 8947 | D(p->level--); |
| 8948 | return _res; |
| 8949 | } |
| 8950 | |
| 8951 | // star_expression: '*' bitwise_or | expression |
| 8952 | static expr_ty |
| 8953 | star_expression_rule(Parser *p) |
| 8954 | { |
| 8955 | D(p->level++); |
| 8956 | if (p->error_indicator) { |
| 8957 | D(p->level--); |
| 8958 | return NULL; |
| 8959 | } |
| 8960 | expr_ty _res = NULL; |
| 8961 | if (_PyPegen_is_memoized(p, star_expression_type, &_res)) { |
| 8962 | D(p->level--); |
| 8963 | return _res; |
| 8964 | } |
| 8965 | int _mark = p->mark; |
| 8966 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8967 | p->error_indicator = 1; |
| 8968 | D(p->level--); |
| 8969 | return NULL; |
| 8970 | } |
| 8971 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8972 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8973 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8974 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 8975 | { // '*' bitwise_or |
| 8976 | if (p->error_indicator) { |
| 8977 | D(p->level--); |
| 8978 | return NULL; |
| 8979 | } |
| 8980 | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
| 8981 | Token * _literal; |
| 8982 | expr_ty a; |
| 8983 | if ( |
| 8984 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 8985 | && |
| 8986 | (a = bitwise_or_rule(p)) // bitwise_or |
| 8987 | ) |
| 8988 | { |
| 8989 | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
| 8990 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8991 | if (_token == NULL) { |
| 8992 | D(p->level--); |
| 8993 | return NULL; |
| 8994 | } |
| 8995 | int _end_lineno = _token->end_lineno; |
| 8996 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8997 | int _end_col_offset = _token->end_col_offset; |
| 8998 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8999 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 9000 | if (_res == NULL && PyErr_Occurred()) { |
| 9001 | p->error_indicator = 1; |
| 9002 | D(p->level--); |
| 9003 | return NULL; |
| 9004 | } |
| 9005 | goto done; |
| 9006 | } |
| 9007 | p->mark = _mark; |
| 9008 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9009 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
| 9010 | } |
| 9011 | { // expression |
| 9012 | if (p->error_indicator) { |
| 9013 | D(p->level--); |
| 9014 | return NULL; |
| 9015 | } |
| 9016 | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
| 9017 | expr_ty expression_var; |
| 9018 | if ( |
| 9019 | (expression_var = expression_rule(p)) // expression |
| 9020 | ) |
| 9021 | { |
| 9022 | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
| 9023 | _res = expression_var; |
| 9024 | goto done; |
| 9025 | } |
| 9026 | p->mark = _mark; |
| 9027 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9028 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
| 9029 | } |
| 9030 | _res = NULL; |
| 9031 | done: |
| 9032 | _PyPegen_insert_memo(p, _mark, star_expression_type, _res); |
| 9033 | D(p->level--); |
| 9034 | return _res; |
| 9035 | } |
| 9036 | |
| 9037 | // star_named_expressions: ','.star_named_expression+ ','? |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9038 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9039 | star_named_expressions_rule(Parser *p) |
| 9040 | { |
| 9041 | D(p->level++); |
| 9042 | if (p->error_indicator) { |
| 9043 | D(p->level--); |
| 9044 | return NULL; |
| 9045 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9046 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9047 | int _mark = p->mark; |
| 9048 | { // ','.star_named_expression+ ','? |
| 9049 | if (p->error_indicator) { |
| 9050 | D(p->level--); |
| 9051 | return NULL; |
| 9052 | } |
| 9053 | D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); |
| 9054 | void *_opt_var; |
| 9055 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9056 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9057 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9058 | (a = (asdl_expr_seq*)_gather_87_rule(p)) // ','.star_named_expression+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9059 | && |
| 9060 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 9061 | ) |
| 9062 | { |
| 9063 | D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); |
| 9064 | _res = a; |
| 9065 | if (_res == NULL && PyErr_Occurred()) { |
| 9066 | p->error_indicator = 1; |
| 9067 | D(p->level--); |
| 9068 | return NULL; |
| 9069 | } |
| 9070 | goto done; |
| 9071 | } |
| 9072 | p->mark = _mark; |
| 9073 | D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 9074 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?")); |
| 9075 | } |
| 9076 | _res = NULL; |
| 9077 | done: |
| 9078 | D(p->level--); |
| 9079 | return _res; |
| 9080 | } |
| 9081 | |
| 9082 | // star_named_expression: '*' bitwise_or | named_expression |
| 9083 | static expr_ty |
| 9084 | star_named_expression_rule(Parser *p) |
| 9085 | { |
| 9086 | D(p->level++); |
| 9087 | if (p->error_indicator) { |
| 9088 | D(p->level--); |
| 9089 | return NULL; |
| 9090 | } |
| 9091 | expr_ty _res = NULL; |
| 9092 | int _mark = p->mark; |
| 9093 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9094 | p->error_indicator = 1; |
| 9095 | D(p->level--); |
| 9096 | return NULL; |
| 9097 | } |
| 9098 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9099 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9100 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9101 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 9102 | { // '*' bitwise_or |
| 9103 | if (p->error_indicator) { |
| 9104 | D(p->level--); |
| 9105 | return NULL; |
| 9106 | } |
| 9107 | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
| 9108 | Token * _literal; |
| 9109 | expr_ty a; |
| 9110 | if ( |
| 9111 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 9112 | && |
| 9113 | (a = bitwise_or_rule(p)) // bitwise_or |
| 9114 | ) |
| 9115 | { |
| 9116 | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
| 9117 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9118 | if (_token == NULL) { |
| 9119 | D(p->level--); |
| 9120 | return NULL; |
| 9121 | } |
| 9122 | int _end_lineno = _token->end_lineno; |
| 9123 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9124 | int _end_col_offset = _token->end_col_offset; |
| 9125 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9126 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 9127 | if (_res == NULL && PyErr_Occurred()) { |
| 9128 | p->error_indicator = 1; |
| 9129 | D(p->level--); |
| 9130 | return NULL; |
| 9131 | } |
| 9132 | goto done; |
| 9133 | } |
| 9134 | p->mark = _mark; |
| 9135 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9136 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
| 9137 | } |
| 9138 | { // named_expression |
| 9139 | if (p->error_indicator) { |
| 9140 | D(p->level--); |
| 9141 | return NULL; |
| 9142 | } |
| 9143 | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
| 9144 | expr_ty named_expression_var; |
| 9145 | if ( |
| 9146 | (named_expression_var = named_expression_rule(p)) // named_expression |
| 9147 | ) |
| 9148 | { |
| 9149 | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
| 9150 | _res = named_expression_var; |
| 9151 | goto done; |
| 9152 | } |
| 9153 | p->mark = _mark; |
| 9154 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9155 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
| 9156 | } |
| 9157 | _res = NULL; |
| 9158 | done: |
| 9159 | D(p->level--); |
| 9160 | return _res; |
| 9161 | } |
| 9162 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9163 | // named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9164 | static expr_ty |
| 9165 | named_expression_rule(Parser *p) |
| 9166 | { |
| 9167 | D(p->level++); |
| 9168 | if (p->error_indicator) { |
| 9169 | D(p->level--); |
| 9170 | return NULL; |
| 9171 | } |
| 9172 | expr_ty _res = NULL; |
| 9173 | int _mark = p->mark; |
| 9174 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9175 | p->error_indicator = 1; |
| 9176 | D(p->level--); |
| 9177 | return NULL; |
| 9178 | } |
| 9179 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9180 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9181 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9182 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9183 | { // NAME ':=' ~ expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9184 | if (p->error_indicator) { |
| 9185 | D(p->level--); |
| 9186 | return NULL; |
| 9187 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9188 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression")); |
| 9189 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9190 | Token * _literal; |
| 9191 | expr_ty a; |
| 9192 | expr_ty b; |
| 9193 | if ( |
| 9194 | (a = _PyPegen_name_token(p)) // NAME |
| 9195 | && |
| 9196 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
| 9197 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9198 | (_cut_var = 1) |
| 9199 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9200 | (b = expression_rule(p)) // expression |
| 9201 | ) |
| 9202 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9203 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9204 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9205 | if (_token == NULL) { |
| 9206 | D(p->level--); |
| 9207 | return NULL; |
| 9208 | } |
| 9209 | int _end_lineno = _token->end_lineno; |
| 9210 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9211 | int _end_col_offset = _token->end_col_offset; |
| 9212 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 9213 | _res = _Py_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9214 | if (_res == NULL && PyErr_Occurred()) { |
| 9215 | p->error_indicator = 1; |
| 9216 | D(p->level--); |
| 9217 | return NULL; |
| 9218 | } |
| 9219 | goto done; |
| 9220 | } |
| 9221 | p->mark = _mark; |
| 9222 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9223 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression")); |
| 9224 | if (_cut_var) { |
| 9225 | D(p->level--); |
| 9226 | return NULL; |
| 9227 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9228 | } |
| 9229 | { // expression !':=' |
| 9230 | if (p->error_indicator) { |
| 9231 | D(p->level--); |
| 9232 | return NULL; |
| 9233 | } |
| 9234 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
| 9235 | expr_ty expression_var; |
| 9236 | if ( |
| 9237 | (expression_var = expression_rule(p)) // expression |
| 9238 | && |
| 9239 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
| 9240 | ) |
| 9241 | { |
| 9242 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
| 9243 | _res = expression_var; |
| 9244 | goto done; |
| 9245 | } |
| 9246 | p->mark = _mark; |
| 9247 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9248 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); |
| 9249 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 9250 | if (p->call_invalid_rules) { // invalid_named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9251 | if (p->error_indicator) { |
| 9252 | D(p->level--); |
| 9253 | return NULL; |
| 9254 | } |
| 9255 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); |
| 9256 | void *invalid_named_expression_var; |
| 9257 | if ( |
| 9258 | (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression |
| 9259 | ) |
| 9260 | { |
| 9261 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); |
| 9262 | _res = invalid_named_expression_var; |
| 9263 | goto done; |
| 9264 | } |
| 9265 | p->mark = _mark; |
| 9266 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9267 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression")); |
| 9268 | } |
| 9269 | _res = NULL; |
| 9270 | done: |
| 9271 | D(p->level--); |
| 9272 | return _res; |
| 9273 | } |
| 9274 | |
| 9275 | // annotated_rhs: yield_expr | star_expressions |
| 9276 | static expr_ty |
| 9277 | annotated_rhs_rule(Parser *p) |
| 9278 | { |
| 9279 | D(p->level++); |
| 9280 | if (p->error_indicator) { |
| 9281 | D(p->level--); |
| 9282 | return NULL; |
| 9283 | } |
| 9284 | expr_ty _res = NULL; |
| 9285 | int _mark = p->mark; |
| 9286 | { // yield_expr |
| 9287 | if (p->error_indicator) { |
| 9288 | D(p->level--); |
| 9289 | return NULL; |
| 9290 | } |
| 9291 | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 9292 | expr_ty yield_expr_var; |
| 9293 | if ( |
| 9294 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 9295 | ) |
| 9296 | { |
| 9297 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 9298 | _res = yield_expr_var; |
| 9299 | goto done; |
| 9300 | } |
| 9301 | p->mark = _mark; |
| 9302 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
| 9303 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 9304 | } |
| 9305 | { // star_expressions |
| 9306 | if (p->error_indicator) { |
| 9307 | D(p->level--); |
| 9308 | return NULL; |
| 9309 | } |
| 9310 | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 9311 | expr_ty star_expressions_var; |
| 9312 | if ( |
| 9313 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 9314 | ) |
| 9315 | { |
| 9316 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 9317 | _res = star_expressions_var; |
| 9318 | goto done; |
| 9319 | } |
| 9320 | p->mark = _mark; |
| 9321 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
| 9322 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 9323 | } |
| 9324 | _res = NULL; |
| 9325 | done: |
| 9326 | D(p->level--); |
| 9327 | return _res; |
| 9328 | } |
| 9329 | |
| 9330 | // expressions: expression ((',' expression))+ ','? | expression ',' | expression |
| 9331 | static expr_ty |
| 9332 | expressions_rule(Parser *p) |
| 9333 | { |
| 9334 | D(p->level++); |
| 9335 | if (p->error_indicator) { |
| 9336 | D(p->level--); |
| 9337 | return NULL; |
| 9338 | } |
| 9339 | expr_ty _res = NULL; |
| 9340 | int _mark = p->mark; |
| 9341 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9342 | p->error_indicator = 1; |
| 9343 | D(p->level--); |
| 9344 | return NULL; |
| 9345 | } |
| 9346 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9347 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9348 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9349 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 9350 | { // expression ((',' expression))+ ','? |
| 9351 | if (p->error_indicator) { |
| 9352 | D(p->level--); |
| 9353 | return NULL; |
| 9354 | } |
| 9355 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); |
| 9356 | void *_opt_var; |
| 9357 | UNUSED(_opt_var); // Silence compiler warnings |
| 9358 | expr_ty a; |
| 9359 | asdl_seq * b; |
| 9360 | if ( |
| 9361 | (a = expression_rule(p)) // expression |
| 9362 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9363 | (b = _loop1_89_rule(p)) // ((',' expression))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9364 | && |
| 9365 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 9366 | ) |
| 9367 | { |
| 9368 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); |
| 9369 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9370 | if (_token == NULL) { |
| 9371 | D(p->level--); |
| 9372 | return NULL; |
| 9373 | } |
| 9374 | int _end_lineno = _token->end_lineno; |
| 9375 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9376 | int _end_col_offset = _token->end_col_offset; |
| 9377 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 9378 | _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9379 | if (_res == NULL && PyErr_Occurred()) { |
| 9380 | p->error_indicator = 1; |
| 9381 | D(p->level--); |
| 9382 | return NULL; |
| 9383 | } |
| 9384 | goto done; |
| 9385 | } |
| 9386 | p->mark = _mark; |
| 9387 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 9388 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?")); |
| 9389 | } |
| 9390 | { // expression ',' |
| 9391 | if (p->error_indicator) { |
| 9392 | D(p->level--); |
| 9393 | return NULL; |
| 9394 | } |
| 9395 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','")); |
| 9396 | Token * _literal; |
| 9397 | expr_ty a; |
| 9398 | if ( |
| 9399 | (a = expression_rule(p)) // expression |
| 9400 | && |
| 9401 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 9402 | ) |
| 9403 | { |
| 9404 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','")); |
| 9405 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9406 | if (_token == NULL) { |
| 9407 | D(p->level--); |
| 9408 | return NULL; |
| 9409 | } |
| 9410 | int _end_lineno = _token->end_lineno; |
| 9411 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9412 | int _end_col_offset = _token->end_col_offset; |
| 9413 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 9414 | _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9415 | if (_res == NULL && PyErr_Occurred()) { |
| 9416 | p->error_indicator = 1; |
| 9417 | D(p->level--); |
| 9418 | return NULL; |
| 9419 | } |
| 9420 | goto done; |
| 9421 | } |
| 9422 | p->mark = _mark; |
| 9423 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 9424 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','")); |
| 9425 | } |
| 9426 | { // expression |
| 9427 | if (p->error_indicator) { |
| 9428 | D(p->level--); |
| 9429 | return NULL; |
| 9430 | } |
| 9431 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
| 9432 | expr_ty expression_var; |
| 9433 | if ( |
| 9434 | (expression_var = expression_rule(p)) // expression |
| 9435 | ) |
| 9436 | { |
| 9437 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
| 9438 | _res = expression_var; |
| 9439 | goto done; |
| 9440 | } |
| 9441 | p->mark = _mark; |
| 9442 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 9443 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
| 9444 | } |
| 9445 | _res = NULL; |
| 9446 | done: |
| 9447 | D(p->level--); |
| 9448 | return _res; |
| 9449 | } |
| 9450 | |
| 9451 | // expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef |
| 9452 | static expr_ty |
| 9453 | expression_rule(Parser *p) |
| 9454 | { |
| 9455 | D(p->level++); |
| 9456 | if (p->error_indicator) { |
| 9457 | D(p->level--); |
| 9458 | return NULL; |
| 9459 | } |
| 9460 | expr_ty _res = NULL; |
| 9461 | if (_PyPegen_is_memoized(p, expression_type, &_res)) { |
| 9462 | D(p->level--); |
| 9463 | return _res; |
| 9464 | } |
| 9465 | int _mark = p->mark; |
| 9466 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9467 | p->error_indicator = 1; |
| 9468 | D(p->level--); |
| 9469 | return NULL; |
| 9470 | } |
| 9471 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9472 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9473 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9474 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 9475 | { // disjunction 'if' disjunction 'else' expression |
| 9476 | if (p->error_indicator) { |
| 9477 | D(p->level--); |
| 9478 | return NULL; |
| 9479 | } |
| 9480 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
| 9481 | Token * _keyword; |
| 9482 | Token * _keyword_1; |
| 9483 | expr_ty a; |
| 9484 | expr_ty b; |
| 9485 | expr_ty c; |
| 9486 | if ( |
| 9487 | (a = disjunction_rule(p)) // disjunction |
| 9488 | && |
| 9489 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 9490 | && |
| 9491 | (b = disjunction_rule(p)) // disjunction |
| 9492 | && |
| 9493 | (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else' |
| 9494 | && |
| 9495 | (c = expression_rule(p)) // expression |
| 9496 | ) |
| 9497 | { |
| 9498 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
| 9499 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9500 | if (_token == NULL) { |
| 9501 | D(p->level--); |
| 9502 | return NULL; |
| 9503 | } |
| 9504 | int _end_lineno = _token->end_lineno; |
| 9505 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9506 | int _end_col_offset = _token->end_col_offset; |
| 9507 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9508 | _res = _Py_IfExp ( b , a , c , EXTRA ); |
| 9509 | if (_res == NULL && PyErr_Occurred()) { |
| 9510 | p->error_indicator = 1; |
| 9511 | D(p->level--); |
| 9512 | return NULL; |
| 9513 | } |
| 9514 | goto done; |
| 9515 | } |
| 9516 | p->mark = _mark; |
| 9517 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9518 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
| 9519 | } |
| 9520 | { // disjunction |
| 9521 | if (p->error_indicator) { |
| 9522 | D(p->level--); |
| 9523 | return NULL; |
| 9524 | } |
| 9525 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction")); |
| 9526 | expr_ty disjunction_var; |
| 9527 | if ( |
| 9528 | (disjunction_var = disjunction_rule(p)) // disjunction |
| 9529 | ) |
| 9530 | { |
| 9531 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction")); |
| 9532 | _res = disjunction_var; |
| 9533 | goto done; |
| 9534 | } |
| 9535 | p->mark = _mark; |
| 9536 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9537 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction")); |
| 9538 | } |
| 9539 | { // lambdef |
| 9540 | if (p->error_indicator) { |
| 9541 | D(p->level--); |
| 9542 | return NULL; |
| 9543 | } |
| 9544 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef")); |
| 9545 | expr_ty lambdef_var; |
| 9546 | if ( |
| 9547 | (lambdef_var = lambdef_rule(p)) // lambdef |
| 9548 | ) |
| 9549 | { |
| 9550 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef")); |
| 9551 | _res = lambdef_var; |
| 9552 | goto done; |
| 9553 | } |
| 9554 | p->mark = _mark; |
| 9555 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9556 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef")); |
| 9557 | } |
| 9558 | _res = NULL; |
| 9559 | done: |
| 9560 | _PyPegen_insert_memo(p, _mark, expression_type, _res); |
| 9561 | D(p->level--); |
| 9562 | return _res; |
| 9563 | } |
| 9564 | |
| 9565 | // lambdef: 'lambda' lambda_params? ':' expression |
| 9566 | static expr_ty |
| 9567 | lambdef_rule(Parser *p) |
| 9568 | { |
| 9569 | D(p->level++); |
| 9570 | if (p->error_indicator) { |
| 9571 | D(p->level--); |
| 9572 | return NULL; |
| 9573 | } |
| 9574 | expr_ty _res = NULL; |
| 9575 | int _mark = p->mark; |
| 9576 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9577 | p->error_indicator = 1; |
| 9578 | D(p->level--); |
| 9579 | return NULL; |
| 9580 | } |
| 9581 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9582 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9583 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9584 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 9585 | { // 'lambda' lambda_params? ':' expression |
| 9586 | if (p->error_indicator) { |
| 9587 | D(p->level--); |
| 9588 | return NULL; |
| 9589 | } |
| 9590 | D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
| 9591 | Token * _keyword; |
| 9592 | Token * _literal; |
| 9593 | void *a; |
| 9594 | expr_ty b; |
| 9595 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9596 | (_keyword = _PyPegen_expect_token(p, 528)) // token='lambda' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9597 | && |
| 9598 | (a = lambda_params_rule(p), 1) // lambda_params? |
| 9599 | && |
| 9600 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 9601 | && |
| 9602 | (b = expression_rule(p)) // expression |
| 9603 | ) |
| 9604 | { |
| 9605 | D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
| 9606 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9607 | if (_token == NULL) { |
| 9608 | D(p->level--); |
| 9609 | return NULL; |
| 9610 | } |
| 9611 | int _end_lineno = _token->end_lineno; |
| 9612 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9613 | int _end_col_offset = _token->end_col_offset; |
| 9614 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 9615 | _res = _Py_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9616 | if (_res == NULL && PyErr_Occurred()) { |
| 9617 | p->error_indicator = 1; |
| 9618 | D(p->level--); |
| 9619 | return NULL; |
| 9620 | } |
| 9621 | goto done; |
| 9622 | } |
| 9623 | p->mark = _mark; |
| 9624 | D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ', |
| 9625 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
| 9626 | } |
| 9627 | _res = NULL; |
| 9628 | done: |
| 9629 | D(p->level--); |
| 9630 | return _res; |
| 9631 | } |
| 9632 | |
| 9633 | // lambda_params: invalid_lambda_parameters | lambda_parameters |
| 9634 | static arguments_ty |
| 9635 | lambda_params_rule(Parser *p) |
| 9636 | { |
| 9637 | D(p->level++); |
| 9638 | if (p->error_indicator) { |
| 9639 | D(p->level--); |
| 9640 | return NULL; |
| 9641 | } |
| 9642 | arguments_ty _res = NULL; |
| 9643 | int _mark = p->mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 9644 | if (p->call_invalid_rules) { // invalid_lambda_parameters |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9645 | if (p->error_indicator) { |
| 9646 | D(p->level--); |
| 9647 | return NULL; |
| 9648 | } |
| 9649 | D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters")); |
| 9650 | void *invalid_lambda_parameters_var; |
| 9651 | if ( |
| 9652 | (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters |
| 9653 | ) |
| 9654 | { |
| 9655 | D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters")); |
| 9656 | _res = invalid_lambda_parameters_var; |
| 9657 | goto done; |
| 9658 | } |
| 9659 | p->mark = _mark; |
| 9660 | D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ', |
| 9661 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters")); |
| 9662 | } |
| 9663 | { // lambda_parameters |
| 9664 | if (p->error_indicator) { |
| 9665 | D(p->level--); |
| 9666 | return NULL; |
| 9667 | } |
| 9668 | D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters")); |
| 9669 | arguments_ty lambda_parameters_var; |
| 9670 | if ( |
| 9671 | (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters |
| 9672 | ) |
| 9673 | { |
| 9674 | D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters")); |
| 9675 | _res = lambda_parameters_var; |
| 9676 | goto done; |
| 9677 | } |
| 9678 | p->mark = _mark; |
| 9679 | D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ', |
| 9680 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters")); |
| 9681 | } |
| 9682 | _res = NULL; |
| 9683 | done: |
| 9684 | D(p->level--); |
| 9685 | return _res; |
| 9686 | } |
| 9687 | |
| 9688 | // lambda_parameters: |
| 9689 | // | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
| 9690 | // | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
| 9691 | // | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
| 9692 | // | lambda_param_with_default+ lambda_star_etc? |
| 9693 | // | lambda_star_etc |
| 9694 | static arguments_ty |
| 9695 | lambda_parameters_rule(Parser *p) |
| 9696 | { |
| 9697 | D(p->level++); |
| 9698 | if (p->error_indicator) { |
| 9699 | D(p->level--); |
| 9700 | return NULL; |
| 9701 | } |
| 9702 | arguments_ty _res = NULL; |
| 9703 | int _mark = p->mark; |
| 9704 | { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
| 9705 | if (p->error_indicator) { |
| 9706 | D(p->level--); |
| 9707 | return NULL; |
| 9708 | } |
| 9709 | 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?")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9710 | asdl_arg_seq* a; |
| 9711 | asdl_arg_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9712 | asdl_seq * c; |
| 9713 | void *d; |
| 9714 | if ( |
| 9715 | (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default |
| 9716 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9717 | (b = (asdl_arg_seq*)_loop0_90_rule(p)) // lambda_param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9718 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9719 | (c = _loop0_91_rule(p)) // lambda_param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9720 | && |
| 9721 | (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
| 9722 | ) |
| 9723 | { |
| 9724 | 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?")); |
| 9725 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
| 9726 | if (_res == NULL && PyErr_Occurred()) { |
| 9727 | p->error_indicator = 1; |
| 9728 | D(p->level--); |
| 9729 | return NULL; |
| 9730 | } |
| 9731 | goto done; |
| 9732 | } |
| 9733 | p->mark = _mark; |
| 9734 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9735 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); |
| 9736 | } |
| 9737 | { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
| 9738 | if (p->error_indicator) { |
| 9739 | D(p->level--); |
| 9740 | return NULL; |
| 9741 | } |
| 9742 | 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?")); |
| 9743 | SlashWithDefault* a; |
| 9744 | asdl_seq * b; |
| 9745 | void *c; |
| 9746 | if ( |
| 9747 | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
| 9748 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9749 | (b = _loop0_92_rule(p)) // lambda_param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9750 | && |
| 9751 | (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
| 9752 | ) |
| 9753 | { |
| 9754 | 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?")); |
| 9755 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
| 9756 | if (_res == NULL && PyErr_Occurred()) { |
| 9757 | p->error_indicator = 1; |
| 9758 | D(p->level--); |
| 9759 | return NULL; |
| 9760 | } |
| 9761 | goto done; |
| 9762 | } |
| 9763 | p->mark = _mark; |
| 9764 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9765 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); |
| 9766 | } |
| 9767 | { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
| 9768 | if (p->error_indicator) { |
| 9769 | D(p->level--); |
| 9770 | return NULL; |
| 9771 | } |
| 9772 | 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?")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9773 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9774 | asdl_seq * b; |
| 9775 | void *c; |
| 9776 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9777 | (a = (asdl_arg_seq*)_loop1_93_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9778 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9779 | (b = _loop0_94_rule(p)) // lambda_param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9780 | && |
| 9781 | (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
| 9782 | ) |
| 9783 | { |
| 9784 | 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?")); |
| 9785 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
| 9786 | if (_res == NULL && PyErr_Occurred()) { |
| 9787 | p->error_indicator = 1; |
| 9788 | D(p->level--); |
| 9789 | return NULL; |
| 9790 | } |
| 9791 | goto done; |
| 9792 | } |
| 9793 | p->mark = _mark; |
| 9794 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9795 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); |
| 9796 | } |
| 9797 | { // lambda_param_with_default+ lambda_star_etc? |
| 9798 | if (p->error_indicator) { |
| 9799 | D(p->level--); |
| 9800 | return NULL; |
| 9801 | } |
| 9802 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
| 9803 | asdl_seq * a; |
| 9804 | void *b; |
| 9805 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9806 | (a = _loop1_95_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9807 | && |
| 9808 | (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
| 9809 | ) |
| 9810 | { |
| 9811 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
| 9812 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
| 9813 | if (_res == NULL && PyErr_Occurred()) { |
| 9814 | p->error_indicator = 1; |
| 9815 | D(p->level--); |
| 9816 | return NULL; |
| 9817 | } |
| 9818 | goto done; |
| 9819 | } |
| 9820 | p->mark = _mark; |
| 9821 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9822 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
| 9823 | } |
| 9824 | { // lambda_star_etc |
| 9825 | if (p->error_indicator) { |
| 9826 | D(p->level--); |
| 9827 | return NULL; |
| 9828 | } |
| 9829 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); |
| 9830 | StarEtc* a; |
| 9831 | if ( |
| 9832 | (a = lambda_star_etc_rule(p)) // lambda_star_etc |
| 9833 | ) |
| 9834 | { |
| 9835 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); |
| 9836 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
| 9837 | if (_res == NULL && PyErr_Occurred()) { |
| 9838 | p->error_indicator = 1; |
| 9839 | D(p->level--); |
| 9840 | return NULL; |
| 9841 | } |
| 9842 | goto done; |
| 9843 | } |
| 9844 | p->mark = _mark; |
| 9845 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9846 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc")); |
| 9847 | } |
| 9848 | _res = NULL; |
| 9849 | done: |
| 9850 | D(p->level--); |
| 9851 | return _res; |
| 9852 | } |
| 9853 | |
| 9854 | // lambda_slash_no_default: |
| 9855 | // | lambda_param_no_default+ '/' ',' |
| 9856 | // | lambda_param_no_default+ '/' &':' |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9857 | static asdl_arg_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9858 | lambda_slash_no_default_rule(Parser *p) |
| 9859 | { |
| 9860 | D(p->level++); |
| 9861 | if (p->error_indicator) { |
| 9862 | D(p->level--); |
| 9863 | return NULL; |
| 9864 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9865 | asdl_arg_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9866 | int _mark = p->mark; |
| 9867 | { // lambda_param_no_default+ '/' ',' |
| 9868 | if (p->error_indicator) { |
| 9869 | D(p->level--); |
| 9870 | return NULL; |
| 9871 | } |
| 9872 | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
| 9873 | Token * _literal; |
| 9874 | Token * _literal_1; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9875 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9876 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9877 | (a = (asdl_arg_seq*)_loop1_96_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9878 | && |
| 9879 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 9880 | && |
| 9881 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 9882 | ) |
| 9883 | { |
| 9884 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
| 9885 | _res = a; |
| 9886 | if (_res == NULL && PyErr_Occurred()) { |
| 9887 | p->error_indicator = 1; |
| 9888 | D(p->level--); |
| 9889 | return NULL; |
| 9890 | } |
| 9891 | goto done; |
| 9892 | } |
| 9893 | p->mark = _mark; |
| 9894 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 9895 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
| 9896 | } |
| 9897 | { // lambda_param_no_default+ '/' &':' |
| 9898 | if (p->error_indicator) { |
| 9899 | D(p->level--); |
| 9900 | return NULL; |
| 9901 | } |
| 9902 | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
| 9903 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9904 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9905 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9906 | (a = (asdl_arg_seq*)_loop1_97_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9907 | && |
| 9908 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 9909 | && |
| 9910 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 9911 | ) |
| 9912 | { |
| 9913 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
| 9914 | _res = a; |
| 9915 | if (_res == NULL && PyErr_Occurred()) { |
| 9916 | p->error_indicator = 1; |
| 9917 | D(p->level--); |
| 9918 | return NULL; |
| 9919 | } |
| 9920 | goto done; |
| 9921 | } |
| 9922 | p->mark = _mark; |
| 9923 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 9924 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
| 9925 | } |
| 9926 | _res = NULL; |
| 9927 | done: |
| 9928 | D(p->level--); |
| 9929 | return _res; |
| 9930 | } |
| 9931 | |
| 9932 | // lambda_slash_with_default: |
| 9933 | // | lambda_param_no_default* lambda_param_with_default+ '/' ',' |
| 9934 | // | lambda_param_no_default* lambda_param_with_default+ '/' &':' |
| 9935 | static SlashWithDefault* |
| 9936 | lambda_slash_with_default_rule(Parser *p) |
| 9937 | { |
| 9938 | D(p->level++); |
| 9939 | if (p->error_indicator) { |
| 9940 | D(p->level--); |
| 9941 | return NULL; |
| 9942 | } |
| 9943 | SlashWithDefault* _res = NULL; |
| 9944 | int _mark = p->mark; |
| 9945 | { // lambda_param_no_default* lambda_param_with_default+ '/' ',' |
| 9946 | if (p->error_indicator) { |
| 9947 | D(p->level--); |
| 9948 | return NULL; |
| 9949 | } |
| 9950 | 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+ '/' ','")); |
| 9951 | Token * _literal; |
| 9952 | Token * _literal_1; |
| 9953 | asdl_seq * a; |
| 9954 | asdl_seq * b; |
| 9955 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9956 | (a = _loop0_98_rule(p)) // lambda_param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9957 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9958 | (b = _loop1_99_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9959 | && |
| 9960 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 9961 | && |
| 9962 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 9963 | ) |
| 9964 | { |
| 9965 | 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+ '/' ','")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9966 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9967 | if (_res == NULL && PyErr_Occurred()) { |
| 9968 | p->error_indicator = 1; |
| 9969 | D(p->level--); |
| 9970 | return NULL; |
| 9971 | } |
| 9972 | goto done; |
| 9973 | } |
| 9974 | p->mark = _mark; |
| 9975 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 9976 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); |
| 9977 | } |
| 9978 | { // lambda_param_no_default* lambda_param_with_default+ '/' &':' |
| 9979 | if (p->error_indicator) { |
| 9980 | D(p->level--); |
| 9981 | return NULL; |
| 9982 | } |
| 9983 | 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+ '/' &':'")); |
| 9984 | Token * _literal; |
| 9985 | asdl_seq * a; |
| 9986 | asdl_seq * b; |
| 9987 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9988 | (a = _loop0_100_rule(p)) // lambda_param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9989 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9990 | (b = _loop1_101_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9991 | && |
| 9992 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 9993 | && |
| 9994 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 9995 | ) |
| 9996 | { |
| 9997 | 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+ '/' &':'")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9998 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9999 | if (_res == NULL && PyErr_Occurred()) { |
| 10000 | p->error_indicator = 1; |
| 10001 | D(p->level--); |
| 10002 | return NULL; |
| 10003 | } |
| 10004 | goto done; |
| 10005 | } |
| 10006 | p->mark = _mark; |
| 10007 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10008 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); |
| 10009 | } |
| 10010 | _res = NULL; |
| 10011 | done: |
| 10012 | D(p->level--); |
| 10013 | return _res; |
| 10014 | } |
| 10015 | |
| 10016 | // lambda_star_etc: |
| 10017 | // | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
| 10018 | // | '*' ',' lambda_param_maybe_default+ lambda_kwds? |
| 10019 | // | lambda_kwds |
| 10020 | // | invalid_lambda_star_etc |
| 10021 | static StarEtc* |
| 10022 | lambda_star_etc_rule(Parser *p) |
| 10023 | { |
| 10024 | D(p->level++); |
| 10025 | if (p->error_indicator) { |
| 10026 | D(p->level--); |
| 10027 | return NULL; |
| 10028 | } |
| 10029 | StarEtc* _res = NULL; |
| 10030 | int _mark = p->mark; |
| 10031 | { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
| 10032 | if (p->error_indicator) { |
| 10033 | D(p->level--); |
| 10034 | return NULL; |
| 10035 | } |
| 10036 | 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?")); |
| 10037 | Token * _literal; |
| 10038 | arg_ty a; |
| 10039 | asdl_seq * b; |
| 10040 | void *c; |
| 10041 | if ( |
| 10042 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 10043 | && |
| 10044 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 10045 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10046 | (b = _loop0_102_rule(p)) // lambda_param_maybe_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10047 | && |
| 10048 | (c = lambda_kwds_rule(p), 1) // lambda_kwds? |
| 10049 | ) |
| 10050 | { |
| 10051 | 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?")); |
| 10052 | _res = _PyPegen_star_etc ( p , a , b , c ); |
| 10053 | if (_res == NULL && PyErr_Occurred()) { |
| 10054 | p->error_indicator = 1; |
| 10055 | D(p->level--); |
| 10056 | return NULL; |
| 10057 | } |
| 10058 | goto done; |
| 10059 | } |
| 10060 | p->mark = _mark; |
| 10061 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 10062 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); |
| 10063 | } |
| 10064 | { // '*' ',' lambda_param_maybe_default+ lambda_kwds? |
| 10065 | if (p->error_indicator) { |
| 10066 | D(p->level--); |
| 10067 | return NULL; |
| 10068 | } |
| 10069 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
| 10070 | Token * _literal; |
| 10071 | Token * _literal_1; |
| 10072 | asdl_seq * b; |
| 10073 | void *c; |
| 10074 | if ( |
| 10075 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 10076 | && |
| 10077 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 10078 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10079 | (b = _loop1_103_rule(p)) // lambda_param_maybe_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10080 | && |
| 10081 | (c = lambda_kwds_rule(p), 1) // lambda_kwds? |
| 10082 | ) |
| 10083 | { |
| 10084 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
| 10085 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
| 10086 | if (_res == NULL && PyErr_Occurred()) { |
| 10087 | p->error_indicator = 1; |
| 10088 | D(p->level--); |
| 10089 | return NULL; |
| 10090 | } |
| 10091 | goto done; |
| 10092 | } |
| 10093 | p->mark = _mark; |
| 10094 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 10095 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
| 10096 | } |
| 10097 | { // lambda_kwds |
| 10098 | if (p->error_indicator) { |
| 10099 | D(p->level--); |
| 10100 | return NULL; |
| 10101 | } |
| 10102 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); |
| 10103 | arg_ty a; |
| 10104 | if ( |
| 10105 | (a = lambda_kwds_rule(p)) // lambda_kwds |
| 10106 | ) |
| 10107 | { |
| 10108 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); |
| 10109 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
| 10110 | if (_res == NULL && PyErr_Occurred()) { |
| 10111 | p->error_indicator = 1; |
| 10112 | D(p->level--); |
| 10113 | return NULL; |
| 10114 | } |
| 10115 | goto done; |
| 10116 | } |
| 10117 | p->mark = _mark; |
| 10118 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 10119 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds")); |
| 10120 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 10121 | if (p->call_invalid_rules) { // invalid_lambda_star_etc |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10122 | if (p->error_indicator) { |
| 10123 | D(p->level--); |
| 10124 | return NULL; |
| 10125 | } |
| 10126 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); |
| 10127 | void *invalid_lambda_star_etc_var; |
| 10128 | if ( |
| 10129 | (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc |
| 10130 | ) |
| 10131 | { |
| 10132 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); |
| 10133 | _res = invalid_lambda_star_etc_var; |
| 10134 | goto done; |
| 10135 | } |
| 10136 | p->mark = _mark; |
| 10137 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 10138 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc")); |
| 10139 | } |
| 10140 | _res = NULL; |
| 10141 | done: |
| 10142 | D(p->level--); |
| 10143 | return _res; |
| 10144 | } |
| 10145 | |
| 10146 | // lambda_kwds: '**' lambda_param_no_default |
| 10147 | static arg_ty |
| 10148 | lambda_kwds_rule(Parser *p) |
| 10149 | { |
| 10150 | D(p->level++); |
| 10151 | if (p->error_indicator) { |
| 10152 | D(p->level--); |
| 10153 | return NULL; |
| 10154 | } |
| 10155 | arg_ty _res = NULL; |
| 10156 | int _mark = p->mark; |
| 10157 | { // '**' lambda_param_no_default |
| 10158 | if (p->error_indicator) { |
| 10159 | D(p->level--); |
| 10160 | return NULL; |
| 10161 | } |
| 10162 | D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); |
| 10163 | Token * _literal; |
| 10164 | arg_ty a; |
| 10165 | if ( |
| 10166 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 10167 | && |
| 10168 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 10169 | ) |
| 10170 | { |
| 10171 | D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); |
| 10172 | _res = a; |
| 10173 | if (_res == NULL && PyErr_Occurred()) { |
| 10174 | p->error_indicator = 1; |
| 10175 | D(p->level--); |
| 10176 | return NULL; |
| 10177 | } |
| 10178 | goto done; |
| 10179 | } |
| 10180 | p->mark = _mark; |
| 10181 | D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
| 10182 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default")); |
| 10183 | } |
| 10184 | _res = NULL; |
| 10185 | done: |
| 10186 | D(p->level--); |
| 10187 | return _res; |
| 10188 | } |
| 10189 | |
| 10190 | // lambda_param_no_default: lambda_param ',' | lambda_param &':' |
| 10191 | static arg_ty |
| 10192 | lambda_param_no_default_rule(Parser *p) |
| 10193 | { |
| 10194 | D(p->level++); |
| 10195 | if (p->error_indicator) { |
| 10196 | D(p->level--); |
| 10197 | return NULL; |
| 10198 | } |
| 10199 | arg_ty _res = NULL; |
| 10200 | int _mark = p->mark; |
| 10201 | { // lambda_param ',' |
| 10202 | if (p->error_indicator) { |
| 10203 | D(p->level--); |
| 10204 | return NULL; |
| 10205 | } |
| 10206 | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); |
| 10207 | Token * _literal; |
| 10208 | arg_ty a; |
| 10209 | if ( |
| 10210 | (a = lambda_param_rule(p)) // lambda_param |
| 10211 | && |
| 10212 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 10213 | ) |
| 10214 | { |
| 10215 | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); |
| 10216 | _res = a; |
| 10217 | if (_res == NULL && PyErr_Occurred()) { |
| 10218 | p->error_indicator = 1; |
| 10219 | D(p->level--); |
| 10220 | return NULL; |
| 10221 | } |
| 10222 | goto done; |
| 10223 | } |
| 10224 | p->mark = _mark; |
| 10225 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10226 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','")); |
| 10227 | } |
| 10228 | { // lambda_param &':' |
| 10229 | if (p->error_indicator) { |
| 10230 | D(p->level--); |
| 10231 | return NULL; |
| 10232 | } |
| 10233 | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
| 10234 | arg_ty a; |
| 10235 | if ( |
| 10236 | (a = lambda_param_rule(p)) // lambda_param |
| 10237 | && |
| 10238 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 10239 | ) |
| 10240 | { |
| 10241 | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
| 10242 | _res = a; |
| 10243 | if (_res == NULL && PyErr_Occurred()) { |
| 10244 | p->error_indicator = 1; |
| 10245 | D(p->level--); |
| 10246 | return NULL; |
| 10247 | } |
| 10248 | goto done; |
| 10249 | } |
| 10250 | p->mark = _mark; |
| 10251 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10252 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'")); |
| 10253 | } |
| 10254 | _res = NULL; |
| 10255 | done: |
| 10256 | D(p->level--); |
| 10257 | return _res; |
| 10258 | } |
| 10259 | |
| 10260 | // lambda_param_with_default: lambda_param default ',' | lambda_param default &':' |
| 10261 | static NameDefaultPair* |
| 10262 | lambda_param_with_default_rule(Parser *p) |
| 10263 | { |
| 10264 | D(p->level++); |
| 10265 | if (p->error_indicator) { |
| 10266 | D(p->level--); |
| 10267 | return NULL; |
| 10268 | } |
| 10269 | NameDefaultPair* _res = NULL; |
| 10270 | int _mark = p->mark; |
| 10271 | { // lambda_param default ',' |
| 10272 | if (p->error_indicator) { |
| 10273 | D(p->level--); |
| 10274 | return NULL; |
| 10275 | } |
| 10276 | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); |
| 10277 | Token * _literal; |
| 10278 | arg_ty a; |
| 10279 | expr_ty c; |
| 10280 | if ( |
| 10281 | (a = lambda_param_rule(p)) // lambda_param |
| 10282 | && |
| 10283 | (c = default_rule(p)) // default |
| 10284 | && |
| 10285 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 10286 | ) |
| 10287 | { |
| 10288 | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); |
| 10289 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 10290 | if (_res == NULL && PyErr_Occurred()) { |
| 10291 | p->error_indicator = 1; |
| 10292 | D(p->level--); |
| 10293 | return NULL; |
| 10294 | } |
| 10295 | goto done; |
| 10296 | } |
| 10297 | p->mark = _mark; |
| 10298 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10299 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','")); |
| 10300 | } |
| 10301 | { // lambda_param default &':' |
| 10302 | if (p->error_indicator) { |
| 10303 | D(p->level--); |
| 10304 | return NULL; |
| 10305 | } |
| 10306 | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); |
| 10307 | arg_ty a; |
| 10308 | expr_ty c; |
| 10309 | if ( |
| 10310 | (a = lambda_param_rule(p)) // lambda_param |
| 10311 | && |
| 10312 | (c = default_rule(p)) // default |
| 10313 | && |
| 10314 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 10315 | ) |
| 10316 | { |
| 10317 | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); |
| 10318 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 10319 | if (_res == NULL && PyErr_Occurred()) { |
| 10320 | p->error_indicator = 1; |
| 10321 | D(p->level--); |
| 10322 | return NULL; |
| 10323 | } |
| 10324 | goto done; |
| 10325 | } |
| 10326 | p->mark = _mark; |
| 10327 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10328 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'")); |
| 10329 | } |
| 10330 | _res = NULL; |
| 10331 | done: |
| 10332 | D(p->level--); |
| 10333 | return _res; |
| 10334 | } |
| 10335 | |
| 10336 | // lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' |
| 10337 | static NameDefaultPair* |
| 10338 | lambda_param_maybe_default_rule(Parser *p) |
| 10339 | { |
| 10340 | D(p->level++); |
| 10341 | if (p->error_indicator) { |
| 10342 | D(p->level--); |
| 10343 | return NULL; |
| 10344 | } |
| 10345 | NameDefaultPair* _res = NULL; |
| 10346 | int _mark = p->mark; |
| 10347 | { // lambda_param default? ',' |
| 10348 | if (p->error_indicator) { |
| 10349 | D(p->level--); |
| 10350 | return NULL; |
| 10351 | } |
| 10352 | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); |
| 10353 | Token * _literal; |
| 10354 | arg_ty a; |
| 10355 | void *c; |
| 10356 | if ( |
| 10357 | (a = lambda_param_rule(p)) // lambda_param |
| 10358 | && |
| 10359 | (c = default_rule(p), 1) // default? |
| 10360 | && |
| 10361 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 10362 | ) |
| 10363 | { |
| 10364 | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); |
| 10365 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 10366 | if (_res == NULL && PyErr_Occurred()) { |
| 10367 | p->error_indicator = 1; |
| 10368 | D(p->level--); |
| 10369 | return NULL; |
| 10370 | } |
| 10371 | goto done; |
| 10372 | } |
| 10373 | p->mark = _mark; |
| 10374 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10375 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','")); |
| 10376 | } |
| 10377 | { // lambda_param default? &':' |
| 10378 | if (p->error_indicator) { |
| 10379 | D(p->level--); |
| 10380 | return NULL; |
| 10381 | } |
| 10382 | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); |
| 10383 | arg_ty a; |
| 10384 | void *c; |
| 10385 | if ( |
| 10386 | (a = lambda_param_rule(p)) // lambda_param |
| 10387 | && |
| 10388 | (c = default_rule(p), 1) // default? |
| 10389 | && |
| 10390 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 10391 | ) |
| 10392 | { |
| 10393 | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); |
| 10394 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 10395 | if (_res == NULL && PyErr_Occurred()) { |
| 10396 | p->error_indicator = 1; |
| 10397 | D(p->level--); |
| 10398 | return NULL; |
| 10399 | } |
| 10400 | goto done; |
| 10401 | } |
| 10402 | p->mark = _mark; |
| 10403 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10404 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'")); |
| 10405 | } |
| 10406 | _res = NULL; |
| 10407 | done: |
| 10408 | D(p->level--); |
| 10409 | return _res; |
| 10410 | } |
| 10411 | |
| 10412 | // lambda_param: NAME |
| 10413 | static arg_ty |
| 10414 | lambda_param_rule(Parser *p) |
| 10415 | { |
| 10416 | D(p->level++); |
| 10417 | if (p->error_indicator) { |
| 10418 | D(p->level--); |
| 10419 | return NULL; |
| 10420 | } |
| 10421 | arg_ty _res = NULL; |
| 10422 | int _mark = p->mark; |
| 10423 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10424 | p->error_indicator = 1; |
| 10425 | D(p->level--); |
| 10426 | return NULL; |
| 10427 | } |
| 10428 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10429 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10430 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10431 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10432 | { // NAME |
| 10433 | if (p->error_indicator) { |
| 10434 | D(p->level--); |
| 10435 | return NULL; |
| 10436 | } |
| 10437 | D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 10438 | expr_ty a; |
| 10439 | if ( |
| 10440 | (a = _PyPegen_name_token(p)) // NAME |
| 10441 | ) |
| 10442 | { |
| 10443 | D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 10444 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10445 | if (_token == NULL) { |
| 10446 | D(p->level--); |
| 10447 | return NULL; |
| 10448 | } |
| 10449 | int _end_lineno = _token->end_lineno; |
| 10450 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10451 | int _end_col_offset = _token->end_col_offset; |
| 10452 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10453 | _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA ); |
| 10454 | if (_res == NULL && PyErr_Occurred()) { |
| 10455 | p->error_indicator = 1; |
| 10456 | D(p->level--); |
| 10457 | return NULL; |
| 10458 | } |
| 10459 | goto done; |
| 10460 | } |
| 10461 | p->mark = _mark; |
| 10462 | D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ', |
| 10463 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 10464 | } |
| 10465 | _res = NULL; |
| 10466 | done: |
| 10467 | D(p->level--); |
| 10468 | return _res; |
| 10469 | } |
| 10470 | |
| 10471 | // disjunction: conjunction (('or' conjunction))+ | conjunction |
| 10472 | static expr_ty |
| 10473 | disjunction_rule(Parser *p) |
| 10474 | { |
| 10475 | D(p->level++); |
| 10476 | if (p->error_indicator) { |
| 10477 | D(p->level--); |
| 10478 | return NULL; |
| 10479 | } |
| 10480 | expr_ty _res = NULL; |
| 10481 | if (_PyPegen_is_memoized(p, disjunction_type, &_res)) { |
| 10482 | D(p->level--); |
| 10483 | return _res; |
| 10484 | } |
| 10485 | int _mark = p->mark; |
| 10486 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10487 | p->error_indicator = 1; |
| 10488 | D(p->level--); |
| 10489 | return NULL; |
| 10490 | } |
| 10491 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10492 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10493 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10494 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10495 | { // conjunction (('or' conjunction))+ |
| 10496 | if (p->error_indicator) { |
| 10497 | D(p->level--); |
| 10498 | return NULL; |
| 10499 | } |
| 10500 | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); |
| 10501 | expr_ty a; |
| 10502 | asdl_seq * b; |
| 10503 | if ( |
| 10504 | (a = conjunction_rule(p)) // conjunction |
| 10505 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10506 | (b = _loop1_104_rule(p)) // (('or' conjunction))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10507 | ) |
| 10508 | { |
| 10509 | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); |
| 10510 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10511 | if (_token == NULL) { |
| 10512 | D(p->level--); |
| 10513 | return NULL; |
| 10514 | } |
| 10515 | int _end_lineno = _token->end_lineno; |
| 10516 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10517 | int _end_col_offset = _token->end_col_offset; |
| 10518 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 10519 | _res = _Py_BoolOp ( Or , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10520 | if (_res == NULL && PyErr_Occurred()) { |
| 10521 | p->error_indicator = 1; |
| 10522 | D(p->level--); |
| 10523 | return NULL; |
| 10524 | } |
| 10525 | goto done; |
| 10526 | } |
| 10527 | p->mark = _mark; |
| 10528 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 10529 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+")); |
| 10530 | } |
| 10531 | { // conjunction |
| 10532 | if (p->error_indicator) { |
| 10533 | D(p->level--); |
| 10534 | return NULL; |
| 10535 | } |
| 10536 | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction")); |
| 10537 | expr_ty conjunction_var; |
| 10538 | if ( |
| 10539 | (conjunction_var = conjunction_rule(p)) // conjunction |
| 10540 | ) |
| 10541 | { |
| 10542 | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction")); |
| 10543 | _res = conjunction_var; |
| 10544 | goto done; |
| 10545 | } |
| 10546 | p->mark = _mark; |
| 10547 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 10548 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction")); |
| 10549 | } |
| 10550 | _res = NULL; |
| 10551 | done: |
| 10552 | _PyPegen_insert_memo(p, _mark, disjunction_type, _res); |
| 10553 | D(p->level--); |
| 10554 | return _res; |
| 10555 | } |
| 10556 | |
| 10557 | // conjunction: inversion (('and' inversion))+ | inversion |
| 10558 | static expr_ty |
| 10559 | conjunction_rule(Parser *p) |
| 10560 | { |
| 10561 | D(p->level++); |
| 10562 | if (p->error_indicator) { |
| 10563 | D(p->level--); |
| 10564 | return NULL; |
| 10565 | } |
| 10566 | expr_ty _res = NULL; |
| 10567 | if (_PyPegen_is_memoized(p, conjunction_type, &_res)) { |
| 10568 | D(p->level--); |
| 10569 | return _res; |
| 10570 | } |
| 10571 | int _mark = p->mark; |
| 10572 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10573 | p->error_indicator = 1; |
| 10574 | D(p->level--); |
| 10575 | return NULL; |
| 10576 | } |
| 10577 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10578 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10579 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10580 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10581 | { // inversion (('and' inversion))+ |
| 10582 | if (p->error_indicator) { |
| 10583 | D(p->level--); |
| 10584 | return NULL; |
| 10585 | } |
| 10586 | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); |
| 10587 | expr_ty a; |
| 10588 | asdl_seq * b; |
| 10589 | if ( |
| 10590 | (a = inversion_rule(p)) // inversion |
| 10591 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10592 | (b = _loop1_105_rule(p)) // (('and' inversion))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10593 | ) |
| 10594 | { |
| 10595 | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); |
| 10596 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10597 | if (_token == NULL) { |
| 10598 | D(p->level--); |
| 10599 | return NULL; |
| 10600 | } |
| 10601 | int _end_lineno = _token->end_lineno; |
| 10602 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10603 | int _end_col_offset = _token->end_col_offset; |
| 10604 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 10605 | _res = _Py_BoolOp ( And , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10606 | if (_res == NULL && PyErr_Occurred()) { |
| 10607 | p->error_indicator = 1; |
| 10608 | D(p->level--); |
| 10609 | return NULL; |
| 10610 | } |
| 10611 | goto done; |
| 10612 | } |
| 10613 | p->mark = _mark; |
| 10614 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 10615 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+")); |
| 10616 | } |
| 10617 | { // inversion |
| 10618 | if (p->error_indicator) { |
| 10619 | D(p->level--); |
| 10620 | return NULL; |
| 10621 | } |
| 10622 | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion")); |
| 10623 | expr_ty inversion_var; |
| 10624 | if ( |
| 10625 | (inversion_var = inversion_rule(p)) // inversion |
| 10626 | ) |
| 10627 | { |
| 10628 | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion")); |
| 10629 | _res = inversion_var; |
| 10630 | goto done; |
| 10631 | } |
| 10632 | p->mark = _mark; |
| 10633 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 10634 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion")); |
| 10635 | } |
| 10636 | _res = NULL; |
| 10637 | done: |
| 10638 | _PyPegen_insert_memo(p, _mark, conjunction_type, _res); |
| 10639 | D(p->level--); |
| 10640 | return _res; |
| 10641 | } |
| 10642 | |
| 10643 | // inversion: 'not' inversion | comparison |
| 10644 | static expr_ty |
| 10645 | inversion_rule(Parser *p) |
| 10646 | { |
| 10647 | D(p->level++); |
| 10648 | if (p->error_indicator) { |
| 10649 | D(p->level--); |
| 10650 | return NULL; |
| 10651 | } |
| 10652 | expr_ty _res = NULL; |
| 10653 | if (_PyPegen_is_memoized(p, inversion_type, &_res)) { |
| 10654 | D(p->level--); |
| 10655 | return _res; |
| 10656 | } |
| 10657 | int _mark = p->mark; |
| 10658 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10659 | p->error_indicator = 1; |
| 10660 | D(p->level--); |
| 10661 | return NULL; |
| 10662 | } |
| 10663 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10664 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10665 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10666 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10667 | { // 'not' inversion |
| 10668 | if (p->error_indicator) { |
| 10669 | D(p->level--); |
| 10670 | return NULL; |
| 10671 | } |
| 10672 | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion")); |
| 10673 | Token * _keyword; |
| 10674 | expr_ty a; |
| 10675 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10676 | (_keyword = _PyPegen_expect_token(p, 529)) // token='not' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10677 | && |
| 10678 | (a = inversion_rule(p)) // inversion |
| 10679 | ) |
| 10680 | { |
| 10681 | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion")); |
| 10682 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10683 | if (_token == NULL) { |
| 10684 | D(p->level--); |
| 10685 | return NULL; |
| 10686 | } |
| 10687 | int _end_lineno = _token->end_lineno; |
| 10688 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10689 | int _end_col_offset = _token->end_col_offset; |
| 10690 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10691 | _res = _Py_UnaryOp ( Not , a , EXTRA ); |
| 10692 | if (_res == NULL && PyErr_Occurred()) { |
| 10693 | p->error_indicator = 1; |
| 10694 | D(p->level--); |
| 10695 | return NULL; |
| 10696 | } |
| 10697 | goto done; |
| 10698 | } |
| 10699 | p->mark = _mark; |
| 10700 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
| 10701 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion")); |
| 10702 | } |
| 10703 | { // comparison |
| 10704 | if (p->error_indicator) { |
| 10705 | D(p->level--); |
| 10706 | return NULL; |
| 10707 | } |
| 10708 | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison")); |
| 10709 | expr_ty comparison_var; |
| 10710 | if ( |
| 10711 | (comparison_var = comparison_rule(p)) // comparison |
| 10712 | ) |
| 10713 | { |
| 10714 | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison")); |
| 10715 | _res = comparison_var; |
| 10716 | goto done; |
| 10717 | } |
| 10718 | p->mark = _mark; |
| 10719 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
| 10720 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison")); |
| 10721 | } |
| 10722 | _res = NULL; |
| 10723 | done: |
| 10724 | _PyPegen_insert_memo(p, _mark, inversion_type, _res); |
| 10725 | D(p->level--); |
| 10726 | return _res; |
| 10727 | } |
| 10728 | |
| 10729 | // comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or |
| 10730 | static expr_ty |
| 10731 | comparison_rule(Parser *p) |
| 10732 | { |
| 10733 | D(p->level++); |
| 10734 | if (p->error_indicator) { |
| 10735 | D(p->level--); |
| 10736 | return NULL; |
| 10737 | } |
| 10738 | expr_ty _res = NULL; |
| 10739 | int _mark = p->mark; |
| 10740 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10741 | p->error_indicator = 1; |
| 10742 | D(p->level--); |
| 10743 | return NULL; |
| 10744 | } |
| 10745 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10746 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10747 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10748 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10749 | { // bitwise_or compare_op_bitwise_or_pair+ |
| 10750 | if (p->error_indicator) { |
| 10751 | D(p->level--); |
| 10752 | return NULL; |
| 10753 | } |
| 10754 | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
| 10755 | expr_ty a; |
| 10756 | asdl_seq * b; |
| 10757 | if ( |
| 10758 | (a = bitwise_or_rule(p)) // bitwise_or |
| 10759 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10760 | (b = _loop1_106_rule(p)) // compare_op_bitwise_or_pair+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10761 | ) |
| 10762 | { |
| 10763 | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
| 10764 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10765 | if (_token == NULL) { |
| 10766 | D(p->level--); |
| 10767 | return NULL; |
| 10768 | } |
| 10769 | int _end_lineno = _token->end_lineno; |
| 10770 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10771 | int _end_col_offset = _token->end_col_offset; |
| 10772 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 10773 | _res = _Py_Compare ( a , CHECK ( asdl_int_seq * , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_exprs ( p , b ) ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10774 | if (_res == NULL && PyErr_Occurred()) { |
| 10775 | p->error_indicator = 1; |
| 10776 | D(p->level--); |
| 10777 | return NULL; |
| 10778 | } |
| 10779 | goto done; |
| 10780 | } |
| 10781 | p->mark = _mark; |
| 10782 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
| 10783 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
| 10784 | } |
| 10785 | { // bitwise_or |
| 10786 | if (p->error_indicator) { |
| 10787 | D(p->level--); |
| 10788 | return NULL; |
| 10789 | } |
| 10790 | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or")); |
| 10791 | expr_ty bitwise_or_var; |
| 10792 | if ( |
| 10793 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
| 10794 | ) |
| 10795 | { |
| 10796 | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or")); |
| 10797 | _res = bitwise_or_var; |
| 10798 | goto done; |
| 10799 | } |
| 10800 | p->mark = _mark; |
| 10801 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
| 10802 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or")); |
| 10803 | } |
| 10804 | _res = NULL; |
| 10805 | done: |
| 10806 | D(p->level--); |
| 10807 | return _res; |
| 10808 | } |
| 10809 | |
| 10810 | // compare_op_bitwise_or_pair: |
| 10811 | // | eq_bitwise_or |
| 10812 | // | noteq_bitwise_or |
| 10813 | // | lte_bitwise_or |
| 10814 | // | lt_bitwise_or |
| 10815 | // | gte_bitwise_or |
| 10816 | // | gt_bitwise_or |
| 10817 | // | notin_bitwise_or |
| 10818 | // | in_bitwise_or |
| 10819 | // | isnot_bitwise_or |
| 10820 | // | is_bitwise_or |
| 10821 | static CmpopExprPair* |
| 10822 | compare_op_bitwise_or_pair_rule(Parser *p) |
| 10823 | { |
| 10824 | D(p->level++); |
| 10825 | if (p->error_indicator) { |
| 10826 | D(p->level--); |
| 10827 | return NULL; |
| 10828 | } |
| 10829 | CmpopExprPair* _res = NULL; |
| 10830 | int _mark = p->mark; |
| 10831 | { // eq_bitwise_or |
| 10832 | if (p->error_indicator) { |
| 10833 | D(p->level--); |
| 10834 | return NULL; |
| 10835 | } |
| 10836 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); |
| 10837 | CmpopExprPair* eq_bitwise_or_var; |
| 10838 | if ( |
| 10839 | (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or |
| 10840 | ) |
| 10841 | { |
| 10842 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); |
| 10843 | _res = eq_bitwise_or_var; |
| 10844 | goto done; |
| 10845 | } |
| 10846 | p->mark = _mark; |
| 10847 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10848 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or")); |
| 10849 | } |
| 10850 | { // noteq_bitwise_or |
| 10851 | if (p->error_indicator) { |
| 10852 | D(p->level--); |
| 10853 | return NULL; |
| 10854 | } |
| 10855 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); |
| 10856 | CmpopExprPair* noteq_bitwise_or_var; |
| 10857 | if ( |
| 10858 | (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or |
| 10859 | ) |
| 10860 | { |
| 10861 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); |
| 10862 | _res = noteq_bitwise_or_var; |
| 10863 | goto done; |
| 10864 | } |
| 10865 | p->mark = _mark; |
| 10866 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10867 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or")); |
| 10868 | } |
| 10869 | { // lte_bitwise_or |
| 10870 | if (p->error_indicator) { |
| 10871 | D(p->level--); |
| 10872 | return NULL; |
| 10873 | } |
| 10874 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); |
| 10875 | CmpopExprPair* lte_bitwise_or_var; |
| 10876 | if ( |
| 10877 | (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or |
| 10878 | ) |
| 10879 | { |
| 10880 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); |
| 10881 | _res = lte_bitwise_or_var; |
| 10882 | goto done; |
| 10883 | } |
| 10884 | p->mark = _mark; |
| 10885 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10886 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or")); |
| 10887 | } |
| 10888 | { // lt_bitwise_or |
| 10889 | if (p->error_indicator) { |
| 10890 | D(p->level--); |
| 10891 | return NULL; |
| 10892 | } |
| 10893 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); |
| 10894 | CmpopExprPair* lt_bitwise_or_var; |
| 10895 | if ( |
| 10896 | (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or |
| 10897 | ) |
| 10898 | { |
| 10899 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); |
| 10900 | _res = lt_bitwise_or_var; |
| 10901 | goto done; |
| 10902 | } |
| 10903 | p->mark = _mark; |
| 10904 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10905 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or")); |
| 10906 | } |
| 10907 | { // gte_bitwise_or |
| 10908 | if (p->error_indicator) { |
| 10909 | D(p->level--); |
| 10910 | return NULL; |
| 10911 | } |
| 10912 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); |
| 10913 | CmpopExprPair* gte_bitwise_or_var; |
| 10914 | if ( |
| 10915 | (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or |
| 10916 | ) |
| 10917 | { |
| 10918 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); |
| 10919 | _res = gte_bitwise_or_var; |
| 10920 | goto done; |
| 10921 | } |
| 10922 | p->mark = _mark; |
| 10923 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10924 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or")); |
| 10925 | } |
| 10926 | { // gt_bitwise_or |
| 10927 | if (p->error_indicator) { |
| 10928 | D(p->level--); |
| 10929 | return NULL; |
| 10930 | } |
| 10931 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); |
| 10932 | CmpopExprPair* gt_bitwise_or_var; |
| 10933 | if ( |
| 10934 | (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or |
| 10935 | ) |
| 10936 | { |
| 10937 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); |
| 10938 | _res = gt_bitwise_or_var; |
| 10939 | goto done; |
| 10940 | } |
| 10941 | p->mark = _mark; |
| 10942 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10943 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or")); |
| 10944 | } |
| 10945 | { // notin_bitwise_or |
| 10946 | if (p->error_indicator) { |
| 10947 | D(p->level--); |
| 10948 | return NULL; |
| 10949 | } |
| 10950 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); |
| 10951 | CmpopExprPair* notin_bitwise_or_var; |
| 10952 | if ( |
| 10953 | (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or |
| 10954 | ) |
| 10955 | { |
| 10956 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); |
| 10957 | _res = notin_bitwise_or_var; |
| 10958 | goto done; |
| 10959 | } |
| 10960 | p->mark = _mark; |
| 10961 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10962 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or")); |
| 10963 | } |
| 10964 | { // in_bitwise_or |
| 10965 | if (p->error_indicator) { |
| 10966 | D(p->level--); |
| 10967 | return NULL; |
| 10968 | } |
| 10969 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); |
| 10970 | CmpopExprPair* in_bitwise_or_var; |
| 10971 | if ( |
| 10972 | (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or |
| 10973 | ) |
| 10974 | { |
| 10975 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); |
| 10976 | _res = in_bitwise_or_var; |
| 10977 | goto done; |
| 10978 | } |
| 10979 | p->mark = _mark; |
| 10980 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10981 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or")); |
| 10982 | } |
| 10983 | { // isnot_bitwise_or |
| 10984 | if (p->error_indicator) { |
| 10985 | D(p->level--); |
| 10986 | return NULL; |
| 10987 | } |
| 10988 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); |
| 10989 | CmpopExprPair* isnot_bitwise_or_var; |
| 10990 | if ( |
| 10991 | (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or |
| 10992 | ) |
| 10993 | { |
| 10994 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); |
| 10995 | _res = isnot_bitwise_or_var; |
| 10996 | goto done; |
| 10997 | } |
| 10998 | p->mark = _mark; |
| 10999 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11000 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or")); |
| 11001 | } |
| 11002 | { // is_bitwise_or |
| 11003 | if (p->error_indicator) { |
| 11004 | D(p->level--); |
| 11005 | return NULL; |
| 11006 | } |
| 11007 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); |
| 11008 | CmpopExprPair* is_bitwise_or_var; |
| 11009 | if ( |
| 11010 | (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or |
| 11011 | ) |
| 11012 | { |
| 11013 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); |
| 11014 | _res = is_bitwise_or_var; |
| 11015 | goto done; |
| 11016 | } |
| 11017 | p->mark = _mark; |
| 11018 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11019 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or")); |
| 11020 | } |
| 11021 | _res = NULL; |
| 11022 | done: |
| 11023 | D(p->level--); |
| 11024 | return _res; |
| 11025 | } |
| 11026 | |
| 11027 | // eq_bitwise_or: '==' bitwise_or |
| 11028 | static CmpopExprPair* |
| 11029 | eq_bitwise_or_rule(Parser *p) |
| 11030 | { |
| 11031 | D(p->level++); |
| 11032 | if (p->error_indicator) { |
| 11033 | D(p->level--); |
| 11034 | return NULL; |
| 11035 | } |
| 11036 | CmpopExprPair* _res = NULL; |
| 11037 | int _mark = p->mark; |
| 11038 | { // '==' bitwise_or |
| 11039 | if (p->error_indicator) { |
| 11040 | D(p->level--); |
| 11041 | return NULL; |
| 11042 | } |
| 11043 | D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); |
| 11044 | Token * _literal; |
| 11045 | expr_ty a; |
| 11046 | if ( |
| 11047 | (_literal = _PyPegen_expect_token(p, 27)) // token='==' |
| 11048 | && |
| 11049 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11050 | ) |
| 11051 | { |
| 11052 | D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); |
| 11053 | _res = _PyPegen_cmpop_expr_pair ( p , Eq , a ); |
| 11054 | if (_res == NULL && PyErr_Occurred()) { |
| 11055 | p->error_indicator = 1; |
| 11056 | D(p->level--); |
| 11057 | return NULL; |
| 11058 | } |
| 11059 | goto done; |
| 11060 | } |
| 11061 | p->mark = _mark; |
| 11062 | D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11063 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or")); |
| 11064 | } |
| 11065 | _res = NULL; |
| 11066 | done: |
| 11067 | D(p->level--); |
| 11068 | return _res; |
| 11069 | } |
| 11070 | |
| 11071 | // noteq_bitwise_or: ('!=') bitwise_or |
| 11072 | static CmpopExprPair* |
| 11073 | noteq_bitwise_or_rule(Parser *p) |
| 11074 | { |
| 11075 | D(p->level++); |
| 11076 | if (p->error_indicator) { |
| 11077 | D(p->level--); |
| 11078 | return NULL; |
| 11079 | } |
| 11080 | CmpopExprPair* _res = NULL; |
| 11081 | int _mark = p->mark; |
| 11082 | { // ('!=') bitwise_or |
| 11083 | if (p->error_indicator) { |
| 11084 | D(p->level--); |
| 11085 | return NULL; |
| 11086 | } |
| 11087 | D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11088 | void *_tmp_107_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11089 | expr_ty a; |
| 11090 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11091 | (_tmp_107_var = _tmp_107_rule(p)) // '!=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11092 | && |
| 11093 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11094 | ) |
| 11095 | { |
| 11096 | D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); |
| 11097 | _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a ); |
| 11098 | if (_res == NULL && PyErr_Occurred()) { |
| 11099 | p->error_indicator = 1; |
| 11100 | D(p->level--); |
| 11101 | return NULL; |
| 11102 | } |
| 11103 | goto done; |
| 11104 | } |
| 11105 | p->mark = _mark; |
| 11106 | D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11107 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or")); |
| 11108 | } |
| 11109 | _res = NULL; |
| 11110 | done: |
| 11111 | D(p->level--); |
| 11112 | return _res; |
| 11113 | } |
| 11114 | |
| 11115 | // lte_bitwise_or: '<=' bitwise_or |
| 11116 | static CmpopExprPair* |
| 11117 | lte_bitwise_or_rule(Parser *p) |
| 11118 | { |
| 11119 | D(p->level++); |
| 11120 | if (p->error_indicator) { |
| 11121 | D(p->level--); |
| 11122 | return NULL; |
| 11123 | } |
| 11124 | CmpopExprPair* _res = NULL; |
| 11125 | int _mark = p->mark; |
| 11126 | { // '<=' bitwise_or |
| 11127 | if (p->error_indicator) { |
| 11128 | D(p->level--); |
| 11129 | return NULL; |
| 11130 | } |
| 11131 | D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); |
| 11132 | Token * _literal; |
| 11133 | expr_ty a; |
| 11134 | if ( |
| 11135 | (_literal = _PyPegen_expect_token(p, 29)) // token='<=' |
| 11136 | && |
| 11137 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11138 | ) |
| 11139 | { |
| 11140 | D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); |
| 11141 | _res = _PyPegen_cmpop_expr_pair ( p , LtE , a ); |
| 11142 | if (_res == NULL && PyErr_Occurred()) { |
| 11143 | p->error_indicator = 1; |
| 11144 | D(p->level--); |
| 11145 | return NULL; |
| 11146 | } |
| 11147 | goto done; |
| 11148 | } |
| 11149 | p->mark = _mark; |
| 11150 | D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11151 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or")); |
| 11152 | } |
| 11153 | _res = NULL; |
| 11154 | done: |
| 11155 | D(p->level--); |
| 11156 | return _res; |
| 11157 | } |
| 11158 | |
| 11159 | // lt_bitwise_or: '<' bitwise_or |
| 11160 | static CmpopExprPair* |
| 11161 | lt_bitwise_or_rule(Parser *p) |
| 11162 | { |
| 11163 | D(p->level++); |
| 11164 | if (p->error_indicator) { |
| 11165 | D(p->level--); |
| 11166 | return NULL; |
| 11167 | } |
| 11168 | CmpopExprPair* _res = NULL; |
| 11169 | int _mark = p->mark; |
| 11170 | { // '<' bitwise_or |
| 11171 | if (p->error_indicator) { |
| 11172 | D(p->level--); |
| 11173 | return NULL; |
| 11174 | } |
| 11175 | D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); |
| 11176 | Token * _literal; |
| 11177 | expr_ty a; |
| 11178 | if ( |
| 11179 | (_literal = _PyPegen_expect_token(p, 20)) // token='<' |
| 11180 | && |
| 11181 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11182 | ) |
| 11183 | { |
| 11184 | D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); |
| 11185 | _res = _PyPegen_cmpop_expr_pair ( p , Lt , a ); |
| 11186 | if (_res == NULL && PyErr_Occurred()) { |
| 11187 | p->error_indicator = 1; |
| 11188 | D(p->level--); |
| 11189 | return NULL; |
| 11190 | } |
| 11191 | goto done; |
| 11192 | } |
| 11193 | p->mark = _mark; |
| 11194 | D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11195 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or")); |
| 11196 | } |
| 11197 | _res = NULL; |
| 11198 | done: |
| 11199 | D(p->level--); |
| 11200 | return _res; |
| 11201 | } |
| 11202 | |
| 11203 | // gte_bitwise_or: '>=' bitwise_or |
| 11204 | static CmpopExprPair* |
| 11205 | gte_bitwise_or_rule(Parser *p) |
| 11206 | { |
| 11207 | D(p->level++); |
| 11208 | if (p->error_indicator) { |
| 11209 | D(p->level--); |
| 11210 | return NULL; |
| 11211 | } |
| 11212 | CmpopExprPair* _res = NULL; |
| 11213 | int _mark = p->mark; |
| 11214 | { // '>=' bitwise_or |
| 11215 | if (p->error_indicator) { |
| 11216 | D(p->level--); |
| 11217 | return NULL; |
| 11218 | } |
| 11219 | D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); |
| 11220 | Token * _literal; |
| 11221 | expr_ty a; |
| 11222 | if ( |
| 11223 | (_literal = _PyPegen_expect_token(p, 30)) // token='>=' |
| 11224 | && |
| 11225 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11226 | ) |
| 11227 | { |
| 11228 | D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); |
| 11229 | _res = _PyPegen_cmpop_expr_pair ( p , GtE , a ); |
| 11230 | if (_res == NULL && PyErr_Occurred()) { |
| 11231 | p->error_indicator = 1; |
| 11232 | D(p->level--); |
| 11233 | return NULL; |
| 11234 | } |
| 11235 | goto done; |
| 11236 | } |
| 11237 | p->mark = _mark; |
| 11238 | D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11239 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or")); |
| 11240 | } |
| 11241 | _res = NULL; |
| 11242 | done: |
| 11243 | D(p->level--); |
| 11244 | return _res; |
| 11245 | } |
| 11246 | |
| 11247 | // gt_bitwise_or: '>' bitwise_or |
| 11248 | static CmpopExprPair* |
| 11249 | gt_bitwise_or_rule(Parser *p) |
| 11250 | { |
| 11251 | D(p->level++); |
| 11252 | if (p->error_indicator) { |
| 11253 | D(p->level--); |
| 11254 | return NULL; |
| 11255 | } |
| 11256 | CmpopExprPair* _res = NULL; |
| 11257 | int _mark = p->mark; |
| 11258 | { // '>' bitwise_or |
| 11259 | if (p->error_indicator) { |
| 11260 | D(p->level--); |
| 11261 | return NULL; |
| 11262 | } |
| 11263 | D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); |
| 11264 | Token * _literal; |
| 11265 | expr_ty a; |
| 11266 | if ( |
| 11267 | (_literal = _PyPegen_expect_token(p, 21)) // token='>' |
| 11268 | && |
| 11269 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11270 | ) |
| 11271 | { |
| 11272 | D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); |
| 11273 | _res = _PyPegen_cmpop_expr_pair ( p , Gt , a ); |
| 11274 | if (_res == NULL && PyErr_Occurred()) { |
| 11275 | p->error_indicator = 1; |
| 11276 | D(p->level--); |
| 11277 | return NULL; |
| 11278 | } |
| 11279 | goto done; |
| 11280 | } |
| 11281 | p->mark = _mark; |
| 11282 | D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11283 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or")); |
| 11284 | } |
| 11285 | _res = NULL; |
| 11286 | done: |
| 11287 | D(p->level--); |
| 11288 | return _res; |
| 11289 | } |
| 11290 | |
| 11291 | // notin_bitwise_or: 'not' 'in' bitwise_or |
| 11292 | static CmpopExprPair* |
| 11293 | notin_bitwise_or_rule(Parser *p) |
| 11294 | { |
| 11295 | D(p->level++); |
| 11296 | if (p->error_indicator) { |
| 11297 | D(p->level--); |
| 11298 | return NULL; |
| 11299 | } |
| 11300 | CmpopExprPair* _res = NULL; |
| 11301 | int _mark = p->mark; |
| 11302 | { // 'not' 'in' bitwise_or |
| 11303 | if (p->error_indicator) { |
| 11304 | D(p->level--); |
| 11305 | return NULL; |
| 11306 | } |
| 11307 | D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); |
| 11308 | Token * _keyword; |
| 11309 | Token * _keyword_1; |
| 11310 | expr_ty a; |
| 11311 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11312 | (_keyword = _PyPegen_expect_token(p, 529)) // token='not' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11313 | && |
| 11314 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 11315 | && |
| 11316 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11317 | ) |
| 11318 | { |
| 11319 | D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); |
| 11320 | _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a ); |
| 11321 | if (_res == NULL && PyErr_Occurred()) { |
| 11322 | p->error_indicator = 1; |
| 11323 | D(p->level--); |
| 11324 | return NULL; |
| 11325 | } |
| 11326 | goto done; |
| 11327 | } |
| 11328 | p->mark = _mark; |
| 11329 | D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11330 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or")); |
| 11331 | } |
| 11332 | _res = NULL; |
| 11333 | done: |
| 11334 | D(p->level--); |
| 11335 | return _res; |
| 11336 | } |
| 11337 | |
| 11338 | // in_bitwise_or: 'in' bitwise_or |
| 11339 | static CmpopExprPair* |
| 11340 | in_bitwise_or_rule(Parser *p) |
| 11341 | { |
| 11342 | D(p->level++); |
| 11343 | if (p->error_indicator) { |
| 11344 | D(p->level--); |
| 11345 | return NULL; |
| 11346 | } |
| 11347 | CmpopExprPair* _res = NULL; |
| 11348 | int _mark = p->mark; |
| 11349 | { // 'in' bitwise_or |
| 11350 | if (p->error_indicator) { |
| 11351 | D(p->level--); |
| 11352 | return NULL; |
| 11353 | } |
| 11354 | D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); |
| 11355 | Token * _keyword; |
| 11356 | expr_ty a; |
| 11357 | if ( |
| 11358 | (_keyword = _PyPegen_expect_token(p, 518)) // token='in' |
| 11359 | && |
| 11360 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11361 | ) |
| 11362 | { |
| 11363 | D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); |
| 11364 | _res = _PyPegen_cmpop_expr_pair ( p , In , a ); |
| 11365 | if (_res == NULL && PyErr_Occurred()) { |
| 11366 | p->error_indicator = 1; |
| 11367 | D(p->level--); |
| 11368 | return NULL; |
| 11369 | } |
| 11370 | goto done; |
| 11371 | } |
| 11372 | p->mark = _mark; |
| 11373 | D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11374 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or")); |
| 11375 | } |
| 11376 | _res = NULL; |
| 11377 | done: |
| 11378 | D(p->level--); |
| 11379 | return _res; |
| 11380 | } |
| 11381 | |
| 11382 | // isnot_bitwise_or: 'is' 'not' bitwise_or |
| 11383 | static CmpopExprPair* |
| 11384 | isnot_bitwise_or_rule(Parser *p) |
| 11385 | { |
| 11386 | D(p->level++); |
| 11387 | if (p->error_indicator) { |
| 11388 | D(p->level--); |
| 11389 | return NULL; |
| 11390 | } |
| 11391 | CmpopExprPair* _res = NULL; |
| 11392 | int _mark = p->mark; |
| 11393 | { // 'is' 'not' bitwise_or |
| 11394 | if (p->error_indicator) { |
| 11395 | D(p->level--); |
| 11396 | return NULL; |
| 11397 | } |
| 11398 | D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); |
| 11399 | Token * _keyword; |
| 11400 | Token * _keyword_1; |
| 11401 | expr_ty a; |
| 11402 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11403 | (_keyword = _PyPegen_expect_token(p, 530)) // token='is' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11404 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11405 | (_keyword_1 = _PyPegen_expect_token(p, 529)) // token='not' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11406 | && |
| 11407 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11408 | ) |
| 11409 | { |
| 11410 | D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); |
| 11411 | _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a ); |
| 11412 | if (_res == NULL && PyErr_Occurred()) { |
| 11413 | p->error_indicator = 1; |
| 11414 | D(p->level--); |
| 11415 | return NULL; |
| 11416 | } |
| 11417 | goto done; |
| 11418 | } |
| 11419 | p->mark = _mark; |
| 11420 | D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11421 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or")); |
| 11422 | } |
| 11423 | _res = NULL; |
| 11424 | done: |
| 11425 | D(p->level--); |
| 11426 | return _res; |
| 11427 | } |
| 11428 | |
| 11429 | // is_bitwise_or: 'is' bitwise_or |
| 11430 | static CmpopExprPair* |
| 11431 | is_bitwise_or_rule(Parser *p) |
| 11432 | { |
| 11433 | D(p->level++); |
| 11434 | if (p->error_indicator) { |
| 11435 | D(p->level--); |
| 11436 | return NULL; |
| 11437 | } |
| 11438 | CmpopExprPair* _res = NULL; |
| 11439 | int _mark = p->mark; |
| 11440 | { // 'is' bitwise_or |
| 11441 | if (p->error_indicator) { |
| 11442 | D(p->level--); |
| 11443 | return NULL; |
| 11444 | } |
| 11445 | D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); |
| 11446 | Token * _keyword; |
| 11447 | expr_ty a; |
| 11448 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11449 | (_keyword = _PyPegen_expect_token(p, 530)) // token='is' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11450 | && |
| 11451 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11452 | ) |
| 11453 | { |
| 11454 | D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); |
| 11455 | _res = _PyPegen_cmpop_expr_pair ( p , Is , a ); |
| 11456 | if (_res == NULL && PyErr_Occurred()) { |
| 11457 | p->error_indicator = 1; |
| 11458 | D(p->level--); |
| 11459 | return NULL; |
| 11460 | } |
| 11461 | goto done; |
| 11462 | } |
| 11463 | p->mark = _mark; |
| 11464 | D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11465 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or")); |
| 11466 | } |
| 11467 | _res = NULL; |
| 11468 | done: |
| 11469 | D(p->level--); |
| 11470 | return _res; |
| 11471 | } |
| 11472 | |
| 11473 | // Left-recursive |
| 11474 | // bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor |
| 11475 | static expr_ty bitwise_or_raw(Parser *); |
| 11476 | static expr_ty |
| 11477 | bitwise_or_rule(Parser *p) |
| 11478 | { |
| 11479 | D(p->level++); |
| 11480 | expr_ty _res = NULL; |
| 11481 | if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) { |
| 11482 | D(p->level--); |
| 11483 | return _res; |
| 11484 | } |
| 11485 | int _mark = p->mark; |
| 11486 | int _resmark = p->mark; |
| 11487 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11488 | int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); |
| 11489 | if (tmpvar_2) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11490 | D(p->level--); |
| 11491 | return _res; |
| 11492 | } |
| 11493 | p->mark = _mark; |
| 11494 | void *_raw = bitwise_or_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11495 | if (p->error_indicator) |
| 11496 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11497 | if (_raw == NULL || p->mark <= _resmark) |
| 11498 | break; |
| 11499 | _resmark = p->mark; |
| 11500 | _res = _raw; |
| 11501 | } |
| 11502 | p->mark = _resmark; |
| 11503 | D(p->level--); |
| 11504 | return _res; |
| 11505 | } |
| 11506 | static expr_ty |
| 11507 | bitwise_or_raw(Parser *p) |
| 11508 | { |
| 11509 | D(p->level++); |
| 11510 | if (p->error_indicator) { |
| 11511 | D(p->level--); |
| 11512 | return NULL; |
| 11513 | } |
| 11514 | expr_ty _res = NULL; |
| 11515 | int _mark = p->mark; |
| 11516 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11517 | p->error_indicator = 1; |
| 11518 | D(p->level--); |
| 11519 | return NULL; |
| 11520 | } |
| 11521 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11522 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11523 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11524 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 11525 | { // bitwise_or '|' bitwise_xor |
| 11526 | if (p->error_indicator) { |
| 11527 | D(p->level--); |
| 11528 | return NULL; |
| 11529 | } |
| 11530 | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
| 11531 | Token * _literal; |
| 11532 | expr_ty a; |
| 11533 | expr_ty b; |
| 11534 | if ( |
| 11535 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11536 | && |
| 11537 | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
| 11538 | && |
| 11539 | (b = bitwise_xor_rule(p)) // bitwise_xor |
| 11540 | ) |
| 11541 | { |
| 11542 | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
| 11543 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11544 | if (_token == NULL) { |
| 11545 | D(p->level--); |
| 11546 | return NULL; |
| 11547 | } |
| 11548 | int _end_lineno = _token->end_lineno; |
| 11549 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11550 | int _end_col_offset = _token->end_col_offset; |
| 11551 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11552 | _res = _Py_BinOp ( a , BitOr , b , EXTRA ); |
| 11553 | if (_res == NULL && PyErr_Occurred()) { |
| 11554 | p->error_indicator = 1; |
| 11555 | D(p->level--); |
| 11556 | return NULL; |
| 11557 | } |
| 11558 | goto done; |
| 11559 | } |
| 11560 | p->mark = _mark; |
| 11561 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11562 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
| 11563 | } |
| 11564 | { // bitwise_xor |
| 11565 | if (p->error_indicator) { |
| 11566 | D(p->level--); |
| 11567 | return NULL; |
| 11568 | } |
| 11569 | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); |
| 11570 | expr_ty bitwise_xor_var; |
| 11571 | if ( |
| 11572 | (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor |
| 11573 | ) |
| 11574 | { |
| 11575 | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); |
| 11576 | _res = bitwise_xor_var; |
| 11577 | goto done; |
| 11578 | } |
| 11579 | p->mark = _mark; |
| 11580 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11581 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor")); |
| 11582 | } |
| 11583 | _res = NULL; |
| 11584 | done: |
| 11585 | D(p->level--); |
| 11586 | return _res; |
| 11587 | } |
| 11588 | |
| 11589 | // Left-recursive |
| 11590 | // bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and |
| 11591 | static expr_ty bitwise_xor_raw(Parser *); |
| 11592 | static expr_ty |
| 11593 | bitwise_xor_rule(Parser *p) |
| 11594 | { |
| 11595 | D(p->level++); |
| 11596 | expr_ty _res = NULL; |
| 11597 | if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) { |
| 11598 | D(p->level--); |
| 11599 | return _res; |
| 11600 | } |
| 11601 | int _mark = p->mark; |
| 11602 | int _resmark = p->mark; |
| 11603 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11604 | int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); |
| 11605 | if (tmpvar_3) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11606 | D(p->level--); |
| 11607 | return _res; |
| 11608 | } |
| 11609 | p->mark = _mark; |
| 11610 | void *_raw = bitwise_xor_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11611 | if (p->error_indicator) |
| 11612 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11613 | if (_raw == NULL || p->mark <= _resmark) |
| 11614 | break; |
| 11615 | _resmark = p->mark; |
| 11616 | _res = _raw; |
| 11617 | } |
| 11618 | p->mark = _resmark; |
| 11619 | D(p->level--); |
| 11620 | return _res; |
| 11621 | } |
| 11622 | static expr_ty |
| 11623 | bitwise_xor_raw(Parser *p) |
| 11624 | { |
| 11625 | D(p->level++); |
| 11626 | if (p->error_indicator) { |
| 11627 | D(p->level--); |
| 11628 | return NULL; |
| 11629 | } |
| 11630 | expr_ty _res = NULL; |
| 11631 | int _mark = p->mark; |
| 11632 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11633 | p->error_indicator = 1; |
| 11634 | D(p->level--); |
| 11635 | return NULL; |
| 11636 | } |
| 11637 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11638 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11639 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11640 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 11641 | { // bitwise_xor '^' bitwise_and |
| 11642 | if (p->error_indicator) { |
| 11643 | D(p->level--); |
| 11644 | return NULL; |
| 11645 | } |
| 11646 | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
| 11647 | Token * _literal; |
| 11648 | expr_ty a; |
| 11649 | expr_ty b; |
| 11650 | if ( |
| 11651 | (a = bitwise_xor_rule(p)) // bitwise_xor |
| 11652 | && |
| 11653 | (_literal = _PyPegen_expect_token(p, 32)) // token='^' |
| 11654 | && |
| 11655 | (b = bitwise_and_rule(p)) // bitwise_and |
| 11656 | ) |
| 11657 | { |
| 11658 | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
| 11659 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11660 | if (_token == NULL) { |
| 11661 | D(p->level--); |
| 11662 | return NULL; |
| 11663 | } |
| 11664 | int _end_lineno = _token->end_lineno; |
| 11665 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11666 | int _end_col_offset = _token->end_col_offset; |
| 11667 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11668 | _res = _Py_BinOp ( a , BitXor , b , EXTRA ); |
| 11669 | if (_res == NULL && PyErr_Occurred()) { |
| 11670 | p->error_indicator = 1; |
| 11671 | D(p->level--); |
| 11672 | return NULL; |
| 11673 | } |
| 11674 | goto done; |
| 11675 | } |
| 11676 | p->mark = _mark; |
| 11677 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
| 11678 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
| 11679 | } |
| 11680 | { // bitwise_and |
| 11681 | if (p->error_indicator) { |
| 11682 | D(p->level--); |
| 11683 | return NULL; |
| 11684 | } |
| 11685 | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and")); |
| 11686 | expr_ty bitwise_and_var; |
| 11687 | if ( |
| 11688 | (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and |
| 11689 | ) |
| 11690 | { |
| 11691 | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and")); |
| 11692 | _res = bitwise_and_var; |
| 11693 | goto done; |
| 11694 | } |
| 11695 | p->mark = _mark; |
| 11696 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
| 11697 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and")); |
| 11698 | } |
| 11699 | _res = NULL; |
| 11700 | done: |
| 11701 | D(p->level--); |
| 11702 | return _res; |
| 11703 | } |
| 11704 | |
| 11705 | // Left-recursive |
| 11706 | // bitwise_and: bitwise_and '&' shift_expr | shift_expr |
| 11707 | static expr_ty bitwise_and_raw(Parser *); |
| 11708 | static expr_ty |
| 11709 | bitwise_and_rule(Parser *p) |
| 11710 | { |
| 11711 | D(p->level++); |
| 11712 | expr_ty _res = NULL; |
| 11713 | if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) { |
| 11714 | D(p->level--); |
| 11715 | return _res; |
| 11716 | } |
| 11717 | int _mark = p->mark; |
| 11718 | int _resmark = p->mark; |
| 11719 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11720 | int tmpvar_4 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); |
| 11721 | if (tmpvar_4) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11722 | D(p->level--); |
| 11723 | return _res; |
| 11724 | } |
| 11725 | p->mark = _mark; |
| 11726 | void *_raw = bitwise_and_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11727 | if (p->error_indicator) |
| 11728 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11729 | if (_raw == NULL || p->mark <= _resmark) |
| 11730 | break; |
| 11731 | _resmark = p->mark; |
| 11732 | _res = _raw; |
| 11733 | } |
| 11734 | p->mark = _resmark; |
| 11735 | D(p->level--); |
| 11736 | return _res; |
| 11737 | } |
| 11738 | static expr_ty |
| 11739 | bitwise_and_raw(Parser *p) |
| 11740 | { |
| 11741 | D(p->level++); |
| 11742 | if (p->error_indicator) { |
| 11743 | D(p->level--); |
| 11744 | return NULL; |
| 11745 | } |
| 11746 | expr_ty _res = NULL; |
| 11747 | int _mark = p->mark; |
| 11748 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11749 | p->error_indicator = 1; |
| 11750 | D(p->level--); |
| 11751 | return NULL; |
| 11752 | } |
| 11753 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11754 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11755 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11756 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 11757 | { // bitwise_and '&' shift_expr |
| 11758 | if (p->error_indicator) { |
| 11759 | D(p->level--); |
| 11760 | return NULL; |
| 11761 | } |
| 11762 | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); |
| 11763 | Token * _literal; |
| 11764 | expr_ty a; |
| 11765 | expr_ty b; |
| 11766 | if ( |
| 11767 | (a = bitwise_and_rule(p)) // bitwise_and |
| 11768 | && |
| 11769 | (_literal = _PyPegen_expect_token(p, 19)) // token='&' |
| 11770 | && |
| 11771 | (b = shift_expr_rule(p)) // shift_expr |
| 11772 | ) |
| 11773 | { |
| 11774 | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); |
| 11775 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11776 | if (_token == NULL) { |
| 11777 | D(p->level--); |
| 11778 | return NULL; |
| 11779 | } |
| 11780 | int _end_lineno = _token->end_lineno; |
| 11781 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11782 | int _end_col_offset = _token->end_col_offset; |
| 11783 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11784 | _res = _Py_BinOp ( a , BitAnd , b , EXTRA ); |
| 11785 | if (_res == NULL && PyErr_Occurred()) { |
| 11786 | p->error_indicator = 1; |
| 11787 | D(p->level--); |
| 11788 | return NULL; |
| 11789 | } |
| 11790 | goto done; |
| 11791 | } |
| 11792 | p->mark = _mark; |
| 11793 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
| 11794 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr")); |
| 11795 | } |
| 11796 | { // shift_expr |
| 11797 | if (p->error_indicator) { |
| 11798 | D(p->level--); |
| 11799 | return NULL; |
| 11800 | } |
| 11801 | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr")); |
| 11802 | expr_ty shift_expr_var; |
| 11803 | if ( |
| 11804 | (shift_expr_var = shift_expr_rule(p)) // shift_expr |
| 11805 | ) |
| 11806 | { |
| 11807 | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr")); |
| 11808 | _res = shift_expr_var; |
| 11809 | goto done; |
| 11810 | } |
| 11811 | p->mark = _mark; |
| 11812 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
| 11813 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr")); |
| 11814 | } |
| 11815 | _res = NULL; |
| 11816 | done: |
| 11817 | D(p->level--); |
| 11818 | return _res; |
| 11819 | } |
| 11820 | |
| 11821 | // Left-recursive |
| 11822 | // shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum |
| 11823 | static expr_ty shift_expr_raw(Parser *); |
| 11824 | static expr_ty |
| 11825 | shift_expr_rule(Parser *p) |
| 11826 | { |
| 11827 | D(p->level++); |
| 11828 | expr_ty _res = NULL; |
| 11829 | if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) { |
| 11830 | D(p->level--); |
| 11831 | return _res; |
| 11832 | } |
| 11833 | int _mark = p->mark; |
| 11834 | int _resmark = p->mark; |
| 11835 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11836 | int tmpvar_5 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); |
| 11837 | if (tmpvar_5) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11838 | D(p->level--); |
| 11839 | return _res; |
| 11840 | } |
| 11841 | p->mark = _mark; |
| 11842 | void *_raw = shift_expr_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11843 | if (p->error_indicator) |
| 11844 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11845 | if (_raw == NULL || p->mark <= _resmark) |
| 11846 | break; |
| 11847 | _resmark = p->mark; |
| 11848 | _res = _raw; |
| 11849 | } |
| 11850 | p->mark = _resmark; |
| 11851 | D(p->level--); |
| 11852 | return _res; |
| 11853 | } |
| 11854 | static expr_ty |
| 11855 | shift_expr_raw(Parser *p) |
| 11856 | { |
| 11857 | D(p->level++); |
| 11858 | if (p->error_indicator) { |
| 11859 | D(p->level--); |
| 11860 | return NULL; |
| 11861 | } |
| 11862 | expr_ty _res = NULL; |
| 11863 | int _mark = p->mark; |
| 11864 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11865 | p->error_indicator = 1; |
| 11866 | D(p->level--); |
| 11867 | return NULL; |
| 11868 | } |
| 11869 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11870 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11871 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11872 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 11873 | { // shift_expr '<<' sum |
| 11874 | if (p->error_indicator) { |
| 11875 | D(p->level--); |
| 11876 | return NULL; |
| 11877 | } |
| 11878 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); |
| 11879 | Token * _literal; |
| 11880 | expr_ty a; |
| 11881 | expr_ty b; |
| 11882 | if ( |
| 11883 | (a = shift_expr_rule(p)) // shift_expr |
| 11884 | && |
| 11885 | (_literal = _PyPegen_expect_token(p, 33)) // token='<<' |
| 11886 | && |
| 11887 | (b = sum_rule(p)) // sum |
| 11888 | ) |
| 11889 | { |
| 11890 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); |
| 11891 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11892 | if (_token == NULL) { |
| 11893 | D(p->level--); |
| 11894 | return NULL; |
| 11895 | } |
| 11896 | int _end_lineno = _token->end_lineno; |
| 11897 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11898 | int _end_col_offset = _token->end_col_offset; |
| 11899 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11900 | _res = _Py_BinOp ( a , LShift , b , EXTRA ); |
| 11901 | if (_res == NULL && PyErr_Occurred()) { |
| 11902 | p->error_indicator = 1; |
| 11903 | D(p->level--); |
| 11904 | return NULL; |
| 11905 | } |
| 11906 | goto done; |
| 11907 | } |
| 11908 | p->mark = _mark; |
| 11909 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11910 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum")); |
| 11911 | } |
| 11912 | { // shift_expr '>>' sum |
| 11913 | if (p->error_indicator) { |
| 11914 | D(p->level--); |
| 11915 | return NULL; |
| 11916 | } |
| 11917 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); |
| 11918 | Token * _literal; |
| 11919 | expr_ty a; |
| 11920 | expr_ty b; |
| 11921 | if ( |
| 11922 | (a = shift_expr_rule(p)) // shift_expr |
| 11923 | && |
| 11924 | (_literal = _PyPegen_expect_token(p, 34)) // token='>>' |
| 11925 | && |
| 11926 | (b = sum_rule(p)) // sum |
| 11927 | ) |
| 11928 | { |
| 11929 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); |
| 11930 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11931 | if (_token == NULL) { |
| 11932 | D(p->level--); |
| 11933 | return NULL; |
| 11934 | } |
| 11935 | int _end_lineno = _token->end_lineno; |
| 11936 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11937 | int _end_col_offset = _token->end_col_offset; |
| 11938 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11939 | _res = _Py_BinOp ( a , RShift , b , EXTRA ); |
| 11940 | if (_res == NULL && PyErr_Occurred()) { |
| 11941 | p->error_indicator = 1; |
| 11942 | D(p->level--); |
| 11943 | return NULL; |
| 11944 | } |
| 11945 | goto done; |
| 11946 | } |
| 11947 | p->mark = _mark; |
| 11948 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11949 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum")); |
| 11950 | } |
| 11951 | { // sum |
| 11952 | if (p->error_indicator) { |
| 11953 | D(p->level--); |
| 11954 | return NULL; |
| 11955 | } |
| 11956 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum")); |
| 11957 | expr_ty sum_var; |
| 11958 | if ( |
| 11959 | (sum_var = sum_rule(p)) // sum |
| 11960 | ) |
| 11961 | { |
| 11962 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum")); |
| 11963 | _res = sum_var; |
| 11964 | goto done; |
| 11965 | } |
| 11966 | p->mark = _mark; |
| 11967 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11968 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum")); |
| 11969 | } |
| 11970 | _res = NULL; |
| 11971 | done: |
| 11972 | D(p->level--); |
| 11973 | return _res; |
| 11974 | } |
| 11975 | |
| 11976 | // Left-recursive |
| 11977 | // sum: sum '+' term | sum '-' term | term |
| 11978 | static expr_ty sum_raw(Parser *); |
| 11979 | static expr_ty |
| 11980 | sum_rule(Parser *p) |
| 11981 | { |
| 11982 | D(p->level++); |
| 11983 | expr_ty _res = NULL; |
| 11984 | if (_PyPegen_is_memoized(p, sum_type, &_res)) { |
| 11985 | D(p->level--); |
| 11986 | return _res; |
| 11987 | } |
| 11988 | int _mark = p->mark; |
| 11989 | int _resmark = p->mark; |
| 11990 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11991 | int tmpvar_6 = _PyPegen_update_memo(p, _mark, sum_type, _res); |
| 11992 | if (tmpvar_6) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11993 | D(p->level--); |
| 11994 | return _res; |
| 11995 | } |
| 11996 | p->mark = _mark; |
| 11997 | void *_raw = sum_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11998 | if (p->error_indicator) |
| 11999 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12000 | if (_raw == NULL || p->mark <= _resmark) |
| 12001 | break; |
| 12002 | _resmark = p->mark; |
| 12003 | _res = _raw; |
| 12004 | } |
| 12005 | p->mark = _resmark; |
| 12006 | D(p->level--); |
| 12007 | return _res; |
| 12008 | } |
| 12009 | static expr_ty |
| 12010 | sum_raw(Parser *p) |
| 12011 | { |
| 12012 | D(p->level++); |
| 12013 | if (p->error_indicator) { |
| 12014 | D(p->level--); |
| 12015 | return NULL; |
| 12016 | } |
| 12017 | expr_ty _res = NULL; |
| 12018 | int _mark = p->mark; |
| 12019 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12020 | p->error_indicator = 1; |
| 12021 | D(p->level--); |
| 12022 | return NULL; |
| 12023 | } |
| 12024 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12025 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12026 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12027 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12028 | { // sum '+' term |
| 12029 | if (p->error_indicator) { |
| 12030 | D(p->level--); |
| 12031 | return NULL; |
| 12032 | } |
| 12033 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term")); |
| 12034 | Token * _literal; |
| 12035 | expr_ty a; |
| 12036 | expr_ty b; |
| 12037 | if ( |
| 12038 | (a = sum_rule(p)) // sum |
| 12039 | && |
| 12040 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
| 12041 | && |
| 12042 | (b = term_rule(p)) // term |
| 12043 | ) |
| 12044 | { |
| 12045 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term")); |
| 12046 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12047 | if (_token == NULL) { |
| 12048 | D(p->level--); |
| 12049 | return NULL; |
| 12050 | } |
| 12051 | int _end_lineno = _token->end_lineno; |
| 12052 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12053 | int _end_col_offset = _token->end_col_offset; |
| 12054 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12055 | _res = _Py_BinOp ( a , Add , b , EXTRA ); |
| 12056 | if (_res == NULL && PyErr_Occurred()) { |
| 12057 | p->error_indicator = 1; |
| 12058 | D(p->level--); |
| 12059 | return NULL; |
| 12060 | } |
| 12061 | goto done; |
| 12062 | } |
| 12063 | p->mark = _mark; |
| 12064 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 12065 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term")); |
| 12066 | } |
| 12067 | { // sum '-' term |
| 12068 | if (p->error_indicator) { |
| 12069 | D(p->level--); |
| 12070 | return NULL; |
| 12071 | } |
| 12072 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term")); |
| 12073 | Token * _literal; |
| 12074 | expr_ty a; |
| 12075 | expr_ty b; |
| 12076 | if ( |
| 12077 | (a = sum_rule(p)) // sum |
| 12078 | && |
| 12079 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 12080 | && |
| 12081 | (b = term_rule(p)) // term |
| 12082 | ) |
| 12083 | { |
| 12084 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term")); |
| 12085 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12086 | if (_token == NULL) { |
| 12087 | D(p->level--); |
| 12088 | return NULL; |
| 12089 | } |
| 12090 | int _end_lineno = _token->end_lineno; |
| 12091 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12092 | int _end_col_offset = _token->end_col_offset; |
| 12093 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12094 | _res = _Py_BinOp ( a , Sub , b , EXTRA ); |
| 12095 | if (_res == NULL && PyErr_Occurred()) { |
| 12096 | p->error_indicator = 1; |
| 12097 | D(p->level--); |
| 12098 | return NULL; |
| 12099 | } |
| 12100 | goto done; |
| 12101 | } |
| 12102 | p->mark = _mark; |
| 12103 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 12104 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term")); |
| 12105 | } |
| 12106 | { // term |
| 12107 | if (p->error_indicator) { |
| 12108 | D(p->level--); |
| 12109 | return NULL; |
| 12110 | } |
| 12111 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term")); |
| 12112 | expr_ty term_var; |
| 12113 | if ( |
| 12114 | (term_var = term_rule(p)) // term |
| 12115 | ) |
| 12116 | { |
| 12117 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term")); |
| 12118 | _res = term_var; |
| 12119 | goto done; |
| 12120 | } |
| 12121 | p->mark = _mark; |
| 12122 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 12123 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term")); |
| 12124 | } |
| 12125 | _res = NULL; |
| 12126 | done: |
| 12127 | D(p->level--); |
| 12128 | return _res; |
| 12129 | } |
| 12130 | |
| 12131 | // Left-recursive |
| 12132 | // term: |
| 12133 | // | term '*' factor |
| 12134 | // | term '/' factor |
| 12135 | // | term '//' factor |
| 12136 | // | term '%' factor |
| 12137 | // | term '@' factor |
| 12138 | // | factor |
| 12139 | static expr_ty term_raw(Parser *); |
| 12140 | static expr_ty |
| 12141 | term_rule(Parser *p) |
| 12142 | { |
| 12143 | D(p->level++); |
| 12144 | expr_ty _res = NULL; |
| 12145 | if (_PyPegen_is_memoized(p, term_type, &_res)) { |
| 12146 | D(p->level--); |
| 12147 | return _res; |
| 12148 | } |
| 12149 | int _mark = p->mark; |
| 12150 | int _resmark = p->mark; |
| 12151 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 12152 | int tmpvar_7 = _PyPegen_update_memo(p, _mark, term_type, _res); |
| 12153 | if (tmpvar_7) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12154 | D(p->level--); |
| 12155 | return _res; |
| 12156 | } |
| 12157 | p->mark = _mark; |
| 12158 | void *_raw = term_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 12159 | if (p->error_indicator) |
| 12160 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12161 | if (_raw == NULL || p->mark <= _resmark) |
| 12162 | break; |
| 12163 | _resmark = p->mark; |
| 12164 | _res = _raw; |
| 12165 | } |
| 12166 | p->mark = _resmark; |
| 12167 | D(p->level--); |
| 12168 | return _res; |
| 12169 | } |
| 12170 | static expr_ty |
| 12171 | term_raw(Parser *p) |
| 12172 | { |
| 12173 | D(p->level++); |
| 12174 | if (p->error_indicator) { |
| 12175 | D(p->level--); |
| 12176 | return NULL; |
| 12177 | } |
| 12178 | expr_ty _res = NULL; |
| 12179 | int _mark = p->mark; |
| 12180 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12181 | p->error_indicator = 1; |
| 12182 | D(p->level--); |
| 12183 | return NULL; |
| 12184 | } |
| 12185 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12186 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12187 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12188 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12189 | { // term '*' factor |
| 12190 | if (p->error_indicator) { |
| 12191 | D(p->level--); |
| 12192 | return NULL; |
| 12193 | } |
| 12194 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor")); |
| 12195 | Token * _literal; |
| 12196 | expr_ty a; |
| 12197 | expr_ty b; |
| 12198 | if ( |
| 12199 | (a = term_rule(p)) // term |
| 12200 | && |
| 12201 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 12202 | && |
| 12203 | (b = factor_rule(p)) // factor |
| 12204 | ) |
| 12205 | { |
| 12206 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor")); |
| 12207 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12208 | if (_token == NULL) { |
| 12209 | D(p->level--); |
| 12210 | return NULL; |
| 12211 | } |
| 12212 | int _end_lineno = _token->end_lineno; |
| 12213 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12214 | int _end_col_offset = _token->end_col_offset; |
| 12215 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12216 | _res = _Py_BinOp ( a , Mult , b , EXTRA ); |
| 12217 | if (_res == NULL && PyErr_Occurred()) { |
| 12218 | p->error_indicator = 1; |
| 12219 | D(p->level--); |
| 12220 | return NULL; |
| 12221 | } |
| 12222 | goto done; |
| 12223 | } |
| 12224 | p->mark = _mark; |
| 12225 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12226 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor")); |
| 12227 | } |
| 12228 | { // term '/' factor |
| 12229 | if (p->error_indicator) { |
| 12230 | D(p->level--); |
| 12231 | return NULL; |
| 12232 | } |
| 12233 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor")); |
| 12234 | Token * _literal; |
| 12235 | expr_ty a; |
| 12236 | expr_ty b; |
| 12237 | if ( |
| 12238 | (a = term_rule(p)) // term |
| 12239 | && |
| 12240 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 12241 | && |
| 12242 | (b = factor_rule(p)) // factor |
| 12243 | ) |
| 12244 | { |
| 12245 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor")); |
| 12246 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12247 | if (_token == NULL) { |
| 12248 | D(p->level--); |
| 12249 | return NULL; |
| 12250 | } |
| 12251 | int _end_lineno = _token->end_lineno; |
| 12252 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12253 | int _end_col_offset = _token->end_col_offset; |
| 12254 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12255 | _res = _Py_BinOp ( a , Div , b , EXTRA ); |
| 12256 | if (_res == NULL && PyErr_Occurred()) { |
| 12257 | p->error_indicator = 1; |
| 12258 | D(p->level--); |
| 12259 | return NULL; |
| 12260 | } |
| 12261 | goto done; |
| 12262 | } |
| 12263 | p->mark = _mark; |
| 12264 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12265 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor")); |
| 12266 | } |
| 12267 | { // term '//' factor |
| 12268 | if (p->error_indicator) { |
| 12269 | D(p->level--); |
| 12270 | return NULL; |
| 12271 | } |
| 12272 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor")); |
| 12273 | Token * _literal; |
| 12274 | expr_ty a; |
| 12275 | expr_ty b; |
| 12276 | if ( |
| 12277 | (a = term_rule(p)) // term |
| 12278 | && |
| 12279 | (_literal = _PyPegen_expect_token(p, 47)) // token='//' |
| 12280 | && |
| 12281 | (b = factor_rule(p)) // factor |
| 12282 | ) |
| 12283 | { |
| 12284 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor")); |
| 12285 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12286 | if (_token == NULL) { |
| 12287 | D(p->level--); |
| 12288 | return NULL; |
| 12289 | } |
| 12290 | int _end_lineno = _token->end_lineno; |
| 12291 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12292 | int _end_col_offset = _token->end_col_offset; |
| 12293 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12294 | _res = _Py_BinOp ( a , FloorDiv , b , EXTRA ); |
| 12295 | if (_res == NULL && PyErr_Occurred()) { |
| 12296 | p->error_indicator = 1; |
| 12297 | D(p->level--); |
| 12298 | return NULL; |
| 12299 | } |
| 12300 | goto done; |
| 12301 | } |
| 12302 | p->mark = _mark; |
| 12303 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12304 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor")); |
| 12305 | } |
| 12306 | { // term '%' factor |
| 12307 | if (p->error_indicator) { |
| 12308 | D(p->level--); |
| 12309 | return NULL; |
| 12310 | } |
| 12311 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor")); |
| 12312 | Token * _literal; |
| 12313 | expr_ty a; |
| 12314 | expr_ty b; |
| 12315 | if ( |
| 12316 | (a = term_rule(p)) // term |
| 12317 | && |
| 12318 | (_literal = _PyPegen_expect_token(p, 24)) // token='%' |
| 12319 | && |
| 12320 | (b = factor_rule(p)) // factor |
| 12321 | ) |
| 12322 | { |
| 12323 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor")); |
| 12324 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12325 | if (_token == NULL) { |
| 12326 | D(p->level--); |
| 12327 | return NULL; |
| 12328 | } |
| 12329 | int _end_lineno = _token->end_lineno; |
| 12330 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12331 | int _end_col_offset = _token->end_col_offset; |
| 12332 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12333 | _res = _Py_BinOp ( a , Mod , b , EXTRA ); |
| 12334 | if (_res == NULL && PyErr_Occurred()) { |
| 12335 | p->error_indicator = 1; |
| 12336 | D(p->level--); |
| 12337 | return NULL; |
| 12338 | } |
| 12339 | goto done; |
| 12340 | } |
| 12341 | p->mark = _mark; |
| 12342 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12343 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor")); |
| 12344 | } |
| 12345 | { // term '@' factor |
| 12346 | if (p->error_indicator) { |
| 12347 | D(p->level--); |
| 12348 | return NULL; |
| 12349 | } |
| 12350 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor")); |
| 12351 | Token * _literal; |
| 12352 | expr_ty a; |
| 12353 | expr_ty b; |
| 12354 | if ( |
| 12355 | (a = term_rule(p)) // term |
| 12356 | && |
| 12357 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
| 12358 | && |
| 12359 | (b = factor_rule(p)) // factor |
| 12360 | ) |
| 12361 | { |
| 12362 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor")); |
| 12363 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12364 | if (_token == NULL) { |
| 12365 | D(p->level--); |
| 12366 | return NULL; |
| 12367 | } |
| 12368 | int _end_lineno = _token->end_lineno; |
| 12369 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12370 | int _end_col_offset = _token->end_col_offset; |
| 12371 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 12372 | _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12373 | if (_res == NULL && PyErr_Occurred()) { |
| 12374 | p->error_indicator = 1; |
| 12375 | D(p->level--); |
| 12376 | return NULL; |
| 12377 | } |
| 12378 | goto done; |
| 12379 | } |
| 12380 | p->mark = _mark; |
| 12381 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12382 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor")); |
| 12383 | } |
| 12384 | { // factor |
| 12385 | if (p->error_indicator) { |
| 12386 | D(p->level--); |
| 12387 | return NULL; |
| 12388 | } |
| 12389 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor")); |
| 12390 | expr_ty factor_var; |
| 12391 | if ( |
| 12392 | (factor_var = factor_rule(p)) // factor |
| 12393 | ) |
| 12394 | { |
| 12395 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor")); |
| 12396 | _res = factor_var; |
| 12397 | goto done; |
| 12398 | } |
| 12399 | p->mark = _mark; |
| 12400 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12401 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor")); |
| 12402 | } |
| 12403 | _res = NULL; |
| 12404 | done: |
| 12405 | D(p->level--); |
| 12406 | return _res; |
| 12407 | } |
| 12408 | |
| 12409 | // factor: '+' factor | '-' factor | '~' factor | power |
| 12410 | static expr_ty |
| 12411 | factor_rule(Parser *p) |
| 12412 | { |
| 12413 | D(p->level++); |
| 12414 | if (p->error_indicator) { |
| 12415 | D(p->level--); |
| 12416 | return NULL; |
| 12417 | } |
| 12418 | expr_ty _res = NULL; |
| 12419 | if (_PyPegen_is_memoized(p, factor_type, &_res)) { |
| 12420 | D(p->level--); |
| 12421 | return _res; |
| 12422 | } |
| 12423 | int _mark = p->mark; |
| 12424 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12425 | p->error_indicator = 1; |
| 12426 | D(p->level--); |
| 12427 | return NULL; |
| 12428 | } |
| 12429 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12430 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12431 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12432 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12433 | { // '+' factor |
| 12434 | if (p->error_indicator) { |
| 12435 | D(p->level--); |
| 12436 | return NULL; |
| 12437 | } |
| 12438 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor")); |
| 12439 | Token * _literal; |
| 12440 | expr_ty a; |
| 12441 | if ( |
| 12442 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
| 12443 | && |
| 12444 | (a = factor_rule(p)) // factor |
| 12445 | ) |
| 12446 | { |
| 12447 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor")); |
| 12448 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12449 | if (_token == NULL) { |
| 12450 | D(p->level--); |
| 12451 | return NULL; |
| 12452 | } |
| 12453 | int _end_lineno = _token->end_lineno; |
| 12454 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12455 | int _end_col_offset = _token->end_col_offset; |
| 12456 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12457 | _res = _Py_UnaryOp ( UAdd , a , EXTRA ); |
| 12458 | if (_res == NULL && PyErr_Occurred()) { |
| 12459 | p->error_indicator = 1; |
| 12460 | D(p->level--); |
| 12461 | return NULL; |
| 12462 | } |
| 12463 | goto done; |
| 12464 | } |
| 12465 | p->mark = _mark; |
| 12466 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 12467 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor")); |
| 12468 | } |
| 12469 | { // '-' factor |
| 12470 | if (p->error_indicator) { |
| 12471 | D(p->level--); |
| 12472 | return NULL; |
| 12473 | } |
| 12474 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor")); |
| 12475 | Token * _literal; |
| 12476 | expr_ty a; |
| 12477 | if ( |
| 12478 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 12479 | && |
| 12480 | (a = factor_rule(p)) // factor |
| 12481 | ) |
| 12482 | { |
| 12483 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor")); |
| 12484 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12485 | if (_token == NULL) { |
| 12486 | D(p->level--); |
| 12487 | return NULL; |
| 12488 | } |
| 12489 | int _end_lineno = _token->end_lineno; |
| 12490 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12491 | int _end_col_offset = _token->end_col_offset; |
| 12492 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12493 | _res = _Py_UnaryOp ( USub , a , EXTRA ); |
| 12494 | if (_res == NULL && PyErr_Occurred()) { |
| 12495 | p->error_indicator = 1; |
| 12496 | D(p->level--); |
| 12497 | return NULL; |
| 12498 | } |
| 12499 | goto done; |
| 12500 | } |
| 12501 | p->mark = _mark; |
| 12502 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 12503 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor")); |
| 12504 | } |
| 12505 | { // '~' factor |
| 12506 | if (p->error_indicator) { |
| 12507 | D(p->level--); |
| 12508 | return NULL; |
| 12509 | } |
| 12510 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor")); |
| 12511 | Token * _literal; |
| 12512 | expr_ty a; |
| 12513 | if ( |
| 12514 | (_literal = _PyPegen_expect_token(p, 31)) // token='~' |
| 12515 | && |
| 12516 | (a = factor_rule(p)) // factor |
| 12517 | ) |
| 12518 | { |
| 12519 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor")); |
| 12520 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12521 | if (_token == NULL) { |
| 12522 | D(p->level--); |
| 12523 | return NULL; |
| 12524 | } |
| 12525 | int _end_lineno = _token->end_lineno; |
| 12526 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12527 | int _end_col_offset = _token->end_col_offset; |
| 12528 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12529 | _res = _Py_UnaryOp ( Invert , a , EXTRA ); |
| 12530 | if (_res == NULL && PyErr_Occurred()) { |
| 12531 | p->error_indicator = 1; |
| 12532 | D(p->level--); |
| 12533 | return NULL; |
| 12534 | } |
| 12535 | goto done; |
| 12536 | } |
| 12537 | p->mark = _mark; |
| 12538 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 12539 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor")); |
| 12540 | } |
| 12541 | { // power |
| 12542 | if (p->error_indicator) { |
| 12543 | D(p->level--); |
| 12544 | return NULL; |
| 12545 | } |
| 12546 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power")); |
| 12547 | expr_ty power_var; |
| 12548 | if ( |
| 12549 | (power_var = power_rule(p)) // power |
| 12550 | ) |
| 12551 | { |
| 12552 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power")); |
| 12553 | _res = power_var; |
| 12554 | goto done; |
| 12555 | } |
| 12556 | p->mark = _mark; |
| 12557 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 12558 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power")); |
| 12559 | } |
| 12560 | _res = NULL; |
| 12561 | done: |
| 12562 | _PyPegen_insert_memo(p, _mark, factor_type, _res); |
| 12563 | D(p->level--); |
| 12564 | return _res; |
| 12565 | } |
| 12566 | |
| 12567 | // power: await_primary '**' factor | await_primary |
| 12568 | static expr_ty |
| 12569 | power_rule(Parser *p) |
| 12570 | { |
| 12571 | D(p->level++); |
| 12572 | if (p->error_indicator) { |
| 12573 | D(p->level--); |
| 12574 | return NULL; |
| 12575 | } |
| 12576 | expr_ty _res = NULL; |
| 12577 | int _mark = p->mark; |
| 12578 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12579 | p->error_indicator = 1; |
| 12580 | D(p->level--); |
| 12581 | return NULL; |
| 12582 | } |
| 12583 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12584 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12585 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12586 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12587 | { // await_primary '**' factor |
| 12588 | if (p->error_indicator) { |
| 12589 | D(p->level--); |
| 12590 | return NULL; |
| 12591 | } |
| 12592 | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); |
| 12593 | Token * _literal; |
| 12594 | expr_ty a; |
| 12595 | expr_ty b; |
| 12596 | if ( |
| 12597 | (a = await_primary_rule(p)) // await_primary |
| 12598 | && |
| 12599 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 12600 | && |
| 12601 | (b = factor_rule(p)) // factor |
| 12602 | ) |
| 12603 | { |
| 12604 | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); |
| 12605 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12606 | if (_token == NULL) { |
| 12607 | D(p->level--); |
| 12608 | return NULL; |
| 12609 | } |
| 12610 | int _end_lineno = _token->end_lineno; |
| 12611 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12612 | int _end_col_offset = _token->end_col_offset; |
| 12613 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12614 | _res = _Py_BinOp ( a , Pow , b , EXTRA ); |
| 12615 | if (_res == NULL && PyErr_Occurred()) { |
| 12616 | p->error_indicator = 1; |
| 12617 | D(p->level--); |
| 12618 | return NULL; |
| 12619 | } |
| 12620 | goto done; |
| 12621 | } |
| 12622 | p->mark = _mark; |
| 12623 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
| 12624 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor")); |
| 12625 | } |
| 12626 | { // await_primary |
| 12627 | if (p->error_indicator) { |
| 12628 | D(p->level--); |
| 12629 | return NULL; |
| 12630 | } |
| 12631 | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary")); |
| 12632 | expr_ty await_primary_var; |
| 12633 | if ( |
| 12634 | (await_primary_var = await_primary_rule(p)) // await_primary |
| 12635 | ) |
| 12636 | { |
| 12637 | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary")); |
| 12638 | _res = await_primary_var; |
| 12639 | goto done; |
| 12640 | } |
| 12641 | p->mark = _mark; |
| 12642 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
| 12643 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary")); |
| 12644 | } |
| 12645 | _res = NULL; |
| 12646 | done: |
| 12647 | D(p->level--); |
| 12648 | return _res; |
| 12649 | } |
| 12650 | |
| 12651 | // await_primary: AWAIT primary | primary |
| 12652 | static expr_ty |
| 12653 | await_primary_rule(Parser *p) |
| 12654 | { |
| 12655 | D(p->level++); |
| 12656 | if (p->error_indicator) { |
| 12657 | D(p->level--); |
| 12658 | return NULL; |
| 12659 | } |
| 12660 | expr_ty _res = NULL; |
| 12661 | if (_PyPegen_is_memoized(p, await_primary_type, &_res)) { |
| 12662 | D(p->level--); |
| 12663 | return _res; |
| 12664 | } |
| 12665 | int _mark = p->mark; |
| 12666 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12667 | p->error_indicator = 1; |
| 12668 | D(p->level--); |
| 12669 | return NULL; |
| 12670 | } |
| 12671 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12672 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12673 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12674 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12675 | { // AWAIT primary |
| 12676 | if (p->error_indicator) { |
| 12677 | D(p->level--); |
| 12678 | return NULL; |
| 12679 | } |
| 12680 | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); |
| 12681 | expr_ty a; |
| 12682 | Token * await_var; |
| 12683 | if ( |
| 12684 | (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT' |
| 12685 | && |
| 12686 | (a = primary_rule(p)) // primary |
| 12687 | ) |
| 12688 | { |
| 12689 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); |
| 12690 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12691 | if (_token == NULL) { |
| 12692 | D(p->level--); |
| 12693 | return NULL; |
| 12694 | } |
| 12695 | int _end_lineno = _token->end_lineno; |
| 12696 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12697 | int _end_col_offset = _token->end_col_offset; |
| 12698 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 12699 | _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12700 | if (_res == NULL && PyErr_Occurred()) { |
| 12701 | p->error_indicator = 1; |
| 12702 | D(p->level--); |
| 12703 | return NULL; |
| 12704 | } |
| 12705 | goto done; |
| 12706 | } |
| 12707 | p->mark = _mark; |
| 12708 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12709 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary")); |
| 12710 | } |
| 12711 | { // primary |
| 12712 | if (p->error_indicator) { |
| 12713 | D(p->level--); |
| 12714 | return NULL; |
| 12715 | } |
| 12716 | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary")); |
| 12717 | expr_ty primary_var; |
| 12718 | if ( |
| 12719 | (primary_var = primary_rule(p)) // primary |
| 12720 | ) |
| 12721 | { |
| 12722 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary")); |
| 12723 | _res = primary_var; |
| 12724 | goto done; |
| 12725 | } |
| 12726 | p->mark = _mark; |
| 12727 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12728 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary")); |
| 12729 | } |
| 12730 | _res = NULL; |
| 12731 | done: |
| 12732 | _PyPegen_insert_memo(p, _mark, await_primary_type, _res); |
| 12733 | D(p->level--); |
| 12734 | return _res; |
| 12735 | } |
| 12736 | |
| 12737 | // Left-recursive |
| 12738 | // primary: |
Lysandros Nikolaou | 15acc4e | 2020-10-27 20:54:20 +0200 | [diff] [blame] | 12739 | // | invalid_primary |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12740 | // | primary '.' NAME |
| 12741 | // | primary genexp |
| 12742 | // | primary '(' arguments? ')' |
| 12743 | // | primary '[' slices ']' |
| 12744 | // | atom |
| 12745 | static expr_ty primary_raw(Parser *); |
| 12746 | static expr_ty |
| 12747 | primary_rule(Parser *p) |
| 12748 | { |
| 12749 | D(p->level++); |
| 12750 | expr_ty _res = NULL; |
| 12751 | if (_PyPegen_is_memoized(p, primary_type, &_res)) { |
| 12752 | D(p->level--); |
| 12753 | return _res; |
| 12754 | } |
| 12755 | int _mark = p->mark; |
| 12756 | int _resmark = p->mark; |
| 12757 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 12758 | int tmpvar_8 = _PyPegen_update_memo(p, _mark, primary_type, _res); |
| 12759 | if (tmpvar_8) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12760 | D(p->level--); |
| 12761 | return _res; |
| 12762 | } |
| 12763 | p->mark = _mark; |
| 12764 | void *_raw = primary_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 12765 | if (p->error_indicator) |
| 12766 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12767 | if (_raw == NULL || p->mark <= _resmark) |
| 12768 | break; |
| 12769 | _resmark = p->mark; |
| 12770 | _res = _raw; |
| 12771 | } |
| 12772 | p->mark = _resmark; |
| 12773 | D(p->level--); |
| 12774 | return _res; |
| 12775 | } |
| 12776 | static expr_ty |
| 12777 | primary_raw(Parser *p) |
| 12778 | { |
| 12779 | D(p->level++); |
| 12780 | if (p->error_indicator) { |
| 12781 | D(p->level--); |
| 12782 | return NULL; |
| 12783 | } |
| 12784 | expr_ty _res = NULL; |
| 12785 | int _mark = p->mark; |
| 12786 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12787 | p->error_indicator = 1; |
| 12788 | D(p->level--); |
| 12789 | return NULL; |
| 12790 | } |
| 12791 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12792 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12793 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12794 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 15acc4e | 2020-10-27 20:54:20 +0200 | [diff] [blame] | 12795 | if (p->call_invalid_rules) { // invalid_primary |
| 12796 | if (p->error_indicator) { |
| 12797 | D(p->level--); |
| 12798 | return NULL; |
| 12799 | } |
| 12800 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_primary")); |
| 12801 | void *invalid_primary_var; |
| 12802 | if ( |
| 12803 | (invalid_primary_var = invalid_primary_rule(p)) // invalid_primary |
| 12804 | ) |
| 12805 | { |
| 12806 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_primary")); |
| 12807 | _res = invalid_primary_var; |
| 12808 | goto done; |
| 12809 | } |
| 12810 | p->mark = _mark; |
| 12811 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12812 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_primary")); |
| 12813 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12814 | { // primary '.' NAME |
| 12815 | if (p->error_indicator) { |
| 12816 | D(p->level--); |
| 12817 | return NULL; |
| 12818 | } |
| 12819 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); |
| 12820 | Token * _literal; |
| 12821 | expr_ty a; |
| 12822 | expr_ty b; |
| 12823 | if ( |
| 12824 | (a = primary_rule(p)) // primary |
| 12825 | && |
| 12826 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 12827 | && |
| 12828 | (b = _PyPegen_name_token(p)) // NAME |
| 12829 | ) |
| 12830 | { |
| 12831 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); |
| 12832 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12833 | if (_token == NULL) { |
| 12834 | D(p->level--); |
| 12835 | return NULL; |
| 12836 | } |
| 12837 | int _end_lineno = _token->end_lineno; |
| 12838 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12839 | int _end_col_offset = _token->end_col_offset; |
| 12840 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12841 | _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
| 12842 | if (_res == NULL && PyErr_Occurred()) { |
| 12843 | p->error_indicator = 1; |
| 12844 | D(p->level--); |
| 12845 | return NULL; |
| 12846 | } |
| 12847 | goto done; |
| 12848 | } |
| 12849 | p->mark = _mark; |
| 12850 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12851 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME")); |
| 12852 | } |
| 12853 | { // primary genexp |
| 12854 | if (p->error_indicator) { |
| 12855 | D(p->level--); |
| 12856 | return NULL; |
| 12857 | } |
| 12858 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp")); |
| 12859 | expr_ty a; |
| 12860 | expr_ty b; |
| 12861 | if ( |
| 12862 | (a = primary_rule(p)) // primary |
| 12863 | && |
| 12864 | (b = genexp_rule(p)) // genexp |
| 12865 | ) |
| 12866 | { |
| 12867 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp")); |
| 12868 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12869 | if (_token == NULL) { |
| 12870 | D(p->level--); |
| 12871 | return NULL; |
| 12872 | } |
| 12873 | int _end_lineno = _token->end_lineno; |
| 12874 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12875 | int _end_col_offset = _token->end_col_offset; |
| 12876 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 12877 | _res = _Py_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12878 | if (_res == NULL && PyErr_Occurred()) { |
| 12879 | p->error_indicator = 1; |
| 12880 | D(p->level--); |
| 12881 | return NULL; |
| 12882 | } |
| 12883 | goto done; |
| 12884 | } |
| 12885 | p->mark = _mark; |
| 12886 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12887 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp")); |
| 12888 | } |
| 12889 | { // primary '(' arguments? ')' |
| 12890 | if (p->error_indicator) { |
| 12891 | D(p->level--); |
| 12892 | return NULL; |
| 12893 | } |
| 12894 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); |
| 12895 | Token * _literal; |
| 12896 | Token * _literal_1; |
| 12897 | expr_ty a; |
| 12898 | void *b; |
| 12899 | if ( |
| 12900 | (a = primary_rule(p)) // primary |
| 12901 | && |
| 12902 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 12903 | && |
| 12904 | (b = arguments_rule(p), 1) // arguments? |
| 12905 | && |
| 12906 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 12907 | ) |
| 12908 | { |
| 12909 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); |
| 12910 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12911 | if (_token == NULL) { |
| 12912 | D(p->level--); |
| 12913 | return NULL; |
| 12914 | } |
| 12915 | int _end_lineno = _token->end_lineno; |
| 12916 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12917 | int _end_col_offset = _token->end_col_offset; |
| 12918 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12919 | _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 12920 | if (_res == NULL && PyErr_Occurred()) { |
| 12921 | p->error_indicator = 1; |
| 12922 | D(p->level--); |
| 12923 | return NULL; |
| 12924 | } |
| 12925 | goto done; |
| 12926 | } |
| 12927 | p->mark = _mark; |
| 12928 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12929 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'")); |
| 12930 | } |
| 12931 | { // primary '[' slices ']' |
| 12932 | if (p->error_indicator) { |
| 12933 | D(p->level--); |
| 12934 | return NULL; |
| 12935 | } |
| 12936 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); |
| 12937 | Token * _literal; |
| 12938 | Token * _literal_1; |
| 12939 | expr_ty a; |
| 12940 | expr_ty b; |
| 12941 | if ( |
| 12942 | (a = primary_rule(p)) // primary |
| 12943 | && |
| 12944 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 12945 | && |
| 12946 | (b = slices_rule(p)) // slices |
| 12947 | && |
| 12948 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 12949 | ) |
| 12950 | { |
| 12951 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); |
| 12952 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12953 | if (_token == NULL) { |
| 12954 | D(p->level--); |
| 12955 | return NULL; |
| 12956 | } |
| 12957 | int _end_lineno = _token->end_lineno; |
| 12958 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12959 | int _end_col_offset = _token->end_col_offset; |
| 12960 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12961 | _res = _Py_Subscript ( a , b , Load , EXTRA ); |
| 12962 | if (_res == NULL && PyErr_Occurred()) { |
| 12963 | p->error_indicator = 1; |
| 12964 | D(p->level--); |
| 12965 | return NULL; |
| 12966 | } |
| 12967 | goto done; |
| 12968 | } |
| 12969 | p->mark = _mark; |
| 12970 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12971 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'")); |
| 12972 | } |
| 12973 | { // atom |
| 12974 | if (p->error_indicator) { |
| 12975 | D(p->level--); |
| 12976 | return NULL; |
| 12977 | } |
| 12978 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom")); |
| 12979 | expr_ty atom_var; |
| 12980 | if ( |
| 12981 | (atom_var = atom_rule(p)) // atom |
| 12982 | ) |
| 12983 | { |
| 12984 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom")); |
| 12985 | _res = atom_var; |
| 12986 | goto done; |
| 12987 | } |
| 12988 | p->mark = _mark; |
| 12989 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12990 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom")); |
| 12991 | } |
| 12992 | _res = NULL; |
| 12993 | done: |
| 12994 | D(p->level--); |
| 12995 | return _res; |
| 12996 | } |
| 12997 | |
| 12998 | // slices: slice !',' | ','.slice+ ','? |
| 12999 | static expr_ty |
| 13000 | slices_rule(Parser *p) |
| 13001 | { |
| 13002 | D(p->level++); |
| 13003 | if (p->error_indicator) { |
| 13004 | D(p->level--); |
| 13005 | return NULL; |
| 13006 | } |
| 13007 | expr_ty _res = NULL; |
| 13008 | int _mark = p->mark; |
| 13009 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13010 | p->error_indicator = 1; |
| 13011 | D(p->level--); |
| 13012 | return NULL; |
| 13013 | } |
| 13014 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13015 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13016 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13017 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13018 | { // slice !',' |
| 13019 | if (p->error_indicator) { |
| 13020 | D(p->level--); |
| 13021 | return NULL; |
| 13022 | } |
| 13023 | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','")); |
| 13024 | expr_ty a; |
| 13025 | if ( |
| 13026 | (a = slice_rule(p)) // slice |
| 13027 | && |
| 13028 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
| 13029 | ) |
| 13030 | { |
| 13031 | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','")); |
| 13032 | _res = a; |
| 13033 | if (_res == NULL && PyErr_Occurred()) { |
| 13034 | p->error_indicator = 1; |
| 13035 | D(p->level--); |
| 13036 | return NULL; |
| 13037 | } |
| 13038 | goto done; |
| 13039 | } |
| 13040 | p->mark = _mark; |
| 13041 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
| 13042 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','")); |
| 13043 | } |
| 13044 | { // ','.slice+ ','? |
| 13045 | if (p->error_indicator) { |
| 13046 | D(p->level--); |
| 13047 | return NULL; |
| 13048 | } |
| 13049 | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); |
| 13050 | void *_opt_var; |
| 13051 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13052 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13053 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13054 | (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.slice+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13055 | && |
| 13056 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 13057 | ) |
| 13058 | { |
| 13059 | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); |
| 13060 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13061 | if (_token == NULL) { |
| 13062 | D(p->level--); |
| 13063 | return NULL; |
| 13064 | } |
| 13065 | int _end_lineno = _token->end_lineno; |
| 13066 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13067 | int _end_col_offset = _token->end_col_offset; |
| 13068 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13069 | _res = _Py_Tuple ( a , Load , EXTRA ); |
| 13070 | if (_res == NULL && PyErr_Occurred()) { |
| 13071 | p->error_indicator = 1; |
| 13072 | D(p->level--); |
| 13073 | return NULL; |
| 13074 | } |
| 13075 | goto done; |
| 13076 | } |
| 13077 | p->mark = _mark; |
| 13078 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
| 13079 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?")); |
| 13080 | } |
| 13081 | _res = NULL; |
| 13082 | done: |
| 13083 | D(p->level--); |
| 13084 | return _res; |
| 13085 | } |
| 13086 | |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13087 | // slice: expression? ':' expression? [':' expression?] | named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13088 | static expr_ty |
| 13089 | slice_rule(Parser *p) |
| 13090 | { |
| 13091 | D(p->level++); |
| 13092 | if (p->error_indicator) { |
| 13093 | D(p->level--); |
| 13094 | return NULL; |
| 13095 | } |
| 13096 | expr_ty _res = NULL; |
| 13097 | int _mark = p->mark; |
| 13098 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13099 | p->error_indicator = 1; |
| 13100 | D(p->level--); |
| 13101 | return NULL; |
| 13102 | } |
| 13103 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13104 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13105 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13106 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13107 | { // expression? ':' expression? [':' expression?] |
| 13108 | if (p->error_indicator) { |
| 13109 | D(p->level--); |
| 13110 | return NULL; |
| 13111 | } |
| 13112 | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
| 13113 | Token * _literal; |
| 13114 | void *a; |
| 13115 | void *b; |
| 13116 | void *c; |
| 13117 | if ( |
| 13118 | (a = expression_rule(p), 1) // expression? |
| 13119 | && |
| 13120 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 13121 | && |
| 13122 | (b = expression_rule(p), 1) // expression? |
| 13123 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13124 | (c = _tmp_110_rule(p), 1) // [':' expression?] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13125 | ) |
| 13126 | { |
| 13127 | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
| 13128 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13129 | if (_token == NULL) { |
| 13130 | D(p->level--); |
| 13131 | return NULL; |
| 13132 | } |
| 13133 | int _end_lineno = _token->end_lineno; |
| 13134 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13135 | int _end_col_offset = _token->end_col_offset; |
| 13136 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13137 | _res = _Py_Slice ( a , b , c , EXTRA ); |
| 13138 | if (_res == NULL && PyErr_Occurred()) { |
| 13139 | p->error_indicator = 1; |
| 13140 | D(p->level--); |
| 13141 | return NULL; |
| 13142 | } |
| 13143 | goto done; |
| 13144 | } |
| 13145 | p->mark = _mark; |
| 13146 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
| 13147 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
| 13148 | } |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13149 | { // named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13150 | if (p->error_indicator) { |
| 13151 | D(p->level--); |
| 13152 | return NULL; |
| 13153 | } |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13154 | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13155 | expr_ty a; |
| 13156 | if ( |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13157 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13158 | ) |
| 13159 | { |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13160 | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13161 | _res = a; |
| 13162 | if (_res == NULL && PyErr_Occurred()) { |
| 13163 | p->error_indicator = 1; |
| 13164 | D(p->level--); |
| 13165 | return NULL; |
| 13166 | } |
| 13167 | goto done; |
| 13168 | } |
| 13169 | p->mark = _mark; |
| 13170 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13171 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13172 | } |
| 13173 | _res = NULL; |
| 13174 | done: |
| 13175 | D(p->level--); |
| 13176 | return _res; |
| 13177 | } |
| 13178 | |
| 13179 | // atom: |
| 13180 | // | NAME |
| 13181 | // | 'True' |
| 13182 | // | 'False' |
| 13183 | // | 'None' |
| 13184 | // | &STRING strings |
| 13185 | // | NUMBER |
| 13186 | // | &'(' (tuple | group | genexp) |
| 13187 | // | &'[' (list | listcomp) |
| 13188 | // | &'{' (dict | set | dictcomp | setcomp) |
| 13189 | // | '...' |
| 13190 | static expr_ty |
| 13191 | atom_rule(Parser *p) |
| 13192 | { |
| 13193 | D(p->level++); |
| 13194 | if (p->error_indicator) { |
| 13195 | D(p->level--); |
| 13196 | return NULL; |
| 13197 | } |
| 13198 | expr_ty _res = NULL; |
| 13199 | int _mark = p->mark; |
| 13200 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13201 | p->error_indicator = 1; |
| 13202 | D(p->level--); |
| 13203 | return NULL; |
| 13204 | } |
| 13205 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13206 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13207 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13208 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13209 | { // NAME |
| 13210 | if (p->error_indicator) { |
| 13211 | D(p->level--); |
| 13212 | return NULL; |
| 13213 | } |
| 13214 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 13215 | expr_ty name_var; |
| 13216 | if ( |
| 13217 | (name_var = _PyPegen_name_token(p)) // NAME |
| 13218 | ) |
| 13219 | { |
| 13220 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 13221 | _res = name_var; |
| 13222 | goto done; |
| 13223 | } |
| 13224 | p->mark = _mark; |
| 13225 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13226 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 13227 | } |
| 13228 | { // 'True' |
| 13229 | if (p->error_indicator) { |
| 13230 | D(p->level--); |
| 13231 | return NULL; |
| 13232 | } |
| 13233 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
| 13234 | Token * _keyword; |
| 13235 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13236 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13237 | ) |
| 13238 | { |
| 13239 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
| 13240 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13241 | if (_token == NULL) { |
| 13242 | D(p->level--); |
| 13243 | return NULL; |
| 13244 | } |
| 13245 | int _end_lineno = _token->end_lineno; |
| 13246 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13247 | int _end_col_offset = _token->end_col_offset; |
| 13248 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13249 | _res = _Py_Constant ( Py_True , NULL , EXTRA ); |
| 13250 | if (_res == NULL && PyErr_Occurred()) { |
| 13251 | p->error_indicator = 1; |
| 13252 | D(p->level--); |
| 13253 | return NULL; |
| 13254 | } |
| 13255 | goto done; |
| 13256 | } |
| 13257 | p->mark = _mark; |
| 13258 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13259 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
| 13260 | } |
| 13261 | { // 'False' |
| 13262 | if (p->error_indicator) { |
| 13263 | D(p->level--); |
| 13264 | return NULL; |
| 13265 | } |
| 13266 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
| 13267 | Token * _keyword; |
| 13268 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13269 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13270 | ) |
| 13271 | { |
| 13272 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
| 13273 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13274 | if (_token == NULL) { |
| 13275 | D(p->level--); |
| 13276 | return NULL; |
| 13277 | } |
| 13278 | int _end_lineno = _token->end_lineno; |
| 13279 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13280 | int _end_col_offset = _token->end_col_offset; |
| 13281 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13282 | _res = _Py_Constant ( Py_False , NULL , EXTRA ); |
| 13283 | if (_res == NULL && PyErr_Occurred()) { |
| 13284 | p->error_indicator = 1; |
| 13285 | D(p->level--); |
| 13286 | return NULL; |
| 13287 | } |
| 13288 | goto done; |
| 13289 | } |
| 13290 | p->mark = _mark; |
| 13291 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13292 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
| 13293 | } |
| 13294 | { // 'None' |
| 13295 | if (p->error_indicator) { |
| 13296 | D(p->level--); |
| 13297 | return NULL; |
| 13298 | } |
| 13299 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
| 13300 | Token * _keyword; |
| 13301 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13302 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13303 | ) |
| 13304 | { |
| 13305 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
| 13306 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13307 | if (_token == NULL) { |
| 13308 | D(p->level--); |
| 13309 | return NULL; |
| 13310 | } |
| 13311 | int _end_lineno = _token->end_lineno; |
| 13312 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13313 | int _end_col_offset = _token->end_col_offset; |
| 13314 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13315 | _res = _Py_Constant ( Py_None , NULL , EXTRA ); |
| 13316 | if (_res == NULL && PyErr_Occurred()) { |
| 13317 | p->error_indicator = 1; |
| 13318 | D(p->level--); |
| 13319 | return NULL; |
| 13320 | } |
| 13321 | goto done; |
| 13322 | } |
| 13323 | p->mark = _mark; |
| 13324 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13325 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
| 13326 | } |
| 13327 | { // &STRING strings |
| 13328 | if (p->error_indicator) { |
| 13329 | D(p->level--); |
| 13330 | return NULL; |
| 13331 | } |
| 13332 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings")); |
| 13333 | expr_ty strings_var; |
| 13334 | if ( |
| 13335 | _PyPegen_lookahead(1, _PyPegen_string_token, p) |
| 13336 | && |
| 13337 | (strings_var = strings_rule(p)) // strings |
| 13338 | ) |
| 13339 | { |
| 13340 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings")); |
| 13341 | _res = strings_var; |
| 13342 | goto done; |
| 13343 | } |
| 13344 | p->mark = _mark; |
| 13345 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13346 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings")); |
| 13347 | } |
| 13348 | { // NUMBER |
| 13349 | if (p->error_indicator) { |
| 13350 | D(p->level--); |
| 13351 | return NULL; |
| 13352 | } |
| 13353 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
| 13354 | expr_ty number_var; |
| 13355 | if ( |
| 13356 | (number_var = _PyPegen_number_token(p)) // NUMBER |
| 13357 | ) |
| 13358 | { |
| 13359 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
| 13360 | _res = number_var; |
| 13361 | goto done; |
| 13362 | } |
| 13363 | p->mark = _mark; |
| 13364 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13365 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
| 13366 | } |
| 13367 | { // &'(' (tuple | group | genexp) |
| 13368 | if (p->error_indicator) { |
| 13369 | D(p->level--); |
| 13370 | return NULL; |
| 13371 | } |
| 13372 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13373 | void *_tmp_111_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13374 | if ( |
| 13375 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' |
| 13376 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13377 | (_tmp_111_var = _tmp_111_rule(p)) // tuple | group | genexp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13378 | ) |
| 13379 | { |
| 13380 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13381 | _res = _tmp_111_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13382 | goto done; |
| 13383 | } |
| 13384 | p->mark = _mark; |
| 13385 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13386 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)")); |
| 13387 | } |
| 13388 | { // &'[' (list | listcomp) |
| 13389 | if (p->error_indicator) { |
| 13390 | D(p->level--); |
| 13391 | return NULL; |
| 13392 | } |
| 13393 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13394 | void *_tmp_112_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13395 | if ( |
| 13396 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' |
| 13397 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13398 | (_tmp_112_var = _tmp_112_rule(p)) // list | listcomp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13399 | ) |
| 13400 | { |
| 13401 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13402 | _res = _tmp_112_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13403 | goto done; |
| 13404 | } |
| 13405 | p->mark = _mark; |
| 13406 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13407 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)")); |
| 13408 | } |
| 13409 | { // &'{' (dict | set | dictcomp | setcomp) |
| 13410 | if (p->error_indicator) { |
| 13411 | D(p->level--); |
| 13412 | return NULL; |
| 13413 | } |
| 13414 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13415 | void *_tmp_113_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13416 | if ( |
| 13417 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' |
| 13418 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13419 | (_tmp_113_var = _tmp_113_rule(p)) // dict | set | dictcomp | setcomp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13420 | ) |
| 13421 | { |
| 13422 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13423 | _res = _tmp_113_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13424 | goto done; |
| 13425 | } |
| 13426 | p->mark = _mark; |
| 13427 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13428 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
| 13429 | } |
| 13430 | { // '...' |
| 13431 | if (p->error_indicator) { |
| 13432 | D(p->level--); |
| 13433 | return NULL; |
| 13434 | } |
| 13435 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
| 13436 | Token * _literal; |
| 13437 | if ( |
| 13438 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 13439 | ) |
| 13440 | { |
| 13441 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
| 13442 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13443 | if (_token == NULL) { |
| 13444 | D(p->level--); |
| 13445 | return NULL; |
| 13446 | } |
| 13447 | int _end_lineno = _token->end_lineno; |
| 13448 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13449 | int _end_col_offset = _token->end_col_offset; |
| 13450 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13451 | _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA ); |
| 13452 | if (_res == NULL && PyErr_Occurred()) { |
| 13453 | p->error_indicator = 1; |
| 13454 | D(p->level--); |
| 13455 | return NULL; |
| 13456 | } |
| 13457 | goto done; |
| 13458 | } |
| 13459 | p->mark = _mark; |
| 13460 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13461 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
| 13462 | } |
| 13463 | _res = NULL; |
| 13464 | done: |
| 13465 | D(p->level--); |
| 13466 | return _res; |
| 13467 | } |
| 13468 | |
| 13469 | // strings: STRING+ |
| 13470 | static expr_ty |
| 13471 | strings_rule(Parser *p) |
| 13472 | { |
| 13473 | D(p->level++); |
| 13474 | if (p->error_indicator) { |
| 13475 | D(p->level--); |
| 13476 | return NULL; |
| 13477 | } |
| 13478 | expr_ty _res = NULL; |
| 13479 | if (_PyPegen_is_memoized(p, strings_type, &_res)) { |
| 13480 | D(p->level--); |
| 13481 | return _res; |
| 13482 | } |
| 13483 | int _mark = p->mark; |
| 13484 | { // STRING+ |
| 13485 | if (p->error_indicator) { |
| 13486 | D(p->level--); |
| 13487 | return NULL; |
| 13488 | } |
| 13489 | D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); |
| 13490 | asdl_seq * a; |
| 13491 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13492 | (a = _loop1_114_rule(p)) // STRING+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13493 | ) |
| 13494 | { |
| 13495 | D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); |
| 13496 | _res = _PyPegen_concatenate_strings ( p , a ); |
| 13497 | if (_res == NULL && PyErr_Occurred()) { |
| 13498 | p->error_indicator = 1; |
| 13499 | D(p->level--); |
| 13500 | return NULL; |
| 13501 | } |
| 13502 | goto done; |
| 13503 | } |
| 13504 | p->mark = _mark; |
| 13505 | D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', |
| 13506 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+")); |
| 13507 | } |
| 13508 | _res = NULL; |
| 13509 | done: |
| 13510 | _PyPegen_insert_memo(p, _mark, strings_type, _res); |
| 13511 | D(p->level--); |
| 13512 | return _res; |
| 13513 | } |
| 13514 | |
| 13515 | // list: '[' star_named_expressions? ']' |
| 13516 | static expr_ty |
| 13517 | list_rule(Parser *p) |
| 13518 | { |
| 13519 | D(p->level++); |
| 13520 | if (p->error_indicator) { |
| 13521 | D(p->level--); |
| 13522 | return NULL; |
| 13523 | } |
| 13524 | expr_ty _res = NULL; |
| 13525 | int _mark = p->mark; |
| 13526 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13527 | p->error_indicator = 1; |
| 13528 | D(p->level--); |
| 13529 | return NULL; |
| 13530 | } |
| 13531 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13532 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13533 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13534 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13535 | { // '[' star_named_expressions? ']' |
| 13536 | if (p->error_indicator) { |
| 13537 | D(p->level--); |
| 13538 | return NULL; |
| 13539 | } |
| 13540 | D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); |
| 13541 | Token * _literal; |
| 13542 | Token * _literal_1; |
| 13543 | void *a; |
| 13544 | if ( |
| 13545 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 13546 | && |
| 13547 | (a = star_named_expressions_rule(p), 1) // star_named_expressions? |
| 13548 | && |
| 13549 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 13550 | ) |
| 13551 | { |
| 13552 | D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); |
| 13553 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13554 | if (_token == NULL) { |
| 13555 | D(p->level--); |
| 13556 | return NULL; |
| 13557 | } |
| 13558 | int _end_lineno = _token->end_lineno; |
| 13559 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13560 | int _end_col_offset = _token->end_col_offset; |
| 13561 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13562 | _res = _Py_List ( a , Load , EXTRA ); |
| 13563 | if (_res == NULL && PyErr_Occurred()) { |
| 13564 | p->error_indicator = 1; |
| 13565 | D(p->level--); |
| 13566 | return NULL; |
| 13567 | } |
| 13568 | goto done; |
| 13569 | } |
| 13570 | p->mark = _mark; |
| 13571 | D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ', |
| 13572 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'")); |
| 13573 | } |
| 13574 | _res = NULL; |
| 13575 | done: |
| 13576 | D(p->level--); |
| 13577 | return _res; |
| 13578 | } |
| 13579 | |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13580 | // listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13581 | static expr_ty |
| 13582 | listcomp_rule(Parser *p) |
| 13583 | { |
| 13584 | D(p->level++); |
| 13585 | if (p->error_indicator) { |
| 13586 | D(p->level--); |
| 13587 | return NULL; |
| 13588 | } |
| 13589 | expr_ty _res = NULL; |
| 13590 | int _mark = p->mark; |
| 13591 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13592 | p->error_indicator = 1; |
| 13593 | D(p->level--); |
| 13594 | return NULL; |
| 13595 | } |
| 13596 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13597 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13598 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13599 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13600 | { // '[' named_expression for_if_clauses ']' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13601 | if (p->error_indicator) { |
| 13602 | D(p->level--); |
| 13603 | return NULL; |
| 13604 | } |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13605 | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13606 | Token * _literal; |
| 13607 | Token * _literal_1; |
| 13608 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13609 | asdl_comprehension_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13610 | if ( |
| 13611 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 13612 | && |
| 13613 | (a = named_expression_rule(p)) // named_expression |
| 13614 | && |
| 13615 | (b = for_if_clauses_rule(p)) // for_if_clauses |
| 13616 | && |
| 13617 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 13618 | ) |
| 13619 | { |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13620 | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13621 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13622 | if (_token == NULL) { |
| 13623 | D(p->level--); |
| 13624 | return NULL; |
| 13625 | } |
| 13626 | int _end_lineno = _token->end_lineno; |
| 13627 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13628 | int _end_col_offset = _token->end_col_offset; |
| 13629 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13630 | _res = _Py_ListComp ( a , b , EXTRA ); |
| 13631 | if (_res == NULL && PyErr_Occurred()) { |
| 13632 | p->error_indicator = 1; |
| 13633 | D(p->level--); |
| 13634 | return NULL; |
| 13635 | } |
| 13636 | goto done; |
| 13637 | } |
| 13638 | p->mark = _mark; |
| 13639 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13640 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13641 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 13642 | if (p->call_invalid_rules) { // invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13643 | if (p->error_indicator) { |
| 13644 | D(p->level--); |
| 13645 | return NULL; |
| 13646 | } |
| 13647 | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 13648 | void *invalid_comprehension_var; |
| 13649 | if ( |
| 13650 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
| 13651 | ) |
| 13652 | { |
| 13653 | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 13654 | _res = invalid_comprehension_var; |
| 13655 | goto done; |
| 13656 | } |
| 13657 | p->mark = _mark; |
| 13658 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 13659 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
| 13660 | } |
| 13661 | _res = NULL; |
| 13662 | done: |
| 13663 | D(p->level--); |
| 13664 | return _res; |
| 13665 | } |
| 13666 | |
| 13667 | // tuple: '(' [star_named_expression ',' star_named_expressions?] ')' |
| 13668 | static expr_ty |
| 13669 | tuple_rule(Parser *p) |
| 13670 | { |
| 13671 | D(p->level++); |
| 13672 | if (p->error_indicator) { |
| 13673 | D(p->level--); |
| 13674 | return NULL; |
| 13675 | } |
| 13676 | expr_ty _res = NULL; |
| 13677 | int _mark = p->mark; |
| 13678 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13679 | p->error_indicator = 1; |
| 13680 | D(p->level--); |
| 13681 | return NULL; |
| 13682 | } |
| 13683 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13684 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13685 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13686 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13687 | { // '(' [star_named_expression ',' star_named_expressions?] ')' |
| 13688 | if (p->error_indicator) { |
| 13689 | D(p->level--); |
| 13690 | return NULL; |
| 13691 | } |
| 13692 | D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
| 13693 | Token * _literal; |
| 13694 | Token * _literal_1; |
| 13695 | void *a; |
| 13696 | if ( |
| 13697 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 13698 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13699 | (a = _tmp_115_rule(p), 1) // [star_named_expression ',' star_named_expressions?] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13700 | && |
| 13701 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 13702 | ) |
| 13703 | { |
| 13704 | D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
| 13705 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13706 | if (_token == NULL) { |
| 13707 | D(p->level--); |
| 13708 | return NULL; |
| 13709 | } |
| 13710 | int _end_lineno = _token->end_lineno; |
| 13711 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13712 | int _end_col_offset = _token->end_col_offset; |
| 13713 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13714 | _res = _Py_Tuple ( a , Load , EXTRA ); |
| 13715 | if (_res == NULL && PyErr_Occurred()) { |
| 13716 | p->error_indicator = 1; |
| 13717 | D(p->level--); |
| 13718 | return NULL; |
| 13719 | } |
| 13720 | goto done; |
| 13721 | } |
| 13722 | p->mark = _mark; |
| 13723 | D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ', |
| 13724 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
| 13725 | } |
| 13726 | _res = NULL; |
| 13727 | done: |
| 13728 | D(p->level--); |
| 13729 | return _res; |
| 13730 | } |
| 13731 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 13732 | // group: '(' (yield_expr | named_expression) ')' | invalid_group |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13733 | static expr_ty |
| 13734 | group_rule(Parser *p) |
| 13735 | { |
| 13736 | D(p->level++); |
| 13737 | if (p->error_indicator) { |
| 13738 | D(p->level--); |
| 13739 | return NULL; |
| 13740 | } |
| 13741 | expr_ty _res = NULL; |
| 13742 | int _mark = p->mark; |
| 13743 | { // '(' (yield_expr | named_expression) ')' |
| 13744 | if (p->error_indicator) { |
| 13745 | D(p->level--); |
| 13746 | return NULL; |
| 13747 | } |
| 13748 | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
| 13749 | Token * _literal; |
| 13750 | Token * _literal_1; |
| 13751 | void *a; |
| 13752 | if ( |
| 13753 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 13754 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13755 | (a = _tmp_116_rule(p)) // yield_expr | named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13756 | && |
| 13757 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 13758 | ) |
| 13759 | { |
| 13760 | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
| 13761 | _res = a; |
| 13762 | if (_res == NULL && PyErr_Occurred()) { |
| 13763 | p->error_indicator = 1; |
| 13764 | D(p->level--); |
| 13765 | return NULL; |
| 13766 | } |
| 13767 | goto done; |
| 13768 | } |
| 13769 | p->mark = _mark; |
| 13770 | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', |
| 13771 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
| 13772 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 13773 | if (p->call_invalid_rules) { // invalid_group |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 13774 | if (p->error_indicator) { |
| 13775 | D(p->level--); |
| 13776 | return NULL; |
| 13777 | } |
| 13778 | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group")); |
| 13779 | void *invalid_group_var; |
| 13780 | if ( |
| 13781 | (invalid_group_var = invalid_group_rule(p)) // invalid_group |
| 13782 | ) |
| 13783 | { |
| 13784 | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group")); |
| 13785 | _res = invalid_group_var; |
| 13786 | goto done; |
| 13787 | } |
| 13788 | p->mark = _mark; |
| 13789 | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', |
| 13790 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group")); |
| 13791 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13792 | _res = NULL; |
| 13793 | done: |
| 13794 | D(p->level--); |
| 13795 | return _res; |
| 13796 | } |
| 13797 | |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13798 | // genexp: '(' named_expression for_if_clauses ')' | invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13799 | static expr_ty |
| 13800 | genexp_rule(Parser *p) |
| 13801 | { |
| 13802 | D(p->level++); |
| 13803 | if (p->error_indicator) { |
| 13804 | D(p->level--); |
| 13805 | return NULL; |
| 13806 | } |
| 13807 | expr_ty _res = NULL; |
| 13808 | int _mark = p->mark; |
| 13809 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13810 | p->error_indicator = 1; |
| 13811 | D(p->level--); |
| 13812 | return NULL; |
| 13813 | } |
| 13814 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13815 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13816 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13817 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13818 | { // '(' named_expression for_if_clauses ')' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13819 | if (p->error_indicator) { |
| 13820 | D(p->level--); |
| 13821 | return NULL; |
| 13822 | } |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13823 | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' named_expression for_if_clauses ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13824 | Token * _literal; |
| 13825 | Token * _literal_1; |
| 13826 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13827 | asdl_comprehension_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13828 | if ( |
| 13829 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 13830 | && |
Lysandros Nikolaou | cb3e5ed | 2020-11-17 01:08:35 +0200 | [diff] [blame] | 13831 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13832 | && |
| 13833 | (b = for_if_clauses_rule(p)) // for_if_clauses |
| 13834 | && |
| 13835 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 13836 | ) |
| 13837 | { |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13838 | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' named_expression for_if_clauses ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13839 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13840 | if (_token == NULL) { |
| 13841 | D(p->level--); |
| 13842 | return NULL; |
| 13843 | } |
| 13844 | int _end_lineno = _token->end_lineno; |
| 13845 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13846 | int _end_col_offset = _token->end_col_offset; |
| 13847 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13848 | _res = _Py_GeneratorExp ( a , b , EXTRA ); |
| 13849 | if (_res == NULL && PyErr_Occurred()) { |
| 13850 | p->error_indicator = 1; |
| 13851 | D(p->level--); |
| 13852 | return NULL; |
| 13853 | } |
| 13854 | goto done; |
| 13855 | } |
| 13856 | p->mark = _mark; |
| 13857 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13858 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' named_expression for_if_clauses ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13859 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 13860 | if (p->call_invalid_rules) { // invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13861 | if (p->error_indicator) { |
| 13862 | D(p->level--); |
| 13863 | return NULL; |
| 13864 | } |
| 13865 | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 13866 | void *invalid_comprehension_var; |
| 13867 | if ( |
| 13868 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
| 13869 | ) |
| 13870 | { |
| 13871 | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 13872 | _res = invalid_comprehension_var; |
| 13873 | goto done; |
| 13874 | } |
| 13875 | p->mark = _mark; |
| 13876 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
| 13877 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
| 13878 | } |
| 13879 | _res = NULL; |
| 13880 | done: |
| 13881 | D(p->level--); |
| 13882 | return _res; |
| 13883 | } |
| 13884 | |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13885 | // set: '{' star_named_expressions '}' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13886 | static expr_ty |
| 13887 | set_rule(Parser *p) |
| 13888 | { |
| 13889 | D(p->level++); |
| 13890 | if (p->error_indicator) { |
| 13891 | D(p->level--); |
| 13892 | return NULL; |
| 13893 | } |
| 13894 | expr_ty _res = NULL; |
| 13895 | int _mark = p->mark; |
| 13896 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13897 | p->error_indicator = 1; |
| 13898 | D(p->level--); |
| 13899 | return NULL; |
| 13900 | } |
| 13901 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13902 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13903 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13904 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13905 | { // '{' star_named_expressions '}' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13906 | if (p->error_indicator) { |
| 13907 | D(p->level--); |
| 13908 | return NULL; |
| 13909 | } |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13910 | D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13911 | Token * _literal; |
| 13912 | Token * _literal_1; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13913 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13914 | if ( |
| 13915 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 13916 | && |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13917 | (a = star_named_expressions_rule(p)) // star_named_expressions |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13918 | && |
| 13919 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 13920 | ) |
| 13921 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13922 | D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13923 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13924 | if (_token == NULL) { |
| 13925 | D(p->level--); |
| 13926 | return NULL; |
| 13927 | } |
| 13928 | int _end_lineno = _token->end_lineno; |
| 13929 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13930 | int _end_col_offset = _token->end_col_offset; |
| 13931 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13932 | _res = _Py_Set ( a , EXTRA ); |
| 13933 | if (_res == NULL && PyErr_Occurred()) { |
| 13934 | p->error_indicator = 1; |
| 13935 | D(p->level--); |
| 13936 | return NULL; |
| 13937 | } |
| 13938 | goto done; |
| 13939 | } |
| 13940 | p->mark = _mark; |
| 13941 | D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13942 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13943 | } |
| 13944 | _res = NULL; |
| 13945 | done: |
| 13946 | D(p->level--); |
| 13947 | return _res; |
| 13948 | } |
| 13949 | |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13950 | // setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13951 | static expr_ty |
| 13952 | setcomp_rule(Parser *p) |
| 13953 | { |
| 13954 | D(p->level++); |
| 13955 | if (p->error_indicator) { |
| 13956 | D(p->level--); |
| 13957 | return NULL; |
| 13958 | } |
| 13959 | expr_ty _res = NULL; |
| 13960 | int _mark = p->mark; |
| 13961 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13962 | p->error_indicator = 1; |
| 13963 | D(p->level--); |
| 13964 | return NULL; |
| 13965 | } |
| 13966 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13967 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13968 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13969 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13970 | { // '{' named_expression for_if_clauses '}' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13971 | if (p->error_indicator) { |
| 13972 | D(p->level--); |
| 13973 | return NULL; |
| 13974 | } |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13975 | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13976 | Token * _literal; |
| 13977 | Token * _literal_1; |
| 13978 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13979 | asdl_comprehension_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13980 | if ( |
| 13981 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 13982 | && |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13983 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13984 | && |
| 13985 | (b = for_if_clauses_rule(p)) // for_if_clauses |
| 13986 | && |
| 13987 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 13988 | ) |
| 13989 | { |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13990 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13991 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13992 | if (_token == NULL) { |
| 13993 | D(p->level--); |
| 13994 | return NULL; |
| 13995 | } |
| 13996 | int _end_lineno = _token->end_lineno; |
| 13997 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13998 | int _end_col_offset = _token->end_col_offset; |
| 13999 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14000 | _res = _Py_SetComp ( a , b , EXTRA ); |
| 14001 | if (_res == NULL && PyErr_Occurred()) { |
| 14002 | p->error_indicator = 1; |
| 14003 | D(p->level--); |
| 14004 | return NULL; |
| 14005 | } |
| 14006 | goto done; |
| 14007 | } |
| 14008 | p->mark = _mark; |
| 14009 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 14010 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression for_if_clauses '}'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14011 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14012 | if (p->call_invalid_rules) { // invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14013 | if (p->error_indicator) { |
| 14014 | D(p->level--); |
| 14015 | return NULL; |
| 14016 | } |
| 14017 | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 14018 | void *invalid_comprehension_var; |
| 14019 | if ( |
| 14020 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
| 14021 | ) |
| 14022 | { |
| 14023 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 14024 | _res = invalid_comprehension_var; |
| 14025 | goto done; |
| 14026 | } |
| 14027 | p->mark = _mark; |
| 14028 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 14029 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
| 14030 | } |
| 14031 | _res = NULL; |
| 14032 | done: |
| 14033 | D(p->level--); |
| 14034 | return _res; |
| 14035 | } |
| 14036 | |
| 14037 | // dict: '{' double_starred_kvpairs? '}' |
| 14038 | static expr_ty |
| 14039 | dict_rule(Parser *p) |
| 14040 | { |
| 14041 | D(p->level++); |
| 14042 | if (p->error_indicator) { |
| 14043 | D(p->level--); |
| 14044 | return NULL; |
| 14045 | } |
| 14046 | expr_ty _res = NULL; |
| 14047 | int _mark = p->mark; |
| 14048 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14049 | p->error_indicator = 1; |
| 14050 | D(p->level--); |
| 14051 | return NULL; |
| 14052 | } |
| 14053 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14054 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14055 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14056 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14057 | { // '{' double_starred_kvpairs? '}' |
| 14058 | if (p->error_indicator) { |
| 14059 | D(p->level--); |
| 14060 | return NULL; |
| 14061 | } |
| 14062 | D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
| 14063 | Token * _literal; |
| 14064 | Token * _literal_1; |
| 14065 | void *a; |
| 14066 | if ( |
| 14067 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 14068 | && |
| 14069 | (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs? |
| 14070 | && |
| 14071 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 14072 | ) |
| 14073 | { |
| 14074 | D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
| 14075 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14076 | if (_token == NULL) { |
| 14077 | D(p->level--); |
| 14078 | return NULL; |
| 14079 | } |
| 14080 | int _end_lineno = _token->end_lineno; |
| 14081 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14082 | int _end_col_offset = _token->end_col_offset; |
| 14083 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 14084 | _res = _Py_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , a ) ) , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14085 | if (_res == NULL && PyErr_Occurred()) { |
| 14086 | p->error_indicator = 1; |
| 14087 | D(p->level--); |
| 14088 | return NULL; |
| 14089 | } |
| 14090 | goto done; |
| 14091 | } |
| 14092 | p->mark = _mark; |
| 14093 | D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ', |
| 14094 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
| 14095 | } |
| 14096 | _res = NULL; |
| 14097 | done: |
| 14098 | D(p->level--); |
| 14099 | return _res; |
| 14100 | } |
| 14101 | |
| 14102 | // dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension |
| 14103 | static expr_ty |
| 14104 | dictcomp_rule(Parser *p) |
| 14105 | { |
| 14106 | D(p->level++); |
| 14107 | if (p->error_indicator) { |
| 14108 | D(p->level--); |
| 14109 | return NULL; |
| 14110 | } |
| 14111 | expr_ty _res = NULL; |
| 14112 | int _mark = p->mark; |
| 14113 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14114 | p->error_indicator = 1; |
| 14115 | D(p->level--); |
| 14116 | return NULL; |
| 14117 | } |
| 14118 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14119 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14120 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14121 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14122 | { // '{' kvpair for_if_clauses '}' |
| 14123 | if (p->error_indicator) { |
| 14124 | D(p->level--); |
| 14125 | return NULL; |
| 14126 | } |
| 14127 | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
| 14128 | Token * _literal; |
| 14129 | Token * _literal_1; |
| 14130 | KeyValuePair* a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14131 | asdl_comprehension_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14132 | if ( |
| 14133 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 14134 | && |
| 14135 | (a = kvpair_rule(p)) // kvpair |
| 14136 | && |
| 14137 | (b = for_if_clauses_rule(p)) // for_if_clauses |
| 14138 | && |
| 14139 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 14140 | ) |
| 14141 | { |
| 14142 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
| 14143 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14144 | if (_token == NULL) { |
| 14145 | D(p->level--); |
| 14146 | return NULL; |
| 14147 | } |
| 14148 | int _end_lineno = _token->end_lineno; |
| 14149 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14150 | int _end_col_offset = _token->end_col_offset; |
| 14151 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14152 | _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA ); |
| 14153 | if (_res == NULL && PyErr_Occurred()) { |
| 14154 | p->error_indicator = 1; |
| 14155 | D(p->level--); |
| 14156 | return NULL; |
| 14157 | } |
| 14158 | goto done; |
| 14159 | } |
| 14160 | p->mark = _mark; |
| 14161 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 14162 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
| 14163 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14164 | if (p->call_invalid_rules) { // invalid_dict_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14165 | if (p->error_indicator) { |
| 14166 | D(p->level--); |
| 14167 | return NULL; |
| 14168 | } |
| 14169 | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); |
| 14170 | void *invalid_dict_comprehension_var; |
| 14171 | if ( |
| 14172 | (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension |
| 14173 | ) |
| 14174 | { |
| 14175 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); |
| 14176 | _res = invalid_dict_comprehension_var; |
| 14177 | goto done; |
| 14178 | } |
| 14179 | p->mark = _mark; |
| 14180 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 14181 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension")); |
| 14182 | } |
| 14183 | _res = NULL; |
| 14184 | done: |
| 14185 | D(p->level--); |
| 14186 | return _res; |
| 14187 | } |
| 14188 | |
| 14189 | // double_starred_kvpairs: ','.double_starred_kvpair+ ','? |
| 14190 | static asdl_seq* |
| 14191 | double_starred_kvpairs_rule(Parser *p) |
| 14192 | { |
| 14193 | D(p->level++); |
| 14194 | if (p->error_indicator) { |
| 14195 | D(p->level--); |
| 14196 | return NULL; |
| 14197 | } |
| 14198 | asdl_seq* _res = NULL; |
| 14199 | int _mark = p->mark; |
| 14200 | { // ','.double_starred_kvpair+ ','? |
| 14201 | if (p->error_indicator) { |
| 14202 | D(p->level--); |
| 14203 | return NULL; |
| 14204 | } |
| 14205 | D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
| 14206 | void *_opt_var; |
| 14207 | UNUSED(_opt_var); // Silence compiler warnings |
| 14208 | asdl_seq * a; |
| 14209 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14210 | (a = _gather_117_rule(p)) // ','.double_starred_kvpair+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14211 | && |
| 14212 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 14213 | ) |
| 14214 | { |
| 14215 | D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
| 14216 | _res = a; |
| 14217 | if (_res == NULL && PyErr_Occurred()) { |
| 14218 | p->error_indicator = 1; |
| 14219 | D(p->level--); |
| 14220 | return NULL; |
| 14221 | } |
| 14222 | goto done; |
| 14223 | } |
| 14224 | p->mark = _mark; |
| 14225 | D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', |
| 14226 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
| 14227 | } |
| 14228 | _res = NULL; |
| 14229 | done: |
| 14230 | D(p->level--); |
| 14231 | return _res; |
| 14232 | } |
| 14233 | |
| 14234 | // double_starred_kvpair: '**' bitwise_or | kvpair |
| 14235 | static KeyValuePair* |
| 14236 | double_starred_kvpair_rule(Parser *p) |
| 14237 | { |
| 14238 | D(p->level++); |
| 14239 | if (p->error_indicator) { |
| 14240 | D(p->level--); |
| 14241 | return NULL; |
| 14242 | } |
| 14243 | KeyValuePair* _res = NULL; |
| 14244 | int _mark = p->mark; |
| 14245 | { // '**' bitwise_or |
| 14246 | if (p->error_indicator) { |
| 14247 | D(p->level--); |
| 14248 | return NULL; |
| 14249 | } |
| 14250 | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); |
| 14251 | Token * _literal; |
| 14252 | expr_ty a; |
| 14253 | if ( |
| 14254 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 14255 | && |
| 14256 | (a = bitwise_or_rule(p)) // bitwise_or |
| 14257 | ) |
| 14258 | { |
| 14259 | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); |
| 14260 | _res = _PyPegen_key_value_pair ( p , NULL , a ); |
| 14261 | if (_res == NULL && PyErr_Occurred()) { |
| 14262 | p->error_indicator = 1; |
| 14263 | D(p->level--); |
| 14264 | return NULL; |
| 14265 | } |
| 14266 | goto done; |
| 14267 | } |
| 14268 | p->mark = _mark; |
| 14269 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 14270 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or")); |
| 14271 | } |
| 14272 | { // kvpair |
| 14273 | if (p->error_indicator) { |
| 14274 | D(p->level--); |
| 14275 | return NULL; |
| 14276 | } |
| 14277 | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair")); |
| 14278 | KeyValuePair* kvpair_var; |
| 14279 | if ( |
| 14280 | (kvpair_var = kvpair_rule(p)) // kvpair |
| 14281 | ) |
| 14282 | { |
| 14283 | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair")); |
| 14284 | _res = kvpair_var; |
| 14285 | goto done; |
| 14286 | } |
| 14287 | p->mark = _mark; |
| 14288 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 14289 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair")); |
| 14290 | } |
| 14291 | _res = NULL; |
| 14292 | done: |
| 14293 | D(p->level--); |
| 14294 | return _res; |
| 14295 | } |
| 14296 | |
| 14297 | // kvpair: expression ':' expression |
| 14298 | static KeyValuePair* |
| 14299 | kvpair_rule(Parser *p) |
| 14300 | { |
| 14301 | D(p->level++); |
| 14302 | if (p->error_indicator) { |
| 14303 | D(p->level--); |
| 14304 | return NULL; |
| 14305 | } |
| 14306 | KeyValuePair* _res = NULL; |
| 14307 | int _mark = p->mark; |
| 14308 | { // expression ':' expression |
| 14309 | if (p->error_indicator) { |
| 14310 | D(p->level--); |
| 14311 | return NULL; |
| 14312 | } |
| 14313 | D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
| 14314 | Token * _literal; |
| 14315 | expr_ty a; |
| 14316 | expr_ty b; |
| 14317 | if ( |
| 14318 | (a = expression_rule(p)) // expression |
| 14319 | && |
| 14320 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 14321 | && |
| 14322 | (b = expression_rule(p)) // expression |
| 14323 | ) |
| 14324 | { |
| 14325 | D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
| 14326 | _res = _PyPegen_key_value_pair ( p , a , b ); |
| 14327 | if (_res == NULL && PyErr_Occurred()) { |
| 14328 | p->error_indicator = 1; |
| 14329 | D(p->level--); |
| 14330 | return NULL; |
| 14331 | } |
| 14332 | goto done; |
| 14333 | } |
| 14334 | p->mark = _mark; |
| 14335 | D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 14336 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); |
| 14337 | } |
| 14338 | _res = NULL; |
| 14339 | done: |
| 14340 | D(p->level--); |
| 14341 | return _res; |
| 14342 | } |
| 14343 | |
| 14344 | // for_if_clauses: for_if_clause+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14345 | static asdl_comprehension_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14346 | for_if_clauses_rule(Parser *p) |
| 14347 | { |
| 14348 | D(p->level++); |
| 14349 | if (p->error_indicator) { |
| 14350 | D(p->level--); |
| 14351 | return NULL; |
| 14352 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14353 | asdl_comprehension_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14354 | int _mark = p->mark; |
| 14355 | { // for_if_clause+ |
| 14356 | if (p->error_indicator) { |
| 14357 | D(p->level--); |
| 14358 | return NULL; |
| 14359 | } |
| 14360 | D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14361 | asdl_comprehension_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14362 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14363 | (a = (asdl_comprehension_seq*)_loop1_119_rule(p)) // for_if_clause+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14364 | ) |
| 14365 | { |
| 14366 | D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14367 | _res = a; |
| 14368 | if (_res == NULL && PyErr_Occurred()) { |
| 14369 | p->error_indicator = 1; |
| 14370 | D(p->level--); |
| 14371 | return NULL; |
| 14372 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14373 | goto done; |
| 14374 | } |
| 14375 | p->mark = _mark; |
| 14376 | D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ', |
| 14377 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+")); |
| 14378 | } |
| 14379 | _res = NULL; |
| 14380 | done: |
| 14381 | D(p->level--); |
| 14382 | return _res; |
| 14383 | } |
| 14384 | |
| 14385 | // for_if_clause: |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14386 | // | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
| 14387 | // | 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
| 14388 | // | invalid_for_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14389 | static comprehension_ty |
| 14390 | for_if_clause_rule(Parser *p) |
| 14391 | { |
| 14392 | D(p->level++); |
| 14393 | if (p->error_indicator) { |
| 14394 | D(p->level--); |
| 14395 | return NULL; |
| 14396 | } |
| 14397 | comprehension_ty _res = NULL; |
| 14398 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14399 | { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14400 | if (p->error_indicator) { |
| 14401 | D(p->level--); |
| 14402 | return NULL; |
| 14403 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14404 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
| 14405 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14406 | Token * _keyword; |
| 14407 | Token * _keyword_1; |
| 14408 | expr_ty a; |
| 14409 | Token * async_var; |
| 14410 | expr_ty b; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14411 | asdl_expr_seq* c; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14412 | if ( |
| 14413 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 14414 | && |
| 14415 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 14416 | && |
| 14417 | (a = star_targets_rule(p)) // star_targets |
| 14418 | && |
| 14419 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 14420 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14421 | (_cut_var = 1) |
| 14422 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14423 | (b = disjunction_rule(p)) // disjunction |
| 14424 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14425 | (c = (asdl_expr_seq*)_loop0_120_rule(p)) // (('if' disjunction))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14426 | ) |
| 14427 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14428 | 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))*")); |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 14429 | _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14430 | if (_res == NULL && PyErr_Occurred()) { |
| 14431 | p->error_indicator = 1; |
| 14432 | D(p->level--); |
| 14433 | return NULL; |
| 14434 | } |
| 14435 | goto done; |
| 14436 | } |
| 14437 | p->mark = _mark; |
| 14438 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14439 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
| 14440 | if (_cut_var) { |
| 14441 | D(p->level--); |
| 14442 | return NULL; |
| 14443 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14444 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14445 | { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14446 | if (p->error_indicator) { |
| 14447 | D(p->level--); |
| 14448 | return NULL; |
| 14449 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14450 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
| 14451 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14452 | Token * _keyword; |
| 14453 | Token * _keyword_1; |
| 14454 | expr_ty a; |
| 14455 | expr_ty b; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14456 | asdl_expr_seq* c; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14457 | if ( |
| 14458 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 14459 | && |
| 14460 | (a = star_targets_rule(p)) // star_targets |
| 14461 | && |
| 14462 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 14463 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14464 | (_cut_var = 1) |
| 14465 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14466 | (b = disjunction_rule(p)) // disjunction |
| 14467 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14468 | (c = (asdl_expr_seq*)_loop0_121_rule(p)) // (('if' disjunction))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14469 | ) |
| 14470 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14471 | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14472 | _res = _Py_comprehension ( a , b , c , 0 , p -> arena ); |
| 14473 | if (_res == NULL && PyErr_Occurred()) { |
| 14474 | p->error_indicator = 1; |
| 14475 | D(p->level--); |
| 14476 | return NULL; |
| 14477 | } |
| 14478 | goto done; |
| 14479 | } |
| 14480 | p->mark = _mark; |
| 14481 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14482 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
| 14483 | if (_cut_var) { |
| 14484 | D(p->level--); |
| 14485 | return NULL; |
| 14486 | } |
| 14487 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14488 | if (p->call_invalid_rules) { // invalid_for_target |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14489 | if (p->error_indicator) { |
| 14490 | D(p->level--); |
| 14491 | return NULL; |
| 14492 | } |
| 14493 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
| 14494 | void *invalid_for_target_var; |
| 14495 | if ( |
| 14496 | (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target |
| 14497 | ) |
| 14498 | { |
| 14499 | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
| 14500 | _res = invalid_for_target_var; |
| 14501 | goto done; |
| 14502 | } |
| 14503 | p->mark = _mark; |
| 14504 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
| 14505 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14506 | } |
| 14507 | _res = NULL; |
| 14508 | done: |
| 14509 | D(p->level--); |
| 14510 | return _res; |
| 14511 | } |
| 14512 | |
| 14513 | // yield_expr: 'yield' 'from' expression | 'yield' star_expressions? |
| 14514 | static expr_ty |
| 14515 | yield_expr_rule(Parser *p) |
| 14516 | { |
| 14517 | D(p->level++); |
| 14518 | if (p->error_indicator) { |
| 14519 | D(p->level--); |
| 14520 | return NULL; |
| 14521 | } |
| 14522 | expr_ty _res = NULL; |
| 14523 | int _mark = p->mark; |
| 14524 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14525 | p->error_indicator = 1; |
| 14526 | D(p->level--); |
| 14527 | return NULL; |
| 14528 | } |
| 14529 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14530 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14531 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14532 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14533 | { // 'yield' 'from' expression |
| 14534 | if (p->error_indicator) { |
| 14535 | D(p->level--); |
| 14536 | return NULL; |
| 14537 | } |
| 14538 | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); |
| 14539 | Token * _keyword; |
| 14540 | Token * _keyword_1; |
| 14541 | expr_ty a; |
| 14542 | if ( |
| 14543 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
| 14544 | && |
| 14545 | (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from' |
| 14546 | && |
| 14547 | (a = expression_rule(p)) // expression |
| 14548 | ) |
| 14549 | { |
| 14550 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); |
| 14551 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14552 | if (_token == NULL) { |
| 14553 | D(p->level--); |
| 14554 | return NULL; |
| 14555 | } |
| 14556 | int _end_lineno = _token->end_lineno; |
| 14557 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14558 | int _end_col_offset = _token->end_col_offset; |
| 14559 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14560 | _res = _Py_YieldFrom ( a , EXTRA ); |
| 14561 | if (_res == NULL && PyErr_Occurred()) { |
| 14562 | p->error_indicator = 1; |
| 14563 | D(p->level--); |
| 14564 | return NULL; |
| 14565 | } |
| 14566 | goto done; |
| 14567 | } |
| 14568 | p->mark = _mark; |
| 14569 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 14570 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression")); |
| 14571 | } |
| 14572 | { // 'yield' star_expressions? |
| 14573 | if (p->error_indicator) { |
| 14574 | D(p->level--); |
| 14575 | return NULL; |
| 14576 | } |
| 14577 | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); |
| 14578 | Token * _keyword; |
| 14579 | void *a; |
| 14580 | if ( |
| 14581 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
| 14582 | && |
| 14583 | (a = star_expressions_rule(p), 1) // star_expressions? |
| 14584 | ) |
| 14585 | { |
| 14586 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); |
| 14587 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14588 | if (_token == NULL) { |
| 14589 | D(p->level--); |
| 14590 | return NULL; |
| 14591 | } |
| 14592 | int _end_lineno = _token->end_lineno; |
| 14593 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14594 | int _end_col_offset = _token->end_col_offset; |
| 14595 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14596 | _res = _Py_Yield ( a , EXTRA ); |
| 14597 | if (_res == NULL && PyErr_Occurred()) { |
| 14598 | p->error_indicator = 1; |
| 14599 | D(p->level--); |
| 14600 | return NULL; |
| 14601 | } |
| 14602 | goto done; |
| 14603 | } |
| 14604 | p->mark = _mark; |
| 14605 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 14606 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?")); |
| 14607 | } |
| 14608 | _res = NULL; |
| 14609 | done: |
| 14610 | D(p->level--); |
| 14611 | return _res; |
| 14612 | } |
| 14613 | |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14614 | // arguments: args ','? &')' | invalid_arguments |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14615 | static expr_ty |
| 14616 | arguments_rule(Parser *p) |
| 14617 | { |
| 14618 | D(p->level++); |
| 14619 | if (p->error_indicator) { |
| 14620 | D(p->level--); |
| 14621 | return NULL; |
| 14622 | } |
| 14623 | expr_ty _res = NULL; |
| 14624 | if (_PyPegen_is_memoized(p, arguments_type, &_res)) { |
| 14625 | D(p->level--); |
| 14626 | return _res; |
| 14627 | } |
| 14628 | int _mark = p->mark; |
| 14629 | { // args ','? &')' |
| 14630 | if (p->error_indicator) { |
| 14631 | D(p->level--); |
| 14632 | return NULL; |
| 14633 | } |
| 14634 | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); |
| 14635 | void *_opt_var; |
| 14636 | UNUSED(_opt_var); // Silence compiler warnings |
| 14637 | expr_ty a; |
| 14638 | if ( |
| 14639 | (a = args_rule(p)) // args |
| 14640 | && |
| 14641 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 14642 | && |
| 14643 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 14644 | ) |
| 14645 | { |
| 14646 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); |
| 14647 | _res = a; |
| 14648 | if (_res == NULL && PyErr_Occurred()) { |
| 14649 | p->error_indicator = 1; |
| 14650 | D(p->level--); |
| 14651 | return NULL; |
| 14652 | } |
| 14653 | goto done; |
| 14654 | } |
| 14655 | p->mark = _mark; |
| 14656 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14657 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'")); |
| 14658 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14659 | if (p->call_invalid_rules) { // invalid_arguments |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14660 | if (p->error_indicator) { |
| 14661 | D(p->level--); |
| 14662 | return NULL; |
| 14663 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14664 | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments")); |
| 14665 | void *invalid_arguments_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14666 | if ( |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14667 | (invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14668 | ) |
| 14669 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14670 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments")); |
| 14671 | _res = invalid_arguments_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14672 | goto done; |
| 14673 | } |
| 14674 | p->mark = _mark; |
| 14675 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14676 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14677 | } |
| 14678 | _res = NULL; |
| 14679 | done: |
| 14680 | _PyPegen_insert_memo(p, _mark, arguments_type, _res); |
| 14681 | D(p->level--); |
| 14682 | return _res; |
| 14683 | } |
| 14684 | |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14685 | // args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14686 | static expr_ty |
| 14687 | args_rule(Parser *p) |
| 14688 | { |
| 14689 | D(p->level++); |
| 14690 | if (p->error_indicator) { |
| 14691 | D(p->level--); |
| 14692 | return NULL; |
| 14693 | } |
| 14694 | expr_ty _res = NULL; |
| 14695 | int _mark = p->mark; |
| 14696 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14697 | p->error_indicator = 1; |
| 14698 | D(p->level--); |
| 14699 | return NULL; |
| 14700 | } |
| 14701 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14702 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14703 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14704 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14705 | { // ','.(starred_expression | named_expression !'=')+ [',' kwargs] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14706 | if (p->error_indicator) { |
| 14707 | D(p->level--); |
| 14708 | return NULL; |
| 14709 | } |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14710 | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14711 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14712 | void *b; |
| 14713 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14714 | (a = (asdl_expr_seq*)_gather_122_rule(p)) // ','.(starred_expression | named_expression !'=')+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14715 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14716 | (b = _tmp_124_rule(p), 1) // [',' kwargs] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14717 | ) |
| 14718 | { |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14719 | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]")); |
Pablo Galindo | 315a61f | 2020-09-03 15:29:32 +0100 | [diff] [blame] | 14720 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14721 | if (_token == NULL) { |
| 14722 | D(p->level--); |
| 14723 | return NULL; |
| 14724 | } |
| 14725 | int _end_lineno = _token->end_lineno; |
| 14726 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14727 | int _end_col_offset = _token->end_col_offset; |
| 14728 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14729 | _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14730 | if (_res == NULL && PyErr_Occurred()) { |
| 14731 | p->error_indicator = 1; |
| 14732 | D(p->level--); |
| 14733 | return NULL; |
| 14734 | } |
| 14735 | goto done; |
| 14736 | } |
| 14737 | p->mark = _mark; |
| 14738 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14739 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14740 | } |
| 14741 | { // kwargs |
| 14742 | if (p->error_indicator) { |
| 14743 | D(p->level--); |
| 14744 | return NULL; |
| 14745 | } |
| 14746 | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs")); |
| 14747 | asdl_seq* a; |
| 14748 | if ( |
| 14749 | (a = kwargs_rule(p)) // kwargs |
| 14750 | ) |
| 14751 | { |
| 14752 | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs")); |
| 14753 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14754 | if (_token == NULL) { |
| 14755 | D(p->level--); |
| 14756 | return NULL; |
| 14757 | } |
| 14758 | int _end_lineno = _token->end_lineno; |
| 14759 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14760 | int _end_col_offset = _token->end_col_offset; |
| 14761 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 14762 | _res = _Py_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 ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14763 | if (_res == NULL && PyErr_Occurred()) { |
| 14764 | p->error_indicator = 1; |
| 14765 | D(p->level--); |
| 14766 | return NULL; |
| 14767 | } |
| 14768 | goto done; |
| 14769 | } |
| 14770 | p->mark = _mark; |
| 14771 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
| 14772 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs")); |
| 14773 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14774 | _res = NULL; |
| 14775 | done: |
| 14776 | D(p->level--); |
| 14777 | return _res; |
| 14778 | } |
| 14779 | |
| 14780 | // kwargs: |
| 14781 | // | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
| 14782 | // | ','.kwarg_or_starred+ |
| 14783 | // | ','.kwarg_or_double_starred+ |
| 14784 | static asdl_seq* |
| 14785 | kwargs_rule(Parser *p) |
| 14786 | { |
| 14787 | D(p->level++); |
| 14788 | if (p->error_indicator) { |
| 14789 | D(p->level--); |
| 14790 | return NULL; |
| 14791 | } |
| 14792 | asdl_seq* _res = NULL; |
| 14793 | int _mark = p->mark; |
| 14794 | { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
| 14795 | if (p->error_indicator) { |
| 14796 | D(p->level--); |
| 14797 | return NULL; |
| 14798 | } |
| 14799 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
| 14800 | Token * _literal; |
| 14801 | asdl_seq * a; |
| 14802 | asdl_seq * b; |
| 14803 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14804 | (a = _gather_125_rule(p)) // ','.kwarg_or_starred+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14805 | && |
| 14806 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 14807 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14808 | (b = _gather_127_rule(p)) // ','.kwarg_or_double_starred+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14809 | ) |
| 14810 | { |
| 14811 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
| 14812 | _res = _PyPegen_join_sequences ( p , a , b ); |
| 14813 | if (_res == NULL && PyErr_Occurred()) { |
| 14814 | p->error_indicator = 1; |
| 14815 | D(p->level--); |
| 14816 | return NULL; |
| 14817 | } |
| 14818 | goto done; |
| 14819 | } |
| 14820 | p->mark = _mark; |
| 14821 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 14822 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
| 14823 | } |
| 14824 | { // ','.kwarg_or_starred+ |
| 14825 | if (p->error_indicator) { |
| 14826 | D(p->level--); |
| 14827 | return NULL; |
| 14828 | } |
| 14829 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14830 | asdl_seq * _gather_129_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14831 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14832 | (_gather_129_var = _gather_129_rule(p)) // ','.kwarg_or_starred+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14833 | ) |
| 14834 | { |
| 14835 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14836 | _res = _gather_129_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14837 | goto done; |
| 14838 | } |
| 14839 | p->mark = _mark; |
| 14840 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 14841 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+")); |
| 14842 | } |
| 14843 | { // ','.kwarg_or_double_starred+ |
| 14844 | if (p->error_indicator) { |
| 14845 | D(p->level--); |
| 14846 | return NULL; |
| 14847 | } |
| 14848 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14849 | asdl_seq * _gather_131_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14850 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14851 | (_gather_131_var = _gather_131_rule(p)) // ','.kwarg_or_double_starred+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14852 | ) |
| 14853 | { |
| 14854 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14855 | _res = _gather_131_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14856 | goto done; |
| 14857 | } |
| 14858 | p->mark = _mark; |
| 14859 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 14860 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+")); |
| 14861 | } |
| 14862 | _res = NULL; |
| 14863 | done: |
| 14864 | D(p->level--); |
| 14865 | return _res; |
| 14866 | } |
| 14867 | |
| 14868 | // starred_expression: '*' expression |
| 14869 | static expr_ty |
| 14870 | starred_expression_rule(Parser *p) |
| 14871 | { |
| 14872 | D(p->level++); |
| 14873 | if (p->error_indicator) { |
| 14874 | D(p->level--); |
| 14875 | return NULL; |
| 14876 | } |
| 14877 | expr_ty _res = NULL; |
| 14878 | int _mark = p->mark; |
| 14879 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14880 | p->error_indicator = 1; |
| 14881 | D(p->level--); |
| 14882 | return NULL; |
| 14883 | } |
| 14884 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14885 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14886 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14887 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14888 | { // '*' expression |
| 14889 | if (p->error_indicator) { |
| 14890 | D(p->level--); |
| 14891 | return NULL; |
| 14892 | } |
| 14893 | D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
| 14894 | Token * _literal; |
| 14895 | expr_ty a; |
| 14896 | if ( |
| 14897 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 14898 | && |
| 14899 | (a = expression_rule(p)) // expression |
| 14900 | ) |
| 14901 | { |
| 14902 | D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
| 14903 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14904 | if (_token == NULL) { |
| 14905 | D(p->level--); |
| 14906 | return NULL; |
| 14907 | } |
| 14908 | int _end_lineno = _token->end_lineno; |
| 14909 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14910 | int _end_col_offset = _token->end_col_offset; |
| 14911 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14912 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 14913 | if (_res == NULL && PyErr_Occurred()) { |
| 14914 | p->error_indicator = 1; |
| 14915 | D(p->level--); |
| 14916 | return NULL; |
| 14917 | } |
| 14918 | goto done; |
| 14919 | } |
| 14920 | p->mark = _mark; |
| 14921 | D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 14922 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
| 14923 | } |
| 14924 | _res = NULL; |
| 14925 | done: |
| 14926 | D(p->level--); |
| 14927 | return _res; |
| 14928 | } |
| 14929 | |
| 14930 | // kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg |
| 14931 | static KeywordOrStarred* |
| 14932 | kwarg_or_starred_rule(Parser *p) |
| 14933 | { |
| 14934 | D(p->level++); |
| 14935 | if (p->error_indicator) { |
| 14936 | D(p->level--); |
| 14937 | return NULL; |
| 14938 | } |
| 14939 | KeywordOrStarred* _res = NULL; |
| 14940 | int _mark = p->mark; |
| 14941 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14942 | p->error_indicator = 1; |
| 14943 | D(p->level--); |
| 14944 | return NULL; |
| 14945 | } |
| 14946 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14947 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14948 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14949 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14950 | { // NAME '=' expression |
| 14951 | if (p->error_indicator) { |
| 14952 | D(p->level--); |
| 14953 | return NULL; |
| 14954 | } |
| 14955 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
| 14956 | Token * _literal; |
| 14957 | expr_ty a; |
| 14958 | expr_ty b; |
| 14959 | if ( |
| 14960 | (a = _PyPegen_name_token(p)) // NAME |
| 14961 | && |
| 14962 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 14963 | && |
| 14964 | (b = expression_rule(p)) // expression |
| 14965 | ) |
| 14966 | { |
| 14967 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
| 14968 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14969 | if (_token == NULL) { |
| 14970 | D(p->level--); |
| 14971 | return NULL; |
| 14972 | } |
| 14973 | int _end_lineno = _token->end_lineno; |
| 14974 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14975 | int _end_col_offset = _token->end_col_offset; |
| 14976 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 14977 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14978 | if (_res == NULL && PyErr_Occurred()) { |
| 14979 | p->error_indicator = 1; |
| 14980 | D(p->level--); |
| 14981 | return NULL; |
| 14982 | } |
| 14983 | goto done; |
| 14984 | } |
| 14985 | p->mark = _mark; |
| 14986 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 14987 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
| 14988 | } |
| 14989 | { // starred_expression |
| 14990 | if (p->error_indicator) { |
| 14991 | D(p->level--); |
| 14992 | return NULL; |
| 14993 | } |
| 14994 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
| 14995 | expr_ty a; |
| 14996 | if ( |
| 14997 | (a = starred_expression_rule(p)) // starred_expression |
| 14998 | ) |
| 14999 | { |
| 15000 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
| 15001 | _res = _PyPegen_keyword_or_starred ( p , a , 0 ); |
| 15002 | if (_res == NULL && PyErr_Occurred()) { |
| 15003 | p->error_indicator = 1; |
| 15004 | D(p->level--); |
| 15005 | return NULL; |
| 15006 | } |
| 15007 | goto done; |
| 15008 | } |
| 15009 | p->mark = _mark; |
| 15010 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15011 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
| 15012 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 15013 | if (p->call_invalid_rules) { // invalid_kwarg |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15014 | if (p->error_indicator) { |
| 15015 | D(p->level--); |
| 15016 | return NULL; |
| 15017 | } |
| 15018 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
| 15019 | void *invalid_kwarg_var; |
| 15020 | if ( |
| 15021 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
| 15022 | ) |
| 15023 | { |
| 15024 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
| 15025 | _res = invalid_kwarg_var; |
| 15026 | goto done; |
| 15027 | } |
| 15028 | p->mark = _mark; |
| 15029 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15030 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
| 15031 | } |
| 15032 | _res = NULL; |
| 15033 | done: |
| 15034 | D(p->level--); |
| 15035 | return _res; |
| 15036 | } |
| 15037 | |
| 15038 | // kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg |
| 15039 | static KeywordOrStarred* |
| 15040 | kwarg_or_double_starred_rule(Parser *p) |
| 15041 | { |
| 15042 | D(p->level++); |
| 15043 | if (p->error_indicator) { |
| 15044 | D(p->level--); |
| 15045 | return NULL; |
| 15046 | } |
| 15047 | KeywordOrStarred* _res = NULL; |
| 15048 | int _mark = p->mark; |
| 15049 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15050 | p->error_indicator = 1; |
| 15051 | D(p->level--); |
| 15052 | return NULL; |
| 15053 | } |
| 15054 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15055 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15056 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15057 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15058 | { // NAME '=' expression |
| 15059 | if (p->error_indicator) { |
| 15060 | D(p->level--); |
| 15061 | return NULL; |
| 15062 | } |
| 15063 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
| 15064 | Token * _literal; |
| 15065 | expr_ty a; |
| 15066 | expr_ty b; |
| 15067 | if ( |
| 15068 | (a = _PyPegen_name_token(p)) // NAME |
| 15069 | && |
| 15070 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 15071 | && |
| 15072 | (b = expression_rule(p)) // expression |
| 15073 | ) |
| 15074 | { |
| 15075 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
| 15076 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15077 | if (_token == NULL) { |
| 15078 | D(p->level--); |
| 15079 | return NULL; |
| 15080 | } |
| 15081 | int _end_lineno = _token->end_lineno; |
| 15082 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15083 | int _end_col_offset = _token->end_col_offset; |
| 15084 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 15085 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15086 | if (_res == NULL && PyErr_Occurred()) { |
| 15087 | p->error_indicator = 1; |
| 15088 | D(p->level--); |
| 15089 | return NULL; |
| 15090 | } |
| 15091 | goto done; |
| 15092 | } |
| 15093 | p->mark = _mark; |
| 15094 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15095 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
| 15096 | } |
| 15097 | { // '**' expression |
| 15098 | if (p->error_indicator) { |
| 15099 | D(p->level--); |
| 15100 | return NULL; |
| 15101 | } |
| 15102 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
| 15103 | Token * _literal; |
| 15104 | expr_ty a; |
| 15105 | if ( |
| 15106 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 15107 | && |
| 15108 | (a = expression_rule(p)) // expression |
| 15109 | ) |
| 15110 | { |
| 15111 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
| 15112 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15113 | if (_token == NULL) { |
| 15114 | D(p->level--); |
| 15115 | return NULL; |
| 15116 | } |
| 15117 | int _end_lineno = _token->end_lineno; |
| 15118 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15119 | int _end_col_offset = _token->end_col_offset; |
| 15120 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 15121 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( NULL , a , EXTRA ) ) , 1 ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15122 | if (_res == NULL && PyErr_Occurred()) { |
| 15123 | p->error_indicator = 1; |
| 15124 | D(p->level--); |
| 15125 | return NULL; |
| 15126 | } |
| 15127 | goto done; |
| 15128 | } |
| 15129 | p->mark = _mark; |
| 15130 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15131 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
| 15132 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 15133 | if (p->call_invalid_rules) { // invalid_kwarg |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15134 | if (p->error_indicator) { |
| 15135 | D(p->level--); |
| 15136 | return NULL; |
| 15137 | } |
| 15138 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
| 15139 | void *invalid_kwarg_var; |
| 15140 | if ( |
| 15141 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
| 15142 | ) |
| 15143 | { |
| 15144 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
| 15145 | _res = invalid_kwarg_var; |
| 15146 | goto done; |
| 15147 | } |
| 15148 | p->mark = _mark; |
| 15149 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15150 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
| 15151 | } |
| 15152 | _res = NULL; |
| 15153 | done: |
| 15154 | D(p->level--); |
| 15155 | return _res; |
| 15156 | } |
| 15157 | |
| 15158 | // star_targets: star_target !',' | star_target ((',' star_target))* ','? |
| 15159 | static expr_ty |
| 15160 | star_targets_rule(Parser *p) |
| 15161 | { |
| 15162 | D(p->level++); |
| 15163 | if (p->error_indicator) { |
| 15164 | D(p->level--); |
| 15165 | return NULL; |
| 15166 | } |
| 15167 | expr_ty _res = NULL; |
| 15168 | int _mark = p->mark; |
| 15169 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15170 | p->error_indicator = 1; |
| 15171 | D(p->level--); |
| 15172 | return NULL; |
| 15173 | } |
| 15174 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15175 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15176 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15177 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15178 | { // star_target !',' |
| 15179 | if (p->error_indicator) { |
| 15180 | D(p->level--); |
| 15181 | return NULL; |
| 15182 | } |
| 15183 | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','")); |
| 15184 | expr_ty a; |
| 15185 | if ( |
| 15186 | (a = star_target_rule(p)) // star_target |
| 15187 | && |
| 15188 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
| 15189 | ) |
| 15190 | { |
| 15191 | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','")); |
| 15192 | _res = a; |
| 15193 | if (_res == NULL && PyErr_Occurred()) { |
| 15194 | p->error_indicator = 1; |
| 15195 | D(p->level--); |
| 15196 | return NULL; |
| 15197 | } |
| 15198 | goto done; |
| 15199 | } |
| 15200 | p->mark = _mark; |
| 15201 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 15202 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','")); |
| 15203 | } |
| 15204 | { // star_target ((',' star_target))* ','? |
| 15205 | if (p->error_indicator) { |
| 15206 | D(p->level--); |
| 15207 | return NULL; |
| 15208 | } |
| 15209 | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); |
| 15210 | void *_opt_var; |
| 15211 | UNUSED(_opt_var); // Silence compiler warnings |
| 15212 | expr_ty a; |
| 15213 | asdl_seq * b; |
| 15214 | if ( |
| 15215 | (a = star_target_rule(p)) // star_target |
| 15216 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15217 | (b = _loop0_133_rule(p)) // ((',' star_target))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15218 | && |
| 15219 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 15220 | ) |
| 15221 | { |
| 15222 | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); |
| 15223 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15224 | if (_token == NULL) { |
| 15225 | D(p->level--); |
| 15226 | return NULL; |
| 15227 | } |
| 15228 | int _end_lineno = _token->end_lineno; |
| 15229 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15230 | int _end_col_offset = _token->end_col_offset; |
| 15231 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 15232 | _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15233 | if (_res == NULL && PyErr_Occurred()) { |
| 15234 | p->error_indicator = 1; |
| 15235 | D(p->level--); |
| 15236 | return NULL; |
| 15237 | } |
| 15238 | goto done; |
| 15239 | } |
| 15240 | p->mark = _mark; |
| 15241 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 15242 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?")); |
| 15243 | } |
| 15244 | _res = NULL; |
| 15245 | done: |
| 15246 | D(p->level--); |
| 15247 | return _res; |
| 15248 | } |
| 15249 | |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15250 | // star_targets_list_seq: ','.star_target+ ','? |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15251 | static asdl_expr_seq* |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15252 | star_targets_list_seq_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15253 | { |
| 15254 | D(p->level++); |
| 15255 | if (p->error_indicator) { |
| 15256 | D(p->level--); |
| 15257 | return NULL; |
| 15258 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15259 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15260 | int _mark = p->mark; |
| 15261 | { // ','.star_target+ ','? |
| 15262 | if (p->error_indicator) { |
| 15263 | D(p->level--); |
| 15264 | return NULL; |
| 15265 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15266 | D(fprintf(stderr, "%*c> star_targets_list_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15267 | void *_opt_var; |
| 15268 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15269 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15270 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15271 | (a = (asdl_expr_seq*)_gather_134_rule(p)) // ','.star_target+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15272 | && |
| 15273 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 15274 | ) |
| 15275 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15276 | D(fprintf(stderr, "%*c+ star_targets_list_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15277 | _res = a; |
| 15278 | if (_res == NULL && PyErr_Occurred()) { |
| 15279 | p->error_indicator = 1; |
| 15280 | D(p->level--); |
| 15281 | return NULL; |
| 15282 | } |
| 15283 | goto done; |
| 15284 | } |
| 15285 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15286 | D(fprintf(stderr, "%*c%s star_targets_list_seq[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15287 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?")); |
| 15288 | } |
| 15289 | _res = NULL; |
| 15290 | done: |
| 15291 | D(p->level--); |
| 15292 | return _res; |
| 15293 | } |
| 15294 | |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15295 | // star_targets_tuple_seq: star_target ((',' star_target))+ ','? | star_target ',' |
| 15296 | static asdl_expr_seq* |
| 15297 | star_targets_tuple_seq_rule(Parser *p) |
| 15298 | { |
| 15299 | D(p->level++); |
| 15300 | if (p->error_indicator) { |
| 15301 | D(p->level--); |
| 15302 | return NULL; |
| 15303 | } |
| 15304 | asdl_expr_seq* _res = NULL; |
| 15305 | int _mark = p->mark; |
| 15306 | { // star_target ((',' star_target))+ ','? |
| 15307 | if (p->error_indicator) { |
| 15308 | D(p->level--); |
| 15309 | return NULL; |
| 15310 | } |
| 15311 | D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
| 15312 | void *_opt_var; |
| 15313 | UNUSED(_opt_var); // Silence compiler warnings |
| 15314 | expr_ty a; |
| 15315 | asdl_seq * b; |
| 15316 | if ( |
| 15317 | (a = star_target_rule(p)) // star_target |
| 15318 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15319 | (b = _loop1_136_rule(p)) // ((',' star_target))+ |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15320 | && |
| 15321 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 15322 | ) |
| 15323 | { |
| 15324 | D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
| 15325 | _res = ( asdl_expr_seq * ) _PyPegen_seq_insert_in_front ( p , a , b ); |
| 15326 | if (_res == NULL && PyErr_Occurred()) { |
| 15327 | p->error_indicator = 1; |
| 15328 | D(p->level--); |
| 15329 | return NULL; |
| 15330 | } |
| 15331 | goto done; |
| 15332 | } |
| 15333 | p->mark = _mark; |
| 15334 | D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ', |
| 15335 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
| 15336 | } |
| 15337 | { // star_target ',' |
| 15338 | if (p->error_indicator) { |
| 15339 | D(p->level--); |
| 15340 | return NULL; |
| 15341 | } |
| 15342 | D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ','")); |
| 15343 | Token * _literal; |
| 15344 | expr_ty a; |
| 15345 | if ( |
| 15346 | (a = star_target_rule(p)) // star_target |
| 15347 | && |
| 15348 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 15349 | ) |
| 15350 | { |
| 15351 | D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ','")); |
| 15352 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
| 15353 | if (_res == NULL && PyErr_Occurred()) { |
| 15354 | p->error_indicator = 1; |
| 15355 | D(p->level--); |
| 15356 | return NULL; |
| 15357 | } |
| 15358 | goto done; |
| 15359 | } |
| 15360 | p->mark = _mark; |
| 15361 | D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ', |
| 15362 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ','")); |
| 15363 | } |
| 15364 | _res = NULL; |
| 15365 | done: |
| 15366 | D(p->level--); |
| 15367 | return _res; |
| 15368 | } |
| 15369 | |
| 15370 | // star_target: '*' (!'*' star_target) | target_with_star_atom |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15371 | static expr_ty |
| 15372 | star_target_rule(Parser *p) |
| 15373 | { |
| 15374 | D(p->level++); |
| 15375 | if (p->error_indicator) { |
| 15376 | D(p->level--); |
| 15377 | return NULL; |
| 15378 | } |
| 15379 | expr_ty _res = NULL; |
| 15380 | if (_PyPegen_is_memoized(p, star_target_type, &_res)) { |
| 15381 | D(p->level--); |
| 15382 | return _res; |
| 15383 | } |
| 15384 | int _mark = p->mark; |
| 15385 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15386 | p->error_indicator = 1; |
| 15387 | D(p->level--); |
| 15388 | return NULL; |
| 15389 | } |
| 15390 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15391 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15392 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15393 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15394 | { // '*' (!'*' star_target) |
| 15395 | if (p->error_indicator) { |
| 15396 | D(p->level--); |
| 15397 | return NULL; |
| 15398 | } |
| 15399 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); |
| 15400 | Token * _literal; |
| 15401 | void *a; |
| 15402 | if ( |
| 15403 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 15404 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15405 | (a = _tmp_137_rule(p)) // !'*' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15406 | ) |
| 15407 | { |
| 15408 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); |
| 15409 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15410 | if (_token == NULL) { |
| 15411 | D(p->level--); |
| 15412 | return NULL; |
| 15413 | } |
| 15414 | int _end_lineno = _token->end_lineno; |
| 15415 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15416 | int _end_col_offset = _token->end_col_offset; |
| 15417 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 15418 | _res = _Py_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15419 | if (_res == NULL && PyErr_Occurred()) { |
| 15420 | p->error_indicator = 1; |
| 15421 | D(p->level--); |
| 15422 | return NULL; |
| 15423 | } |
| 15424 | goto done; |
| 15425 | } |
| 15426 | p->mark = _mark; |
| 15427 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15428 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)")); |
| 15429 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15430 | { // target_with_star_atom |
| 15431 | if (p->error_indicator) { |
| 15432 | D(p->level--); |
| 15433 | return NULL; |
| 15434 | } |
| 15435 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target_with_star_atom")); |
| 15436 | expr_ty target_with_star_atom_var; |
| 15437 | if ( |
| 15438 | (target_with_star_atom_var = target_with_star_atom_rule(p)) // target_with_star_atom |
| 15439 | ) |
| 15440 | { |
| 15441 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target_with_star_atom")); |
| 15442 | _res = target_with_star_atom_var; |
| 15443 | goto done; |
| 15444 | } |
| 15445 | p->mark = _mark; |
| 15446 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15447 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target_with_star_atom")); |
| 15448 | } |
| 15449 | _res = NULL; |
| 15450 | done: |
| 15451 | _PyPegen_insert_memo(p, _mark, star_target_type, _res); |
| 15452 | D(p->level--); |
| 15453 | return _res; |
| 15454 | } |
| 15455 | |
| 15456 | // target_with_star_atom: |
| 15457 | // | t_primary '.' NAME !t_lookahead |
| 15458 | // | t_primary '[' slices ']' !t_lookahead |
| 15459 | // | star_atom |
| 15460 | static expr_ty |
| 15461 | target_with_star_atom_rule(Parser *p) |
| 15462 | { |
| 15463 | D(p->level++); |
| 15464 | if (p->error_indicator) { |
| 15465 | D(p->level--); |
| 15466 | return NULL; |
| 15467 | } |
| 15468 | expr_ty _res = NULL; |
| 15469 | if (_PyPegen_is_memoized(p, target_with_star_atom_type, &_res)) { |
| 15470 | D(p->level--); |
| 15471 | return _res; |
| 15472 | } |
| 15473 | int _mark = p->mark; |
| 15474 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15475 | p->error_indicator = 1; |
| 15476 | D(p->level--); |
| 15477 | return NULL; |
| 15478 | } |
| 15479 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15480 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15481 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15482 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15483 | { // t_primary '.' NAME !t_lookahead |
| 15484 | if (p->error_indicator) { |
| 15485 | D(p->level--); |
| 15486 | return NULL; |
| 15487 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15488 | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15489 | Token * _literal; |
| 15490 | expr_ty a; |
| 15491 | expr_ty b; |
| 15492 | if ( |
| 15493 | (a = t_primary_rule(p)) // t_primary |
| 15494 | && |
| 15495 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 15496 | && |
| 15497 | (b = _PyPegen_name_token(p)) // NAME |
| 15498 | && |
| 15499 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 15500 | ) |
| 15501 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15502 | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15503 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15504 | if (_token == NULL) { |
| 15505 | D(p->level--); |
| 15506 | return NULL; |
| 15507 | } |
| 15508 | int _end_lineno = _token->end_lineno; |
| 15509 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15510 | int _end_col_offset = _token->end_col_offset; |
| 15511 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15512 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 15513 | if (_res == NULL && PyErr_Occurred()) { |
| 15514 | p->error_indicator = 1; |
| 15515 | D(p->level--); |
| 15516 | return NULL; |
| 15517 | } |
| 15518 | goto done; |
| 15519 | } |
| 15520 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15521 | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15522 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 15523 | } |
| 15524 | { // t_primary '[' slices ']' !t_lookahead |
| 15525 | if (p->error_indicator) { |
| 15526 | D(p->level--); |
| 15527 | return NULL; |
| 15528 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15529 | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15530 | Token * _literal; |
| 15531 | Token * _literal_1; |
| 15532 | expr_ty a; |
| 15533 | expr_ty b; |
| 15534 | if ( |
| 15535 | (a = t_primary_rule(p)) // t_primary |
| 15536 | && |
| 15537 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 15538 | && |
| 15539 | (b = slices_rule(p)) // slices |
| 15540 | && |
| 15541 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 15542 | && |
| 15543 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 15544 | ) |
| 15545 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15546 | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15547 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15548 | if (_token == NULL) { |
| 15549 | D(p->level--); |
| 15550 | return NULL; |
| 15551 | } |
| 15552 | int _end_lineno = _token->end_lineno; |
| 15553 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15554 | int _end_col_offset = _token->end_col_offset; |
| 15555 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15556 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 15557 | if (_res == NULL && PyErr_Occurred()) { |
| 15558 | p->error_indicator = 1; |
| 15559 | D(p->level--); |
| 15560 | return NULL; |
| 15561 | } |
| 15562 | goto done; |
| 15563 | } |
| 15564 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15565 | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15566 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 15567 | } |
| 15568 | { // star_atom |
| 15569 | if (p->error_indicator) { |
| 15570 | D(p->level--); |
| 15571 | return NULL; |
| 15572 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15573 | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15574 | expr_ty star_atom_var; |
| 15575 | if ( |
| 15576 | (star_atom_var = star_atom_rule(p)) // star_atom |
| 15577 | ) |
| 15578 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15579 | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15580 | _res = star_atom_var; |
| 15581 | goto done; |
| 15582 | } |
| 15583 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15584 | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15585 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom")); |
| 15586 | } |
| 15587 | _res = NULL; |
| 15588 | done: |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15589 | _PyPegen_insert_memo(p, _mark, target_with_star_atom_type, _res); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15590 | D(p->level--); |
| 15591 | return _res; |
| 15592 | } |
| 15593 | |
| 15594 | // star_atom: |
| 15595 | // | NAME |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15596 | // | '(' target_with_star_atom ')' |
| 15597 | // | '(' star_targets_tuple_seq? ')' |
| 15598 | // | '[' star_targets_list_seq? ']' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15599 | static expr_ty |
| 15600 | star_atom_rule(Parser *p) |
| 15601 | { |
| 15602 | D(p->level++); |
| 15603 | if (p->error_indicator) { |
| 15604 | D(p->level--); |
| 15605 | return NULL; |
| 15606 | } |
| 15607 | expr_ty _res = NULL; |
| 15608 | int _mark = p->mark; |
| 15609 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15610 | p->error_indicator = 1; |
| 15611 | D(p->level--); |
| 15612 | return NULL; |
| 15613 | } |
| 15614 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15615 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15616 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15617 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15618 | { // NAME |
| 15619 | if (p->error_indicator) { |
| 15620 | D(p->level--); |
| 15621 | return NULL; |
| 15622 | } |
| 15623 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 15624 | expr_ty a; |
| 15625 | if ( |
| 15626 | (a = _PyPegen_name_token(p)) // NAME |
| 15627 | ) |
| 15628 | { |
| 15629 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 15630 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 15631 | if (_res == NULL && PyErr_Occurred()) { |
| 15632 | p->error_indicator = 1; |
| 15633 | D(p->level--); |
| 15634 | return NULL; |
| 15635 | } |
| 15636 | goto done; |
| 15637 | } |
| 15638 | p->mark = _mark; |
| 15639 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 15640 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 15641 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15642 | { // '(' target_with_star_atom ')' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15643 | if (p->error_indicator) { |
| 15644 | D(p->level--); |
| 15645 | return NULL; |
| 15646 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15647 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15648 | Token * _literal; |
| 15649 | Token * _literal_1; |
| 15650 | expr_ty a; |
| 15651 | if ( |
| 15652 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 15653 | && |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15654 | (a = target_with_star_atom_rule(p)) // target_with_star_atom |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15655 | && |
| 15656 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 15657 | ) |
| 15658 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15659 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15660 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 15661 | if (_res == NULL && PyErr_Occurred()) { |
| 15662 | p->error_indicator = 1; |
| 15663 | D(p->level--); |
| 15664 | return NULL; |
| 15665 | } |
| 15666 | goto done; |
| 15667 | } |
| 15668 | p->mark = _mark; |
| 15669 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15670 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target_with_star_atom ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15671 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15672 | { // '(' star_targets_tuple_seq? ')' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15673 | if (p->error_indicator) { |
| 15674 | D(p->level--); |
| 15675 | return NULL; |
| 15676 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15677 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15678 | Token * _literal; |
| 15679 | Token * _literal_1; |
| 15680 | void *a; |
| 15681 | if ( |
| 15682 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 15683 | && |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15684 | (a = star_targets_tuple_seq_rule(p), 1) // star_targets_tuple_seq? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15685 | && |
| 15686 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 15687 | ) |
| 15688 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15689 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15690 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15691 | if (_token == NULL) { |
| 15692 | D(p->level--); |
| 15693 | return NULL; |
| 15694 | } |
| 15695 | int _end_lineno = _token->end_lineno; |
| 15696 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15697 | int _end_col_offset = _token->end_col_offset; |
| 15698 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15699 | _res = _Py_Tuple ( a , Store , EXTRA ); |
| 15700 | if (_res == NULL && PyErr_Occurred()) { |
| 15701 | p->error_indicator = 1; |
| 15702 | D(p->level--); |
| 15703 | return NULL; |
| 15704 | } |
| 15705 | goto done; |
| 15706 | } |
| 15707 | p->mark = _mark; |
| 15708 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15709 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_tuple_seq? ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15710 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15711 | { // '[' star_targets_list_seq? ']' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15712 | if (p->error_indicator) { |
| 15713 | D(p->level--); |
| 15714 | return NULL; |
| 15715 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15716 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15717 | Token * _literal; |
| 15718 | Token * _literal_1; |
| 15719 | void *a; |
| 15720 | if ( |
| 15721 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 15722 | && |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15723 | (a = star_targets_list_seq_rule(p), 1) // star_targets_list_seq? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15724 | && |
| 15725 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 15726 | ) |
| 15727 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15728 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15729 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15730 | if (_token == NULL) { |
| 15731 | D(p->level--); |
| 15732 | return NULL; |
| 15733 | } |
| 15734 | int _end_lineno = _token->end_lineno; |
| 15735 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15736 | int _end_col_offset = _token->end_col_offset; |
| 15737 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15738 | _res = _Py_List ( a , Store , EXTRA ); |
| 15739 | if (_res == NULL && PyErr_Occurred()) { |
| 15740 | p->error_indicator = 1; |
| 15741 | D(p->level--); |
| 15742 | return NULL; |
| 15743 | } |
| 15744 | goto done; |
| 15745 | } |
| 15746 | p->mark = _mark; |
| 15747 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15748 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_list_seq? ']'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15749 | } |
| 15750 | _res = NULL; |
| 15751 | done: |
| 15752 | D(p->level--); |
| 15753 | return _res; |
| 15754 | } |
| 15755 | |
| 15756 | // single_target: single_subscript_attribute_target | NAME | '(' single_target ')' |
| 15757 | static expr_ty |
| 15758 | single_target_rule(Parser *p) |
| 15759 | { |
| 15760 | D(p->level++); |
| 15761 | if (p->error_indicator) { |
| 15762 | D(p->level--); |
| 15763 | return NULL; |
| 15764 | } |
| 15765 | expr_ty _res = NULL; |
| 15766 | int _mark = p->mark; |
| 15767 | { // single_subscript_attribute_target |
| 15768 | if (p->error_indicator) { |
| 15769 | D(p->level--); |
| 15770 | return NULL; |
| 15771 | } |
| 15772 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
| 15773 | expr_ty single_subscript_attribute_target_var; |
| 15774 | if ( |
| 15775 | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
| 15776 | ) |
| 15777 | { |
| 15778 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
| 15779 | _res = single_subscript_attribute_target_var; |
| 15780 | goto done; |
| 15781 | } |
| 15782 | p->mark = _mark; |
| 15783 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15784 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
| 15785 | } |
| 15786 | { // NAME |
| 15787 | if (p->error_indicator) { |
| 15788 | D(p->level--); |
| 15789 | return NULL; |
| 15790 | } |
| 15791 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 15792 | expr_ty a; |
| 15793 | if ( |
| 15794 | (a = _PyPegen_name_token(p)) // NAME |
| 15795 | ) |
| 15796 | { |
| 15797 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 15798 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 15799 | if (_res == NULL && PyErr_Occurred()) { |
| 15800 | p->error_indicator = 1; |
| 15801 | D(p->level--); |
| 15802 | return NULL; |
| 15803 | } |
| 15804 | goto done; |
| 15805 | } |
| 15806 | p->mark = _mark; |
| 15807 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15808 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 15809 | } |
| 15810 | { // '(' single_target ')' |
| 15811 | if (p->error_indicator) { |
| 15812 | D(p->level--); |
| 15813 | return NULL; |
| 15814 | } |
| 15815 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
| 15816 | Token * _literal; |
| 15817 | Token * _literal_1; |
| 15818 | expr_ty a; |
| 15819 | if ( |
| 15820 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 15821 | && |
| 15822 | (a = single_target_rule(p)) // single_target |
| 15823 | && |
| 15824 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 15825 | ) |
| 15826 | { |
| 15827 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
| 15828 | _res = a; |
| 15829 | if (_res == NULL && PyErr_Occurred()) { |
| 15830 | p->error_indicator = 1; |
| 15831 | D(p->level--); |
| 15832 | return NULL; |
| 15833 | } |
| 15834 | goto done; |
| 15835 | } |
| 15836 | p->mark = _mark; |
| 15837 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15838 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
| 15839 | } |
| 15840 | _res = NULL; |
| 15841 | done: |
| 15842 | D(p->level--); |
| 15843 | return _res; |
| 15844 | } |
| 15845 | |
| 15846 | // single_subscript_attribute_target: |
| 15847 | // | t_primary '.' NAME !t_lookahead |
| 15848 | // | t_primary '[' slices ']' !t_lookahead |
| 15849 | static expr_ty |
| 15850 | single_subscript_attribute_target_rule(Parser *p) |
| 15851 | { |
| 15852 | D(p->level++); |
| 15853 | if (p->error_indicator) { |
| 15854 | D(p->level--); |
| 15855 | return NULL; |
| 15856 | } |
| 15857 | expr_ty _res = NULL; |
| 15858 | int _mark = p->mark; |
| 15859 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15860 | p->error_indicator = 1; |
| 15861 | D(p->level--); |
| 15862 | return NULL; |
| 15863 | } |
| 15864 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15865 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15866 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15867 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15868 | { // t_primary '.' NAME !t_lookahead |
| 15869 | if (p->error_indicator) { |
| 15870 | D(p->level--); |
| 15871 | return NULL; |
| 15872 | } |
| 15873 | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 15874 | Token * _literal; |
| 15875 | expr_ty a; |
| 15876 | expr_ty b; |
| 15877 | if ( |
| 15878 | (a = t_primary_rule(p)) // t_primary |
| 15879 | && |
| 15880 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 15881 | && |
| 15882 | (b = _PyPegen_name_token(p)) // NAME |
| 15883 | && |
| 15884 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 15885 | ) |
| 15886 | { |
| 15887 | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 15888 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15889 | if (_token == NULL) { |
| 15890 | D(p->level--); |
| 15891 | return NULL; |
| 15892 | } |
| 15893 | int _end_lineno = _token->end_lineno; |
| 15894 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15895 | int _end_col_offset = _token->end_col_offset; |
| 15896 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15897 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 15898 | if (_res == NULL && PyErr_Occurred()) { |
| 15899 | p->error_indicator = 1; |
| 15900 | D(p->level--); |
| 15901 | return NULL; |
| 15902 | } |
| 15903 | goto done; |
| 15904 | } |
| 15905 | p->mark = _mark; |
| 15906 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15907 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 15908 | } |
| 15909 | { // t_primary '[' slices ']' !t_lookahead |
| 15910 | if (p->error_indicator) { |
| 15911 | D(p->level--); |
| 15912 | return NULL; |
| 15913 | } |
| 15914 | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 15915 | Token * _literal; |
| 15916 | Token * _literal_1; |
| 15917 | expr_ty a; |
| 15918 | expr_ty b; |
| 15919 | if ( |
| 15920 | (a = t_primary_rule(p)) // t_primary |
| 15921 | && |
| 15922 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 15923 | && |
| 15924 | (b = slices_rule(p)) // slices |
| 15925 | && |
| 15926 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 15927 | && |
| 15928 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 15929 | ) |
| 15930 | { |
| 15931 | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 15932 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15933 | if (_token == NULL) { |
| 15934 | D(p->level--); |
| 15935 | return NULL; |
| 15936 | } |
| 15937 | int _end_lineno = _token->end_lineno; |
| 15938 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15939 | int _end_col_offset = _token->end_col_offset; |
| 15940 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15941 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 15942 | if (_res == NULL && PyErr_Occurred()) { |
| 15943 | p->error_indicator = 1; |
| 15944 | D(p->level--); |
| 15945 | return NULL; |
| 15946 | } |
| 15947 | goto done; |
| 15948 | } |
| 15949 | p->mark = _mark; |
| 15950 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15951 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 15952 | } |
| 15953 | _res = NULL; |
| 15954 | done: |
| 15955 | D(p->level--); |
| 15956 | return _res; |
| 15957 | } |
| 15958 | |
| 15959 | // del_targets: ','.del_target+ ','? |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15960 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15961 | del_targets_rule(Parser *p) |
| 15962 | { |
| 15963 | D(p->level++); |
| 15964 | if (p->error_indicator) { |
| 15965 | D(p->level--); |
| 15966 | return NULL; |
| 15967 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15968 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15969 | int _mark = p->mark; |
| 15970 | { // ','.del_target+ ','? |
| 15971 | if (p->error_indicator) { |
| 15972 | D(p->level--); |
| 15973 | return NULL; |
| 15974 | } |
| 15975 | D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); |
| 15976 | void *_opt_var; |
| 15977 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15978 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15979 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15980 | (a = (asdl_expr_seq*)_gather_138_rule(p)) // ','.del_target+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15981 | && |
| 15982 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 15983 | ) |
| 15984 | { |
| 15985 | D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); |
| 15986 | _res = a; |
| 15987 | if (_res == NULL && PyErr_Occurred()) { |
| 15988 | p->error_indicator = 1; |
| 15989 | D(p->level--); |
| 15990 | return NULL; |
| 15991 | } |
| 15992 | goto done; |
| 15993 | } |
| 15994 | p->mark = _mark; |
| 15995 | D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 15996 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?")); |
| 15997 | } |
| 15998 | _res = NULL; |
| 15999 | done: |
| 16000 | D(p->level--); |
| 16001 | return _res; |
| 16002 | } |
| 16003 | |
| 16004 | // del_target: |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16005 | // | t_primary '.' NAME !t_lookahead |
| 16006 | // | t_primary '[' slices ']' !t_lookahead |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16007 | // | del_t_atom |
| 16008 | static expr_ty |
| 16009 | del_target_rule(Parser *p) |
| 16010 | { |
| 16011 | D(p->level++); |
| 16012 | if (p->error_indicator) { |
| 16013 | D(p->level--); |
| 16014 | return NULL; |
| 16015 | } |
| 16016 | expr_ty _res = NULL; |
| 16017 | if (_PyPegen_is_memoized(p, del_target_type, &_res)) { |
| 16018 | D(p->level--); |
| 16019 | return _res; |
| 16020 | } |
| 16021 | int _mark = p->mark; |
| 16022 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16023 | p->error_indicator = 1; |
| 16024 | D(p->level--); |
| 16025 | return NULL; |
| 16026 | } |
| 16027 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16028 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16029 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16030 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16031 | { // t_primary '.' NAME !t_lookahead |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16032 | if (p->error_indicator) { |
| 16033 | D(p->level--); |
| 16034 | return NULL; |
| 16035 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16036 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16037 | Token * _literal; |
| 16038 | expr_ty a; |
| 16039 | expr_ty b; |
| 16040 | if ( |
| 16041 | (a = t_primary_rule(p)) // t_primary |
| 16042 | && |
| 16043 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 16044 | && |
| 16045 | (b = _PyPegen_name_token(p)) // NAME |
| 16046 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16047 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16048 | ) |
| 16049 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16050 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16051 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16052 | if (_token == NULL) { |
| 16053 | D(p->level--); |
| 16054 | return NULL; |
| 16055 | } |
| 16056 | int _end_lineno = _token->end_lineno; |
| 16057 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16058 | int _end_col_offset = _token->end_col_offset; |
| 16059 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16060 | _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA ); |
| 16061 | if (_res == NULL && PyErr_Occurred()) { |
| 16062 | p->error_indicator = 1; |
| 16063 | D(p->level--); |
| 16064 | return NULL; |
| 16065 | } |
| 16066 | goto done; |
| 16067 | } |
| 16068 | p->mark = _mark; |
| 16069 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16070 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16071 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16072 | { // t_primary '[' slices ']' !t_lookahead |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16073 | if (p->error_indicator) { |
| 16074 | D(p->level--); |
| 16075 | return NULL; |
| 16076 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16077 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16078 | Token * _literal; |
| 16079 | Token * _literal_1; |
| 16080 | expr_ty a; |
| 16081 | expr_ty b; |
| 16082 | if ( |
| 16083 | (a = t_primary_rule(p)) // t_primary |
| 16084 | && |
| 16085 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16086 | && |
| 16087 | (b = slices_rule(p)) // slices |
| 16088 | && |
| 16089 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16090 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16091 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16092 | ) |
| 16093 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16094 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16095 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16096 | if (_token == NULL) { |
| 16097 | D(p->level--); |
| 16098 | return NULL; |
| 16099 | } |
| 16100 | int _end_lineno = _token->end_lineno; |
| 16101 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16102 | int _end_col_offset = _token->end_col_offset; |
| 16103 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16104 | _res = _Py_Subscript ( a , b , Del , EXTRA ); |
| 16105 | if (_res == NULL && PyErr_Occurred()) { |
| 16106 | p->error_indicator = 1; |
| 16107 | D(p->level--); |
| 16108 | return NULL; |
| 16109 | } |
| 16110 | goto done; |
| 16111 | } |
| 16112 | p->mark = _mark; |
| 16113 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16114 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16115 | } |
| 16116 | { // del_t_atom |
| 16117 | if (p->error_indicator) { |
| 16118 | D(p->level--); |
| 16119 | return NULL; |
| 16120 | } |
| 16121 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom")); |
| 16122 | expr_ty del_t_atom_var; |
| 16123 | if ( |
| 16124 | (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom |
| 16125 | ) |
| 16126 | { |
| 16127 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom")); |
| 16128 | _res = del_t_atom_var; |
| 16129 | goto done; |
| 16130 | } |
| 16131 | p->mark = _mark; |
| 16132 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 16133 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom")); |
| 16134 | } |
| 16135 | _res = NULL; |
| 16136 | done: |
| 16137 | _PyPegen_insert_memo(p, _mark, del_target_type, _res); |
| 16138 | D(p->level--); |
| 16139 | return _res; |
| 16140 | } |
| 16141 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16142 | // del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16143 | static expr_ty |
| 16144 | del_t_atom_rule(Parser *p) |
| 16145 | { |
| 16146 | D(p->level++); |
| 16147 | if (p->error_indicator) { |
| 16148 | D(p->level--); |
| 16149 | return NULL; |
| 16150 | } |
| 16151 | expr_ty _res = NULL; |
| 16152 | int _mark = p->mark; |
| 16153 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16154 | p->error_indicator = 1; |
| 16155 | D(p->level--); |
| 16156 | return NULL; |
| 16157 | } |
| 16158 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16159 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16160 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16161 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16162 | { // NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16163 | if (p->error_indicator) { |
| 16164 | D(p->level--); |
| 16165 | return NULL; |
| 16166 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16167 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16168 | expr_ty a; |
| 16169 | if ( |
| 16170 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16171 | ) |
| 16172 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16173 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16174 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
| 16175 | if (_res == NULL && PyErr_Occurred()) { |
| 16176 | p->error_indicator = 1; |
| 16177 | D(p->level--); |
| 16178 | return NULL; |
| 16179 | } |
| 16180 | goto done; |
| 16181 | } |
| 16182 | p->mark = _mark; |
| 16183 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16184 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16185 | } |
| 16186 | { // '(' del_target ')' |
| 16187 | if (p->error_indicator) { |
| 16188 | D(p->level--); |
| 16189 | return NULL; |
| 16190 | } |
| 16191 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); |
| 16192 | Token * _literal; |
| 16193 | Token * _literal_1; |
| 16194 | expr_ty a; |
| 16195 | if ( |
| 16196 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16197 | && |
| 16198 | (a = del_target_rule(p)) // del_target |
| 16199 | && |
| 16200 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16201 | ) |
| 16202 | { |
| 16203 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); |
| 16204 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
| 16205 | if (_res == NULL && PyErr_Occurred()) { |
| 16206 | p->error_indicator = 1; |
| 16207 | D(p->level--); |
| 16208 | return NULL; |
| 16209 | } |
| 16210 | goto done; |
| 16211 | } |
| 16212 | p->mark = _mark; |
| 16213 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16214 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'")); |
| 16215 | } |
| 16216 | { // '(' del_targets? ')' |
| 16217 | if (p->error_indicator) { |
| 16218 | D(p->level--); |
| 16219 | return NULL; |
| 16220 | } |
| 16221 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); |
| 16222 | Token * _literal; |
| 16223 | Token * _literal_1; |
| 16224 | void *a; |
| 16225 | if ( |
| 16226 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16227 | && |
| 16228 | (a = del_targets_rule(p), 1) // del_targets? |
| 16229 | && |
| 16230 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16231 | ) |
| 16232 | { |
| 16233 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); |
| 16234 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16235 | if (_token == NULL) { |
| 16236 | D(p->level--); |
| 16237 | return NULL; |
| 16238 | } |
| 16239 | int _end_lineno = _token->end_lineno; |
| 16240 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16241 | int _end_col_offset = _token->end_col_offset; |
| 16242 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16243 | _res = _Py_Tuple ( a , Del , EXTRA ); |
| 16244 | if (_res == NULL && PyErr_Occurred()) { |
| 16245 | p->error_indicator = 1; |
| 16246 | D(p->level--); |
| 16247 | return NULL; |
| 16248 | } |
| 16249 | goto done; |
| 16250 | } |
| 16251 | p->mark = _mark; |
| 16252 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16253 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'")); |
| 16254 | } |
| 16255 | { // '[' del_targets? ']' |
| 16256 | if (p->error_indicator) { |
| 16257 | D(p->level--); |
| 16258 | return NULL; |
| 16259 | } |
| 16260 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); |
| 16261 | Token * _literal; |
| 16262 | Token * _literal_1; |
| 16263 | void *a; |
| 16264 | if ( |
| 16265 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16266 | && |
| 16267 | (a = del_targets_rule(p), 1) // del_targets? |
| 16268 | && |
| 16269 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16270 | ) |
| 16271 | { |
| 16272 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); |
| 16273 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16274 | if (_token == NULL) { |
| 16275 | D(p->level--); |
| 16276 | return NULL; |
| 16277 | } |
| 16278 | int _end_lineno = _token->end_lineno; |
| 16279 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16280 | int _end_col_offset = _token->end_col_offset; |
| 16281 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16282 | _res = _Py_List ( a , Del , EXTRA ); |
| 16283 | if (_res == NULL && PyErr_Occurred()) { |
| 16284 | p->error_indicator = 1; |
| 16285 | D(p->level--); |
| 16286 | return NULL; |
| 16287 | } |
| 16288 | goto done; |
| 16289 | } |
| 16290 | p->mark = _mark; |
| 16291 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16292 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'")); |
| 16293 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16294 | _res = NULL; |
| 16295 | done: |
| 16296 | D(p->level--); |
| 16297 | return _res; |
| 16298 | } |
| 16299 | |
| 16300 | // targets: ','.target+ ','? |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 16301 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16302 | targets_rule(Parser *p) |
| 16303 | { |
| 16304 | D(p->level++); |
| 16305 | if (p->error_indicator) { |
| 16306 | D(p->level--); |
| 16307 | return NULL; |
| 16308 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 16309 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16310 | int _mark = p->mark; |
| 16311 | { // ','.target+ ','? |
| 16312 | if (p->error_indicator) { |
| 16313 | D(p->level--); |
| 16314 | return NULL; |
| 16315 | } |
| 16316 | D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); |
| 16317 | void *_opt_var; |
| 16318 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 16319 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16320 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 16321 | (a = (asdl_expr_seq*)_gather_140_rule(p)) // ','.target+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16322 | && |
| 16323 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 16324 | ) |
| 16325 | { |
| 16326 | D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); |
| 16327 | _res = a; |
| 16328 | if (_res == NULL && PyErr_Occurred()) { |
| 16329 | p->error_indicator = 1; |
| 16330 | D(p->level--); |
| 16331 | return NULL; |
| 16332 | } |
| 16333 | goto done; |
| 16334 | } |
| 16335 | p->mark = _mark; |
| 16336 | D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 16337 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?")); |
| 16338 | } |
| 16339 | _res = NULL; |
| 16340 | done: |
| 16341 | D(p->level--); |
| 16342 | return _res; |
| 16343 | } |
| 16344 | |
| 16345 | // target: |
| 16346 | // | t_primary '.' NAME !t_lookahead |
| 16347 | // | t_primary '[' slices ']' !t_lookahead |
| 16348 | // | t_atom |
| 16349 | static expr_ty |
| 16350 | target_rule(Parser *p) |
| 16351 | { |
| 16352 | D(p->level++); |
| 16353 | if (p->error_indicator) { |
| 16354 | D(p->level--); |
| 16355 | return NULL; |
| 16356 | } |
| 16357 | expr_ty _res = NULL; |
| 16358 | if (_PyPegen_is_memoized(p, target_type, &_res)) { |
| 16359 | D(p->level--); |
| 16360 | return _res; |
| 16361 | } |
| 16362 | int _mark = p->mark; |
| 16363 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16364 | p->error_indicator = 1; |
| 16365 | D(p->level--); |
| 16366 | return NULL; |
| 16367 | } |
| 16368 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16369 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16370 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16371 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 16372 | { // t_primary '.' NAME !t_lookahead |
| 16373 | if (p->error_indicator) { |
| 16374 | D(p->level--); |
| 16375 | return NULL; |
| 16376 | } |
| 16377 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 16378 | Token * _literal; |
| 16379 | expr_ty a; |
| 16380 | expr_ty b; |
| 16381 | if ( |
| 16382 | (a = t_primary_rule(p)) // t_primary |
| 16383 | && |
| 16384 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 16385 | && |
| 16386 | (b = _PyPegen_name_token(p)) // NAME |
| 16387 | && |
| 16388 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 16389 | ) |
| 16390 | { |
| 16391 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 16392 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16393 | if (_token == NULL) { |
| 16394 | D(p->level--); |
| 16395 | return NULL; |
| 16396 | } |
| 16397 | int _end_lineno = _token->end_lineno; |
| 16398 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16399 | int _end_col_offset = _token->end_col_offset; |
| 16400 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16401 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 16402 | if (_res == NULL && PyErr_Occurred()) { |
| 16403 | p->error_indicator = 1; |
| 16404 | D(p->level--); |
| 16405 | return NULL; |
| 16406 | } |
| 16407 | goto done; |
| 16408 | } |
| 16409 | p->mark = _mark; |
| 16410 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 16411 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 16412 | } |
| 16413 | { // t_primary '[' slices ']' !t_lookahead |
| 16414 | if (p->error_indicator) { |
| 16415 | D(p->level--); |
| 16416 | return NULL; |
| 16417 | } |
| 16418 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 16419 | Token * _literal; |
| 16420 | Token * _literal_1; |
| 16421 | expr_ty a; |
| 16422 | expr_ty b; |
| 16423 | if ( |
| 16424 | (a = t_primary_rule(p)) // t_primary |
| 16425 | && |
| 16426 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16427 | && |
| 16428 | (b = slices_rule(p)) // slices |
| 16429 | && |
| 16430 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16431 | && |
| 16432 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 16433 | ) |
| 16434 | { |
| 16435 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 16436 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16437 | if (_token == NULL) { |
| 16438 | D(p->level--); |
| 16439 | return NULL; |
| 16440 | } |
| 16441 | int _end_lineno = _token->end_lineno; |
| 16442 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16443 | int _end_col_offset = _token->end_col_offset; |
| 16444 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16445 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 16446 | if (_res == NULL && PyErr_Occurred()) { |
| 16447 | p->error_indicator = 1; |
| 16448 | D(p->level--); |
| 16449 | return NULL; |
| 16450 | } |
| 16451 | goto done; |
| 16452 | } |
| 16453 | p->mark = _mark; |
| 16454 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 16455 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 16456 | } |
| 16457 | { // t_atom |
| 16458 | if (p->error_indicator) { |
| 16459 | D(p->level--); |
| 16460 | return NULL; |
| 16461 | } |
| 16462 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom")); |
| 16463 | expr_ty t_atom_var; |
| 16464 | if ( |
| 16465 | (t_atom_var = t_atom_rule(p)) // t_atom |
| 16466 | ) |
| 16467 | { |
| 16468 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom")); |
| 16469 | _res = t_atom_var; |
| 16470 | goto done; |
| 16471 | } |
| 16472 | p->mark = _mark; |
| 16473 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 16474 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom")); |
| 16475 | } |
| 16476 | _res = NULL; |
| 16477 | done: |
| 16478 | _PyPegen_insert_memo(p, _mark, target_type, _res); |
| 16479 | D(p->level--); |
| 16480 | return _res; |
| 16481 | } |
| 16482 | |
| 16483 | // Left-recursive |
| 16484 | // t_primary: |
| 16485 | // | t_primary '.' NAME &t_lookahead |
| 16486 | // | t_primary '[' slices ']' &t_lookahead |
| 16487 | // | t_primary genexp &t_lookahead |
| 16488 | // | t_primary '(' arguments? ')' &t_lookahead |
| 16489 | // | atom &t_lookahead |
| 16490 | static expr_ty t_primary_raw(Parser *); |
| 16491 | static expr_ty |
| 16492 | t_primary_rule(Parser *p) |
| 16493 | { |
| 16494 | D(p->level++); |
| 16495 | expr_ty _res = NULL; |
| 16496 | if (_PyPegen_is_memoized(p, t_primary_type, &_res)) { |
| 16497 | D(p->level--); |
| 16498 | return _res; |
| 16499 | } |
| 16500 | int _mark = p->mark; |
| 16501 | int _resmark = p->mark; |
| 16502 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 16503 | int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); |
| 16504 | if (tmpvar_9) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16505 | D(p->level--); |
| 16506 | return _res; |
| 16507 | } |
| 16508 | p->mark = _mark; |
| 16509 | void *_raw = t_primary_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 16510 | if (p->error_indicator) |
| 16511 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16512 | if (_raw == NULL || p->mark <= _resmark) |
| 16513 | break; |
| 16514 | _resmark = p->mark; |
| 16515 | _res = _raw; |
| 16516 | } |
| 16517 | p->mark = _resmark; |
| 16518 | D(p->level--); |
| 16519 | return _res; |
| 16520 | } |
| 16521 | static expr_ty |
| 16522 | t_primary_raw(Parser *p) |
| 16523 | { |
| 16524 | D(p->level++); |
| 16525 | if (p->error_indicator) { |
| 16526 | D(p->level--); |
| 16527 | return NULL; |
| 16528 | } |
| 16529 | expr_ty _res = NULL; |
| 16530 | int _mark = p->mark; |
| 16531 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16532 | p->error_indicator = 1; |
| 16533 | D(p->level--); |
| 16534 | return NULL; |
| 16535 | } |
| 16536 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16537 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16538 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16539 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 16540 | { // t_primary '.' NAME &t_lookahead |
| 16541 | if (p->error_indicator) { |
| 16542 | D(p->level--); |
| 16543 | return NULL; |
| 16544 | } |
| 16545 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
| 16546 | Token * _literal; |
| 16547 | expr_ty a; |
| 16548 | expr_ty b; |
| 16549 | if ( |
| 16550 | (a = t_primary_rule(p)) // t_primary |
| 16551 | && |
| 16552 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 16553 | && |
| 16554 | (b = _PyPegen_name_token(p)) // NAME |
| 16555 | && |
| 16556 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16557 | ) |
| 16558 | { |
| 16559 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
| 16560 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16561 | if (_token == NULL) { |
| 16562 | D(p->level--); |
| 16563 | return NULL; |
| 16564 | } |
| 16565 | int _end_lineno = _token->end_lineno; |
| 16566 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16567 | int _end_col_offset = _token->end_col_offset; |
| 16568 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16569 | _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
| 16570 | if (_res == NULL && PyErr_Occurred()) { |
| 16571 | p->error_indicator = 1; |
| 16572 | D(p->level--); |
| 16573 | return NULL; |
| 16574 | } |
| 16575 | goto done; |
| 16576 | } |
| 16577 | p->mark = _mark; |
| 16578 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16579 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
| 16580 | } |
| 16581 | { // t_primary '[' slices ']' &t_lookahead |
| 16582 | if (p->error_indicator) { |
| 16583 | D(p->level--); |
| 16584 | return NULL; |
| 16585 | } |
| 16586 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
| 16587 | Token * _literal; |
| 16588 | Token * _literal_1; |
| 16589 | expr_ty a; |
| 16590 | expr_ty b; |
| 16591 | if ( |
| 16592 | (a = t_primary_rule(p)) // t_primary |
| 16593 | && |
| 16594 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16595 | && |
| 16596 | (b = slices_rule(p)) // slices |
| 16597 | && |
| 16598 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16599 | && |
| 16600 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16601 | ) |
| 16602 | { |
| 16603 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
| 16604 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16605 | if (_token == NULL) { |
| 16606 | D(p->level--); |
| 16607 | return NULL; |
| 16608 | } |
| 16609 | int _end_lineno = _token->end_lineno; |
| 16610 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16611 | int _end_col_offset = _token->end_col_offset; |
| 16612 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16613 | _res = _Py_Subscript ( a , b , Load , EXTRA ); |
| 16614 | if (_res == NULL && PyErr_Occurred()) { |
| 16615 | p->error_indicator = 1; |
| 16616 | D(p->level--); |
| 16617 | return NULL; |
| 16618 | } |
| 16619 | goto done; |
| 16620 | } |
| 16621 | p->mark = _mark; |
| 16622 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16623 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
| 16624 | } |
| 16625 | { // t_primary genexp &t_lookahead |
| 16626 | if (p->error_indicator) { |
| 16627 | D(p->level--); |
| 16628 | return NULL; |
| 16629 | } |
| 16630 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); |
| 16631 | expr_ty a; |
| 16632 | expr_ty b; |
| 16633 | if ( |
| 16634 | (a = t_primary_rule(p)) // t_primary |
| 16635 | && |
| 16636 | (b = genexp_rule(p)) // genexp |
| 16637 | && |
| 16638 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16639 | ) |
| 16640 | { |
| 16641 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); |
| 16642 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16643 | if (_token == NULL) { |
| 16644 | D(p->level--); |
| 16645 | return NULL; |
| 16646 | } |
| 16647 | int _end_lineno = _token->end_lineno; |
| 16648 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16649 | int _end_col_offset = _token->end_col_offset; |
| 16650 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 16651 | _res = _Py_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16652 | if (_res == NULL && PyErr_Occurred()) { |
| 16653 | p->error_indicator = 1; |
| 16654 | D(p->level--); |
| 16655 | return NULL; |
| 16656 | } |
| 16657 | goto done; |
| 16658 | } |
| 16659 | p->mark = _mark; |
| 16660 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16661 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead")); |
| 16662 | } |
| 16663 | { // t_primary '(' arguments? ')' &t_lookahead |
| 16664 | if (p->error_indicator) { |
| 16665 | D(p->level--); |
| 16666 | return NULL; |
| 16667 | } |
| 16668 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
| 16669 | Token * _literal; |
| 16670 | Token * _literal_1; |
| 16671 | expr_ty a; |
| 16672 | void *b; |
| 16673 | if ( |
| 16674 | (a = t_primary_rule(p)) // t_primary |
| 16675 | && |
| 16676 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16677 | && |
| 16678 | (b = arguments_rule(p), 1) // arguments? |
| 16679 | && |
| 16680 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16681 | && |
| 16682 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16683 | ) |
| 16684 | { |
| 16685 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
| 16686 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16687 | if (_token == NULL) { |
| 16688 | D(p->level--); |
| 16689 | return NULL; |
| 16690 | } |
| 16691 | int _end_lineno = _token->end_lineno; |
| 16692 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16693 | int _end_col_offset = _token->end_col_offset; |
| 16694 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16695 | _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 16696 | if (_res == NULL && PyErr_Occurred()) { |
| 16697 | p->error_indicator = 1; |
| 16698 | D(p->level--); |
| 16699 | return NULL; |
| 16700 | } |
| 16701 | goto done; |
| 16702 | } |
| 16703 | p->mark = _mark; |
| 16704 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16705 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
| 16706 | } |
| 16707 | { // atom &t_lookahead |
| 16708 | if (p->error_indicator) { |
| 16709 | D(p->level--); |
| 16710 | return NULL; |
| 16711 | } |
| 16712 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); |
| 16713 | expr_ty a; |
| 16714 | if ( |
| 16715 | (a = atom_rule(p)) // atom |
| 16716 | && |
| 16717 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16718 | ) |
| 16719 | { |
| 16720 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); |
| 16721 | _res = a; |
| 16722 | if (_res == NULL && PyErr_Occurred()) { |
| 16723 | p->error_indicator = 1; |
| 16724 | D(p->level--); |
| 16725 | return NULL; |
| 16726 | } |
| 16727 | goto done; |
| 16728 | } |
| 16729 | p->mark = _mark; |
| 16730 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16731 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead")); |
| 16732 | } |
| 16733 | _res = NULL; |
| 16734 | done: |
| 16735 | D(p->level--); |
| 16736 | return _res; |
| 16737 | } |
| 16738 | |
| 16739 | // t_lookahead: '(' | '[' | '.' |
| 16740 | static void * |
| 16741 | t_lookahead_rule(Parser *p) |
| 16742 | { |
| 16743 | D(p->level++); |
| 16744 | if (p->error_indicator) { |
| 16745 | D(p->level--); |
| 16746 | return NULL; |
| 16747 | } |
| 16748 | void * _res = NULL; |
| 16749 | int _mark = p->mark; |
| 16750 | { // '(' |
| 16751 | if (p->error_indicator) { |
| 16752 | D(p->level--); |
| 16753 | return NULL; |
| 16754 | } |
| 16755 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
| 16756 | Token * _literal; |
| 16757 | if ( |
| 16758 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16759 | ) |
| 16760 | { |
| 16761 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
| 16762 | _res = _literal; |
| 16763 | goto done; |
| 16764 | } |
| 16765 | p->mark = _mark; |
| 16766 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 16767 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
| 16768 | } |
| 16769 | { // '[' |
| 16770 | if (p->error_indicator) { |
| 16771 | D(p->level--); |
| 16772 | return NULL; |
| 16773 | } |
| 16774 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
| 16775 | Token * _literal; |
| 16776 | if ( |
| 16777 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16778 | ) |
| 16779 | { |
| 16780 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
| 16781 | _res = _literal; |
| 16782 | goto done; |
| 16783 | } |
| 16784 | p->mark = _mark; |
| 16785 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 16786 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
| 16787 | } |
| 16788 | { // '.' |
| 16789 | if (p->error_indicator) { |
| 16790 | D(p->level--); |
| 16791 | return NULL; |
| 16792 | } |
| 16793 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 16794 | Token * _literal; |
| 16795 | if ( |
| 16796 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 16797 | ) |
| 16798 | { |
| 16799 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 16800 | _res = _literal; |
| 16801 | goto done; |
| 16802 | } |
| 16803 | p->mark = _mark; |
| 16804 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 16805 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 16806 | } |
| 16807 | _res = NULL; |
| 16808 | done: |
| 16809 | D(p->level--); |
| 16810 | return _res; |
| 16811 | } |
| 16812 | |
| 16813 | // t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']' |
| 16814 | static expr_ty |
| 16815 | t_atom_rule(Parser *p) |
| 16816 | { |
| 16817 | D(p->level++); |
| 16818 | if (p->error_indicator) { |
| 16819 | D(p->level--); |
| 16820 | return NULL; |
| 16821 | } |
| 16822 | expr_ty _res = NULL; |
| 16823 | int _mark = p->mark; |
| 16824 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16825 | p->error_indicator = 1; |
| 16826 | D(p->level--); |
| 16827 | return NULL; |
| 16828 | } |
| 16829 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16830 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16831 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16832 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 16833 | { // NAME |
| 16834 | if (p->error_indicator) { |
| 16835 | D(p->level--); |
| 16836 | return NULL; |
| 16837 | } |
| 16838 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 16839 | expr_ty a; |
| 16840 | if ( |
| 16841 | (a = _PyPegen_name_token(p)) // NAME |
| 16842 | ) |
| 16843 | { |
| 16844 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 16845 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 16846 | if (_res == NULL && PyErr_Occurred()) { |
| 16847 | p->error_indicator = 1; |
| 16848 | D(p->level--); |
| 16849 | return NULL; |
| 16850 | } |
| 16851 | goto done; |
| 16852 | } |
| 16853 | p->mark = _mark; |
| 16854 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16855 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 16856 | } |
| 16857 | { // '(' target ')' |
| 16858 | if (p->error_indicator) { |
| 16859 | D(p->level--); |
| 16860 | return NULL; |
| 16861 | } |
| 16862 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); |
| 16863 | Token * _literal; |
| 16864 | Token * _literal_1; |
| 16865 | expr_ty a; |
| 16866 | if ( |
| 16867 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16868 | && |
| 16869 | (a = target_rule(p)) // target |
| 16870 | && |
| 16871 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16872 | ) |
| 16873 | { |
| 16874 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); |
| 16875 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 16876 | if (_res == NULL && PyErr_Occurred()) { |
| 16877 | p->error_indicator = 1; |
| 16878 | D(p->level--); |
| 16879 | return NULL; |
| 16880 | } |
| 16881 | goto done; |
| 16882 | } |
| 16883 | p->mark = _mark; |
| 16884 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16885 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'")); |
| 16886 | } |
| 16887 | { // '(' targets? ')' |
| 16888 | if (p->error_indicator) { |
| 16889 | D(p->level--); |
| 16890 | return NULL; |
| 16891 | } |
| 16892 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); |
| 16893 | Token * _literal; |
| 16894 | Token * _literal_1; |
| 16895 | void *b; |
| 16896 | if ( |
| 16897 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16898 | && |
| 16899 | (b = targets_rule(p), 1) // targets? |
| 16900 | && |
| 16901 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16902 | ) |
| 16903 | { |
| 16904 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); |
| 16905 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16906 | if (_token == NULL) { |
| 16907 | D(p->level--); |
| 16908 | return NULL; |
| 16909 | } |
| 16910 | int _end_lineno = _token->end_lineno; |
| 16911 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16912 | int _end_col_offset = _token->end_col_offset; |
| 16913 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16914 | _res = _Py_Tuple ( b , Store , EXTRA ); |
| 16915 | if (_res == NULL && PyErr_Occurred()) { |
| 16916 | p->error_indicator = 1; |
| 16917 | D(p->level--); |
| 16918 | return NULL; |
| 16919 | } |
| 16920 | goto done; |
| 16921 | } |
| 16922 | p->mark = _mark; |
| 16923 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16924 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'")); |
| 16925 | } |
| 16926 | { // '[' targets? ']' |
| 16927 | if (p->error_indicator) { |
| 16928 | D(p->level--); |
| 16929 | return NULL; |
| 16930 | } |
| 16931 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); |
| 16932 | Token * _literal; |
| 16933 | Token * _literal_1; |
| 16934 | void *b; |
| 16935 | if ( |
| 16936 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16937 | && |
| 16938 | (b = targets_rule(p), 1) // targets? |
| 16939 | && |
| 16940 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16941 | ) |
| 16942 | { |
| 16943 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); |
| 16944 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16945 | if (_token == NULL) { |
| 16946 | D(p->level--); |
| 16947 | return NULL; |
| 16948 | } |
| 16949 | int _end_lineno = _token->end_lineno; |
| 16950 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16951 | int _end_col_offset = _token->end_col_offset; |
| 16952 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16953 | _res = _Py_List ( b , Store , EXTRA ); |
| 16954 | if (_res == NULL && PyErr_Occurred()) { |
| 16955 | p->error_indicator = 1; |
| 16956 | D(p->level--); |
| 16957 | return NULL; |
| 16958 | } |
| 16959 | goto done; |
| 16960 | } |
| 16961 | p->mark = _mark; |
| 16962 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16963 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'")); |
| 16964 | } |
| 16965 | _res = NULL; |
| 16966 | done: |
| 16967 | D(p->level--); |
| 16968 | return _res; |
| 16969 | } |
| 16970 | |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 16971 | // invalid_arguments: |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16972 | // | args ',' '*' |
| 16973 | // | expression for_if_clauses ',' [args | expression for_if_clauses] |
| 16974 | // | args for_if_clauses |
| 16975 | // | args ',' expression for_if_clauses |
| 16976 | // | args ',' args |
| 16977 | static void * |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 16978 | invalid_arguments_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16979 | { |
| 16980 | D(p->level++); |
| 16981 | if (p->error_indicator) { |
| 16982 | D(p->level--); |
| 16983 | return NULL; |
| 16984 | } |
| 16985 | void * _res = NULL; |
| 16986 | int _mark = p->mark; |
| 16987 | { // args ',' '*' |
| 16988 | if (p->error_indicator) { |
| 16989 | D(p->level--); |
| 16990 | return NULL; |
| 16991 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 16992 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16993 | Token * _literal; |
| 16994 | Token * _literal_1; |
| 16995 | expr_ty args_var; |
| 16996 | if ( |
| 16997 | (args_var = args_rule(p)) // args |
| 16998 | && |
| 16999 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17000 | && |
| 17001 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
| 17002 | ) |
| 17003 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17004 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17005 | _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" ); |
| 17006 | if (_res == NULL && PyErr_Occurred()) { |
| 17007 | p->error_indicator = 1; |
| 17008 | D(p->level--); |
| 17009 | return NULL; |
| 17010 | } |
| 17011 | goto done; |
| 17012 | } |
| 17013 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17014 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17015 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'")); |
| 17016 | } |
| 17017 | { // expression for_if_clauses ',' [args | expression for_if_clauses] |
| 17018 | if (p->error_indicator) { |
| 17019 | D(p->level--); |
| 17020 | return NULL; |
| 17021 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17022 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17023 | Token * _literal; |
| 17024 | void *_opt_var; |
| 17025 | UNUSED(_opt_var); // Silence compiler warnings |
| 17026 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17027 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17028 | if ( |
| 17029 | (a = expression_rule(p)) // expression |
| 17030 | && |
| 17031 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17032 | && |
| 17033 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17034 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17035 | (_opt_var = _tmp_142_rule(p), 1) // [args | expression for_if_clauses] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17036 | ) |
| 17037 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17038 | 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]")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17039 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); |
| 17040 | if (_res == NULL && PyErr_Occurred()) { |
| 17041 | p->error_indicator = 1; |
| 17042 | D(p->level--); |
| 17043 | return NULL; |
| 17044 | } |
| 17045 | goto done; |
| 17046 | } |
| 17047 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17048 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17049 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); |
| 17050 | } |
| 17051 | { // args for_if_clauses |
| 17052 | if (p->error_indicator) { |
| 17053 | D(p->level--); |
| 17054 | return NULL; |
| 17055 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17056 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17057 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17058 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17059 | if ( |
| 17060 | (a = args_rule(p)) // args |
| 17061 | && |
| 17062 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17063 | ) |
| 17064 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17065 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17066 | _res = _PyPegen_nonparen_genexp_in_call ( p , a ); |
| 17067 | if (_res == NULL && PyErr_Occurred()) { |
| 17068 | p->error_indicator = 1; |
| 17069 | D(p->level--); |
| 17070 | return NULL; |
| 17071 | } |
| 17072 | goto done; |
| 17073 | } |
| 17074 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17075 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17076 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses")); |
| 17077 | } |
| 17078 | { // args ',' expression for_if_clauses |
| 17079 | if (p->error_indicator) { |
| 17080 | D(p->level--); |
| 17081 | return NULL; |
| 17082 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17083 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17084 | Token * _literal; |
| 17085 | expr_ty a; |
| 17086 | expr_ty args_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17087 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17088 | if ( |
| 17089 | (args_var = args_rule(p)) // args |
| 17090 | && |
| 17091 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17092 | && |
| 17093 | (a = expression_rule(p)) // expression |
| 17094 | && |
| 17095 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17096 | ) |
| 17097 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17098 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17099 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); |
| 17100 | if (_res == NULL && PyErr_Occurred()) { |
| 17101 | p->error_indicator = 1; |
| 17102 | D(p->level--); |
| 17103 | return NULL; |
| 17104 | } |
| 17105 | goto done; |
| 17106 | } |
| 17107 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17108 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17109 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses")); |
| 17110 | } |
| 17111 | { // args ',' args |
| 17112 | if (p->error_indicator) { |
| 17113 | D(p->level--); |
| 17114 | return NULL; |
| 17115 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17116 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17117 | Token * _literal; |
| 17118 | expr_ty a; |
| 17119 | expr_ty args_var; |
| 17120 | if ( |
| 17121 | (a = args_rule(p)) // args |
| 17122 | && |
| 17123 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17124 | && |
| 17125 | (args_var = args_rule(p)) // args |
| 17126 | ) |
| 17127 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17128 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17129 | _res = _PyPegen_arguments_parsing_error ( p , a ); |
| 17130 | if (_res == NULL && PyErr_Occurred()) { |
| 17131 | p->error_indicator = 1; |
| 17132 | D(p->level--); |
| 17133 | return NULL; |
| 17134 | } |
| 17135 | goto done; |
| 17136 | } |
| 17137 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17138 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17139 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args")); |
| 17140 | } |
| 17141 | _res = NULL; |
| 17142 | done: |
| 17143 | D(p->level--); |
| 17144 | return _res; |
| 17145 | } |
| 17146 | |
| 17147 | // invalid_kwarg: expression '=' |
| 17148 | static void * |
| 17149 | invalid_kwarg_rule(Parser *p) |
| 17150 | { |
| 17151 | D(p->level++); |
| 17152 | if (p->error_indicator) { |
| 17153 | D(p->level--); |
| 17154 | return NULL; |
| 17155 | } |
| 17156 | void * _res = NULL; |
| 17157 | int _mark = p->mark; |
| 17158 | { // expression '=' |
| 17159 | if (p->error_indicator) { |
| 17160 | D(p->level--); |
| 17161 | return NULL; |
| 17162 | } |
| 17163 | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='")); |
Pablo Galindo | 43c4fb6 | 2020-12-13 16:46:48 +0000 | [diff] [blame] | 17164 | Token * a; |
| 17165 | expr_ty expression_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17166 | if ( |
Pablo Galindo | 43c4fb6 | 2020-12-13 16:46:48 +0000 | [diff] [blame] | 17167 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17168 | && |
Pablo Galindo | 43c4fb6 | 2020-12-13 16:46:48 +0000 | [diff] [blame] | 17169 | (a = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17170 | ) |
| 17171 | { |
| 17172 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='")); |
| 17173 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" ); |
| 17174 | if (_res == NULL && PyErr_Occurred()) { |
| 17175 | p->error_indicator = 1; |
| 17176 | D(p->level--); |
| 17177 | return NULL; |
| 17178 | } |
| 17179 | goto done; |
| 17180 | } |
| 17181 | p->mark = _mark; |
| 17182 | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', |
| 17183 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='")); |
| 17184 | } |
| 17185 | _res = NULL; |
| 17186 | done: |
| 17187 | D(p->level--); |
| 17188 | return _res; |
| 17189 | } |
| 17190 | |
| 17191 | // invalid_named_expression: expression ':=' expression |
| 17192 | static void * |
| 17193 | invalid_named_expression_rule(Parser *p) |
| 17194 | { |
| 17195 | D(p->level++); |
| 17196 | if (p->error_indicator) { |
| 17197 | D(p->level--); |
| 17198 | return NULL; |
| 17199 | } |
| 17200 | void * _res = NULL; |
| 17201 | int _mark = p->mark; |
| 17202 | { // expression ':=' expression |
| 17203 | if (p->error_indicator) { |
| 17204 | D(p->level--); |
| 17205 | return NULL; |
| 17206 | } |
| 17207 | D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); |
| 17208 | Token * _literal; |
| 17209 | expr_ty a; |
| 17210 | expr_ty expression_var; |
| 17211 | if ( |
| 17212 | (a = expression_rule(p)) // expression |
| 17213 | && |
| 17214 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
| 17215 | && |
| 17216 | (expression_var = expression_rule(p)) // expression |
| 17217 | ) |
| 17218 | { |
| 17219 | D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); |
| 17220 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) ); |
| 17221 | if (_res == NULL && PyErr_Occurred()) { |
| 17222 | p->error_indicator = 1; |
| 17223 | D(p->level--); |
| 17224 | return NULL; |
| 17225 | } |
| 17226 | goto done; |
| 17227 | } |
| 17228 | p->mark = _mark; |
| 17229 | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 17230 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression")); |
| 17231 | } |
| 17232 | _res = NULL; |
| 17233 | done: |
| 17234 | D(p->level--); |
| 17235 | return _res; |
| 17236 | } |
| 17237 | |
| 17238 | // invalid_assignment: |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17239 | // | invalid_ann_assign_target ':' expression |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17240 | // | star_named_expression ',' star_named_expressions* ':' expression |
| 17241 | // | expression ':' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17242 | // | ((star_targets '='))* star_expressions '=' |
| 17243 | // | ((star_targets '='))* yield_expr '=' |
| 17244 | // | star_expressions augassign (yield_expr | star_expressions) |
| 17245 | static void * |
| 17246 | invalid_assignment_rule(Parser *p) |
| 17247 | { |
| 17248 | D(p->level++); |
| 17249 | if (p->error_indicator) { |
| 17250 | D(p->level--); |
| 17251 | return NULL; |
| 17252 | } |
| 17253 | void * _res = NULL; |
| 17254 | int _mark = p->mark; |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17255 | { // invalid_ann_assign_target ':' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17256 | if (p->error_indicator) { |
| 17257 | D(p->level--); |
| 17258 | return NULL; |
| 17259 | } |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17260 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17261 | Token * _literal; |
| 17262 | expr_ty a; |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17263 | expr_ty expression_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17264 | if ( |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17265 | (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17266 | && |
| 17267 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17268 | && |
| 17269 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17270 | ) |
| 17271 | { |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17272 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression")); |
| 17273 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17274 | if (_res == NULL && PyErr_Occurred()) { |
| 17275 | p->error_indicator = 1; |
| 17276 | D(p->level--); |
| 17277 | return NULL; |
| 17278 | } |
| 17279 | goto done; |
| 17280 | } |
| 17281 | p->mark = _mark; |
| 17282 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17283 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17284 | } |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17285 | { // star_named_expression ',' star_named_expressions* ':' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17286 | if (p->error_indicator) { |
| 17287 | D(p->level--); |
| 17288 | return NULL; |
| 17289 | } |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17290 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17291 | Token * _literal; |
| 17292 | Token * _literal_1; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17293 | asdl_seq * _loop0_143_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17294 | expr_ty a; |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17295 | expr_ty expression_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17296 | if ( |
| 17297 | (a = star_named_expression_rule(p)) // star_named_expression |
| 17298 | && |
| 17299 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17300 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17301 | (_loop0_143_var = _loop0_143_rule(p)) // star_named_expressions* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17302 | && |
| 17303 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17304 | && |
| 17305 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17306 | ) |
| 17307 | { |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17308 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17309 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); |
| 17310 | if (_res == NULL && PyErr_Occurred()) { |
| 17311 | p->error_indicator = 1; |
| 17312 | D(p->level--); |
| 17313 | return NULL; |
| 17314 | } |
| 17315 | goto done; |
| 17316 | } |
| 17317 | p->mark = _mark; |
| 17318 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17319 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17320 | } |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17321 | { // expression ':' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17322 | if (p->error_indicator) { |
| 17323 | D(p->level--); |
| 17324 | return NULL; |
| 17325 | } |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17326 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17327 | Token * _literal; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17328 | expr_ty a; |
| 17329 | expr_ty expression_var; |
| 17330 | if ( |
| 17331 | (a = expression_rule(p)) // expression |
| 17332 | && |
| 17333 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 17334 | && |
| 17335 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17336 | ) |
| 17337 | { |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17338 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17339 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" ); |
| 17340 | if (_res == NULL && PyErr_Occurred()) { |
| 17341 | p->error_indicator = 1; |
| 17342 | D(p->level--); |
| 17343 | return NULL; |
| 17344 | } |
| 17345 | goto done; |
| 17346 | } |
| 17347 | p->mark = _mark; |
| 17348 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17349 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17350 | } |
| 17351 | { // ((star_targets '='))* star_expressions '=' |
| 17352 | if (p->error_indicator) { |
| 17353 | D(p->level--); |
| 17354 | return NULL; |
| 17355 | } |
| 17356 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
| 17357 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17358 | asdl_seq * _loop0_144_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17359 | expr_ty a; |
| 17360 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17361 | (_loop0_144_var = _loop0_144_rule(p)) // ((star_targets '='))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17362 | && |
| 17363 | (a = star_expressions_rule(p)) // star_expressions |
| 17364 | && |
| 17365 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 17366 | ) |
| 17367 | { |
| 17368 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
Lysandros Nikolaou | 6c4e0bd | 2020-06-21 05:18:01 +0300 | [diff] [blame] | 17369 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17370 | if (_res == NULL && PyErr_Occurred()) { |
| 17371 | p->error_indicator = 1; |
| 17372 | D(p->level--); |
| 17373 | return NULL; |
| 17374 | } |
| 17375 | goto done; |
| 17376 | } |
| 17377 | p->mark = _mark; |
| 17378 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 17379 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
| 17380 | } |
| 17381 | { // ((star_targets '='))* yield_expr '=' |
| 17382 | if (p->error_indicator) { |
| 17383 | D(p->level--); |
| 17384 | return NULL; |
| 17385 | } |
| 17386 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
| 17387 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17388 | asdl_seq * _loop0_145_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17389 | expr_ty a; |
| 17390 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17391 | (_loop0_145_var = _loop0_145_rule(p)) // ((star_targets '='))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17392 | && |
| 17393 | (a = yield_expr_rule(p)) // yield_expr |
| 17394 | && |
| 17395 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 17396 | ) |
| 17397 | { |
| 17398 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
| 17399 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" ); |
| 17400 | if (_res == NULL && PyErr_Occurred()) { |
| 17401 | p->error_indicator = 1; |
| 17402 | D(p->level--); |
| 17403 | return NULL; |
| 17404 | } |
| 17405 | goto done; |
| 17406 | } |
| 17407 | p->mark = _mark; |
| 17408 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 17409 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
| 17410 | } |
| 17411 | { // star_expressions augassign (yield_expr | star_expressions) |
| 17412 | if (p->error_indicator) { |
| 17413 | D(p->level--); |
| 17414 | return NULL; |
| 17415 | } |
| 17416 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17417 | void *_tmp_146_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17418 | expr_ty a; |
| 17419 | AugOperator* augassign_var; |
| 17420 | if ( |
| 17421 | (a = star_expressions_rule(p)) // star_expressions |
| 17422 | && |
| 17423 | (augassign_var = augassign_rule(p)) // augassign |
| 17424 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17425 | (_tmp_146_var = _tmp_146_rule(p)) // yield_expr | star_expressions |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17426 | ) |
| 17427 | { |
| 17428 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
| 17429 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) ); |
| 17430 | if (_res == NULL && PyErr_Occurred()) { |
| 17431 | p->error_indicator = 1; |
| 17432 | D(p->level--); |
| 17433 | return NULL; |
| 17434 | } |
| 17435 | goto done; |
| 17436 | } |
| 17437 | p->mark = _mark; |
| 17438 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 17439 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
| 17440 | } |
| 17441 | _res = NULL; |
| 17442 | done: |
| 17443 | D(p->level--); |
| 17444 | return _res; |
| 17445 | } |
| 17446 | |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17447 | // invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')' |
| 17448 | static expr_ty |
| 17449 | invalid_ann_assign_target_rule(Parser *p) |
| 17450 | { |
| 17451 | D(p->level++); |
| 17452 | if (p->error_indicator) { |
| 17453 | D(p->level--); |
| 17454 | return NULL; |
| 17455 | } |
| 17456 | expr_ty _res = NULL; |
| 17457 | int _mark = p->mark; |
| 17458 | { // list |
| 17459 | if (p->error_indicator) { |
| 17460 | D(p->level--); |
| 17461 | return NULL; |
| 17462 | } |
| 17463 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); |
| 17464 | expr_ty list_var; |
| 17465 | if ( |
| 17466 | (list_var = list_rule(p)) // list |
| 17467 | ) |
| 17468 | { |
| 17469 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); |
| 17470 | _res = list_var; |
| 17471 | goto done; |
| 17472 | } |
| 17473 | p->mark = _mark; |
| 17474 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 17475 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
| 17476 | } |
| 17477 | { // tuple |
| 17478 | if (p->error_indicator) { |
| 17479 | D(p->level--); |
| 17480 | return NULL; |
| 17481 | } |
| 17482 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); |
| 17483 | expr_ty tuple_var; |
| 17484 | if ( |
| 17485 | (tuple_var = tuple_rule(p)) // tuple |
| 17486 | ) |
| 17487 | { |
| 17488 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); |
| 17489 | _res = tuple_var; |
| 17490 | goto done; |
| 17491 | } |
| 17492 | p->mark = _mark; |
| 17493 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 17494 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
| 17495 | } |
| 17496 | { // '(' invalid_ann_assign_target ')' |
| 17497 | if (p->error_indicator) { |
| 17498 | D(p->level--); |
| 17499 | return NULL; |
| 17500 | } |
| 17501 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
| 17502 | Token * _literal; |
| 17503 | Token * _literal_1; |
| 17504 | expr_ty a; |
| 17505 | if ( |
| 17506 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 17507 | && |
| 17508 | (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target |
| 17509 | && |
| 17510 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 17511 | ) |
| 17512 | { |
| 17513 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
| 17514 | _res = a; |
| 17515 | if (_res == NULL && PyErr_Occurred()) { |
| 17516 | p->error_indicator = 1; |
| 17517 | D(p->level--); |
| 17518 | return NULL; |
| 17519 | } |
| 17520 | goto done; |
| 17521 | } |
| 17522 | p->mark = _mark; |
| 17523 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 17524 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
| 17525 | } |
| 17526 | _res = NULL; |
| 17527 | done: |
| 17528 | D(p->level--); |
| 17529 | return _res; |
| 17530 | } |
| 17531 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 17532 | // invalid_del_stmt: 'del' star_expressions |
| 17533 | static void * |
| 17534 | invalid_del_stmt_rule(Parser *p) |
| 17535 | { |
| 17536 | D(p->level++); |
| 17537 | if (p->error_indicator) { |
| 17538 | D(p->level--); |
| 17539 | return NULL; |
| 17540 | } |
| 17541 | void * _res = NULL; |
| 17542 | int _mark = p->mark; |
| 17543 | { // 'del' star_expressions |
| 17544 | if (p->error_indicator) { |
| 17545 | D(p->level--); |
| 17546 | return NULL; |
| 17547 | } |
| 17548 | D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions")); |
| 17549 | Token * _keyword; |
| 17550 | expr_ty a; |
| 17551 | if ( |
| 17552 | (_keyword = _PyPegen_expect_token(p, 503)) // token='del' |
| 17553 | && |
| 17554 | (a = star_expressions_rule(p)) // star_expressions |
| 17555 | ) |
| 17556 | { |
| 17557 | D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' star_expressions")); |
Lysandros Nikolaou | 6c4e0bd | 2020-06-21 05:18:01 +0300 | [diff] [blame] | 17558 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a ); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 17559 | if (_res == NULL && PyErr_Occurred()) { |
| 17560 | p->error_indicator = 1; |
| 17561 | D(p->level--); |
| 17562 | return NULL; |
| 17563 | } |
| 17564 | goto done; |
| 17565 | } |
| 17566 | p->mark = _mark; |
| 17567 | D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 17568 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions")); |
| 17569 | } |
| 17570 | _res = NULL; |
| 17571 | done: |
| 17572 | D(p->level--); |
| 17573 | return _res; |
| 17574 | } |
| 17575 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17576 | // invalid_block: NEWLINE !INDENT |
| 17577 | static void * |
| 17578 | invalid_block_rule(Parser *p) |
| 17579 | { |
| 17580 | D(p->level++); |
| 17581 | if (p->error_indicator) { |
| 17582 | D(p->level--); |
| 17583 | return NULL; |
| 17584 | } |
| 17585 | void * _res = NULL; |
| 17586 | int _mark = p->mark; |
| 17587 | { // NEWLINE !INDENT |
| 17588 | if (p->error_indicator) { |
| 17589 | D(p->level--); |
| 17590 | return NULL; |
| 17591 | } |
| 17592 | D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); |
| 17593 | Token * newline_var; |
| 17594 | if ( |
| 17595 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 17596 | && |
| 17597 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
| 17598 | ) |
| 17599 | { |
| 17600 | D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); |
| 17601 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block" ); |
| 17602 | if (_res == NULL && PyErr_Occurred()) { |
| 17603 | p->error_indicator = 1; |
| 17604 | D(p->level--); |
| 17605 | return NULL; |
| 17606 | } |
| 17607 | goto done; |
| 17608 | } |
| 17609 | p->mark = _mark; |
| 17610 | D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 17611 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT")); |
| 17612 | } |
| 17613 | _res = NULL; |
| 17614 | done: |
| 17615 | D(p->level--); |
| 17616 | return _res; |
| 17617 | } |
| 17618 | |
Lysandros Nikolaou | 15acc4e | 2020-10-27 20:54:20 +0200 | [diff] [blame] | 17619 | // Left-recursive |
| 17620 | // invalid_primary: primary '{' |
| 17621 | static void * |
| 17622 | invalid_primary_rule(Parser *p) |
| 17623 | { |
| 17624 | D(p->level++); |
| 17625 | if (p->error_indicator) { |
| 17626 | D(p->level--); |
| 17627 | return NULL; |
| 17628 | } |
| 17629 | void * _res = NULL; |
| 17630 | int _mark = p->mark; |
| 17631 | { // primary '{' |
| 17632 | if (p->error_indicator) { |
| 17633 | D(p->level--); |
| 17634 | return NULL; |
| 17635 | } |
| 17636 | D(fprintf(stderr, "%*c> invalid_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '{'")); |
| 17637 | Token * a; |
| 17638 | expr_ty primary_var; |
| 17639 | if ( |
| 17640 | (primary_var = primary_rule(p)) // primary |
| 17641 | && |
| 17642 | (a = _PyPegen_expect_token(p, 25)) // token='{' |
| 17643 | ) |
| 17644 | { |
| 17645 | D(fprintf(stderr, "%*c+ invalid_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '{'")); |
| 17646 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid syntax" ); |
| 17647 | if (_res == NULL && PyErr_Occurred()) { |
| 17648 | p->error_indicator = 1; |
| 17649 | D(p->level--); |
| 17650 | return NULL; |
| 17651 | } |
| 17652 | goto done; |
| 17653 | } |
| 17654 | p->mark = _mark; |
| 17655 | D(fprintf(stderr, "%*c%s invalid_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 17656 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '{'")); |
| 17657 | } |
| 17658 | _res = NULL; |
| 17659 | done: |
| 17660 | D(p->level--); |
| 17661 | return _res; |
| 17662 | } |
| 17663 | |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17664 | // invalid_comprehension: |
| 17665 | // | ('[' | '(' | '{') starred_expression for_if_clauses |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17666 | // | ('[' | '{') star_named_expression ',' star_named_expressions? for_if_clauses |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17667 | static void * |
| 17668 | invalid_comprehension_rule(Parser *p) |
| 17669 | { |
| 17670 | D(p->level++); |
| 17671 | if (p->error_indicator) { |
| 17672 | D(p->level--); |
| 17673 | return NULL; |
| 17674 | } |
| 17675 | void * _res = NULL; |
| 17676 | int _mark = p->mark; |
| 17677 | { // ('[' | '(' | '{') starred_expression for_if_clauses |
| 17678 | if (p->error_indicator) { |
| 17679 | D(p->level--); |
| 17680 | return NULL; |
| 17681 | } |
| 17682 | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17683 | void *_tmp_147_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17684 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17685 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17686 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17687 | (_tmp_147_var = _tmp_147_rule(p)) // '[' | '(' | '{' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17688 | && |
| 17689 | (a = starred_expression_rule(p)) // starred_expression |
| 17690 | && |
| 17691 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17692 | ) |
| 17693 | { |
| 17694 | D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
| 17695 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" ); |
| 17696 | if (_res == NULL && PyErr_Occurred()) { |
| 17697 | p->error_indicator = 1; |
| 17698 | D(p->level--); |
| 17699 | return NULL; |
| 17700 | } |
| 17701 | goto done; |
| 17702 | } |
| 17703 | p->mark = _mark; |
| 17704 | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
| 17705 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
| 17706 | } |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17707 | { // ('[' | '{') star_named_expression ',' star_named_expressions? for_if_clauses |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17708 | if (p->error_indicator) { |
| 17709 | D(p->level--); |
| 17710 | return NULL; |
| 17711 | } |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17712 | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions? for_if_clauses")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17713 | Token * _literal; |
| 17714 | void *_opt_var; |
| 17715 | UNUSED(_opt_var); // Silence compiler warnings |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17716 | void *_tmp_148_var; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17717 | expr_ty a; |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17718 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17719 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17720 | (_tmp_148_var = _tmp_148_rule(p)) // '[' | '{' |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17721 | && |
| 17722 | (a = star_named_expression_rule(p)) // star_named_expression |
| 17723 | && |
| 17724 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17725 | && |
| 17726 | (_opt_var = star_named_expressions_rule(p), 1) // star_named_expressions? |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17727 | && |
| 17728 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17729 | ) |
| 17730 | { |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17731 | 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")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17732 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "did you forget parentheses around the comprehension target?" ); |
| 17733 | if (_res == NULL && PyErr_Occurred()) { |
| 17734 | p->error_indicator = 1; |
| 17735 | D(p->level--); |
| 17736 | return NULL; |
| 17737 | } |
| 17738 | goto done; |
| 17739 | } |
| 17740 | p->mark = _mark; |
| 17741 | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17742 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions? for_if_clauses")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17743 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17744 | _res = NULL; |
| 17745 | done: |
| 17746 | D(p->level--); |
| 17747 | return _res; |
| 17748 | } |
| 17749 | |
| 17750 | // invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}' |
| 17751 | static void * |
| 17752 | invalid_dict_comprehension_rule(Parser *p) |
| 17753 | { |
| 17754 | D(p->level++); |
| 17755 | if (p->error_indicator) { |
| 17756 | D(p->level--); |
| 17757 | return NULL; |
| 17758 | } |
| 17759 | void * _res = NULL; |
| 17760 | int _mark = p->mark; |
| 17761 | { // '{' '**' bitwise_or for_if_clauses '}' |
| 17762 | if (p->error_indicator) { |
| 17763 | D(p->level--); |
| 17764 | return NULL; |
| 17765 | } |
| 17766 | D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
| 17767 | Token * _literal; |
| 17768 | Token * _literal_1; |
| 17769 | Token * a; |
| 17770 | expr_ty bitwise_or_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17771 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17772 | if ( |
| 17773 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 17774 | && |
| 17775 | (a = _PyPegen_expect_token(p, 35)) // token='**' |
| 17776 | && |
| 17777 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
| 17778 | && |
| 17779 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17780 | && |
| 17781 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 17782 | ) |
| 17783 | { |
| 17784 | D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
| 17785 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" ); |
| 17786 | if (_res == NULL && PyErr_Occurred()) { |
| 17787 | p->error_indicator = 1; |
| 17788 | D(p->level--); |
| 17789 | return NULL; |
| 17790 | } |
| 17791 | goto done; |
| 17792 | } |
| 17793 | p->mark = _mark; |
| 17794 | D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
| 17795 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
| 17796 | } |
| 17797 | _res = NULL; |
| 17798 | done: |
| 17799 | D(p->level--); |
| 17800 | return _res; |
| 17801 | } |
| 17802 | |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17803 | // invalid_parameters: param_no_default* invalid_parameters_helper param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17804 | static void * |
| 17805 | invalid_parameters_rule(Parser *p) |
| 17806 | { |
| 17807 | D(p->level++); |
| 17808 | if (p->error_indicator) { |
| 17809 | D(p->level--); |
| 17810 | return NULL; |
| 17811 | } |
| 17812 | void * _res = NULL; |
| 17813 | int _mark = p->mark; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17814 | { // param_no_default* invalid_parameters_helper param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17815 | if (p->error_indicator) { |
| 17816 | D(p->level--); |
| 17817 | return NULL; |
| 17818 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17819 | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17820 | asdl_seq * _loop0_149_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17821 | void *invalid_parameters_helper_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17822 | arg_ty param_no_default_var; |
| 17823 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17824 | (_loop0_149_var = _loop0_149_rule(p)) // param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17825 | && |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17826 | (invalid_parameters_helper_var = invalid_parameters_helper_rule(p)) // invalid_parameters_helper |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17827 | && |
| 17828 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 17829 | ) |
| 17830 | { |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17831 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17832 | _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); |
| 17833 | if (_res == NULL && PyErr_Occurred()) { |
| 17834 | p->error_indicator = 1; |
| 17835 | D(p->level--); |
| 17836 | return NULL; |
| 17837 | } |
| 17838 | goto done; |
| 17839 | } |
| 17840 | p->mark = _mark; |
| 17841 | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17842 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default")); |
| 17843 | } |
| 17844 | _res = NULL; |
| 17845 | done: |
| 17846 | D(p->level--); |
| 17847 | return _res; |
| 17848 | } |
| 17849 | |
| 17850 | // invalid_parameters_helper: slash_with_default | param_with_default+ |
| 17851 | static void * |
| 17852 | invalid_parameters_helper_rule(Parser *p) |
| 17853 | { |
| 17854 | D(p->level++); |
| 17855 | if (p->error_indicator) { |
| 17856 | D(p->level--); |
| 17857 | return NULL; |
| 17858 | } |
| 17859 | void * _res = NULL; |
| 17860 | int _mark = p->mark; |
| 17861 | { // slash_with_default |
| 17862 | if (p->error_indicator) { |
| 17863 | D(p->level--); |
| 17864 | return NULL; |
| 17865 | } |
| 17866 | D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
| 17867 | SlashWithDefault* a; |
| 17868 | if ( |
| 17869 | (a = slash_with_default_rule(p)) // slash_with_default |
| 17870 | ) |
| 17871 | { |
| 17872 | D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
| 17873 | _res = _PyPegen_singleton_seq ( p , a ); |
| 17874 | if (_res == NULL && PyErr_Occurred()) { |
| 17875 | p->error_indicator = 1; |
| 17876 | D(p->level--); |
| 17877 | return NULL; |
| 17878 | } |
| 17879 | goto done; |
| 17880 | } |
| 17881 | p->mark = _mark; |
| 17882 | D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
| 17883 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); |
| 17884 | } |
| 17885 | { // param_with_default+ |
| 17886 | if (p->error_indicator) { |
| 17887 | D(p->level--); |
| 17888 | return NULL; |
| 17889 | } |
| 17890 | D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17891 | asdl_seq * _loop1_150_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17892 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17893 | (_loop1_150_var = _loop1_150_rule(p)) // param_with_default+ |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17894 | ) |
| 17895 | { |
| 17896 | D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17897 | _res = _loop1_150_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17898 | goto done; |
| 17899 | } |
| 17900 | p->mark = _mark; |
| 17901 | D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
| 17902 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17903 | } |
| 17904 | _res = NULL; |
| 17905 | done: |
| 17906 | D(p->level--); |
| 17907 | return _res; |
| 17908 | } |
| 17909 | |
| 17910 | // invalid_lambda_parameters: |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17911 | // | lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17912 | static void * |
| 17913 | invalid_lambda_parameters_rule(Parser *p) |
| 17914 | { |
| 17915 | D(p->level++); |
| 17916 | if (p->error_indicator) { |
| 17917 | D(p->level--); |
| 17918 | return NULL; |
| 17919 | } |
| 17920 | void * _res = NULL; |
| 17921 | int _mark = p->mark; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17922 | { // lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17923 | if (p->error_indicator) { |
| 17924 | D(p->level--); |
| 17925 | return NULL; |
| 17926 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17927 | D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17928 | asdl_seq * _loop0_151_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17929 | void *invalid_lambda_parameters_helper_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17930 | arg_ty lambda_param_no_default_var; |
| 17931 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17932 | (_loop0_151_var = _loop0_151_rule(p)) // lambda_param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17933 | && |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17934 | (invalid_lambda_parameters_helper_var = invalid_lambda_parameters_helper_rule(p)) // invalid_lambda_parameters_helper |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17935 | && |
| 17936 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 17937 | ) |
| 17938 | { |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17939 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17940 | _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); |
| 17941 | if (_res == NULL && PyErr_Occurred()) { |
| 17942 | p->error_indicator = 1; |
| 17943 | D(p->level--); |
| 17944 | return NULL; |
| 17945 | } |
| 17946 | goto done; |
| 17947 | } |
| 17948 | p->mark = _mark; |
| 17949 | D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17950 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); |
| 17951 | } |
| 17952 | _res = NULL; |
| 17953 | done: |
| 17954 | D(p->level--); |
| 17955 | return _res; |
| 17956 | } |
| 17957 | |
| 17958 | // invalid_lambda_parameters_helper: |
| 17959 | // | lambda_slash_with_default |
| 17960 | // | lambda_param_with_default+ |
| 17961 | static void * |
| 17962 | invalid_lambda_parameters_helper_rule(Parser *p) |
| 17963 | { |
| 17964 | D(p->level++); |
| 17965 | if (p->error_indicator) { |
| 17966 | D(p->level--); |
| 17967 | return NULL; |
| 17968 | } |
| 17969 | void * _res = NULL; |
| 17970 | int _mark = p->mark; |
| 17971 | { // lambda_slash_with_default |
| 17972 | if (p->error_indicator) { |
| 17973 | D(p->level--); |
| 17974 | return NULL; |
| 17975 | } |
| 17976 | D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); |
| 17977 | SlashWithDefault* a; |
| 17978 | if ( |
| 17979 | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
| 17980 | ) |
| 17981 | { |
| 17982 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); |
| 17983 | _res = _PyPegen_singleton_seq ( p , a ); |
| 17984 | if (_res == NULL && PyErr_Occurred()) { |
| 17985 | p->error_indicator = 1; |
| 17986 | D(p->level--); |
| 17987 | return NULL; |
| 17988 | } |
| 17989 | goto done; |
| 17990 | } |
| 17991 | p->mark = _mark; |
| 17992 | D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
| 17993 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); |
| 17994 | } |
| 17995 | { // lambda_param_with_default+ |
| 17996 | if (p->error_indicator) { |
| 17997 | D(p->level--); |
| 17998 | return NULL; |
| 17999 | } |
| 18000 | D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18001 | asdl_seq * _loop1_152_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 18002 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18003 | (_loop1_152_var = _loop1_152_rule(p)) // lambda_param_with_default+ |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 18004 | ) |
| 18005 | { |
| 18006 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18007 | _res = _loop1_152_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 18008 | goto done; |
| 18009 | } |
| 18010 | p->mark = _mark; |
| 18011 | D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
| 18012 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18013 | } |
| 18014 | _res = NULL; |
| 18015 | done: |
| 18016 | D(p->level--); |
| 18017 | return _res; |
| 18018 | } |
| 18019 | |
| 18020 | // invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT |
| 18021 | static void * |
| 18022 | invalid_star_etc_rule(Parser *p) |
| 18023 | { |
| 18024 | D(p->level++); |
| 18025 | if (p->error_indicator) { |
| 18026 | D(p->level--); |
| 18027 | return NULL; |
| 18028 | } |
| 18029 | void * _res = NULL; |
| 18030 | int _mark = p->mark; |
| 18031 | { // '*' (')' | ',' (')' | '**')) |
| 18032 | if (p->error_indicator) { |
| 18033 | D(p->level--); |
| 18034 | return NULL; |
| 18035 | } |
| 18036 | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
| 18037 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18038 | void *_tmp_153_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18039 | if ( |
| 18040 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 18041 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18042 | (_tmp_153_var = _tmp_153_rule(p)) // ')' | ',' (')' | '**') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18043 | ) |
| 18044 | { |
| 18045 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
| 18046 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
| 18047 | if (_res == NULL && PyErr_Occurred()) { |
| 18048 | p->error_indicator = 1; |
| 18049 | D(p->level--); |
| 18050 | return NULL; |
| 18051 | } |
| 18052 | goto done; |
| 18053 | } |
| 18054 | p->mark = _mark; |
| 18055 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 18056 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
| 18057 | } |
| 18058 | { // '*' ',' TYPE_COMMENT |
| 18059 | if (p->error_indicator) { |
| 18060 | D(p->level--); |
| 18061 | return NULL; |
| 18062 | } |
| 18063 | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
| 18064 | Token * _literal; |
| 18065 | Token * _literal_1; |
| 18066 | Token * type_comment_var; |
| 18067 | if ( |
| 18068 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 18069 | && |
| 18070 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 18071 | && |
| 18072 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 18073 | ) |
| 18074 | { |
| 18075 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
| 18076 | _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" ); |
| 18077 | if (_res == NULL && PyErr_Occurred()) { |
| 18078 | p->error_indicator = 1; |
| 18079 | D(p->level--); |
| 18080 | return NULL; |
| 18081 | } |
| 18082 | goto done; |
| 18083 | } |
| 18084 | p->mark = _mark; |
| 18085 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 18086 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
| 18087 | } |
| 18088 | _res = NULL; |
| 18089 | done: |
| 18090 | D(p->level--); |
| 18091 | return _res; |
| 18092 | } |
| 18093 | |
| 18094 | // invalid_lambda_star_etc: '*' (':' | ',' (':' | '**')) |
| 18095 | static void * |
| 18096 | invalid_lambda_star_etc_rule(Parser *p) |
| 18097 | { |
| 18098 | D(p->level++); |
| 18099 | if (p->error_indicator) { |
| 18100 | D(p->level--); |
| 18101 | return NULL; |
| 18102 | } |
| 18103 | void * _res = NULL; |
| 18104 | int _mark = p->mark; |
| 18105 | { // '*' (':' | ',' (':' | '**')) |
| 18106 | if (p->error_indicator) { |
| 18107 | D(p->level--); |
| 18108 | return NULL; |
| 18109 | } |
| 18110 | D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
| 18111 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18112 | void *_tmp_154_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18113 | if ( |
| 18114 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 18115 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18116 | (_tmp_154_var = _tmp_154_rule(p)) // ':' | ',' (':' | '**') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18117 | ) |
| 18118 | { |
| 18119 | D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
| 18120 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
| 18121 | if (_res == NULL && PyErr_Occurred()) { |
| 18122 | p->error_indicator = 1; |
| 18123 | D(p->level--); |
| 18124 | return NULL; |
| 18125 | } |
| 18126 | goto done; |
| 18127 | } |
| 18128 | p->mark = _mark; |
| 18129 | D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 18130 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
| 18131 | } |
| 18132 | _res = NULL; |
| 18133 | done: |
| 18134 | D(p->level--); |
| 18135 | return _res; |
| 18136 | } |
| 18137 | |
| 18138 | // invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
| 18139 | static void * |
| 18140 | invalid_double_type_comments_rule(Parser *p) |
| 18141 | { |
| 18142 | D(p->level++); |
| 18143 | if (p->error_indicator) { |
| 18144 | D(p->level--); |
| 18145 | return NULL; |
| 18146 | } |
| 18147 | void * _res = NULL; |
| 18148 | int _mark = p->mark; |
| 18149 | { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
| 18150 | if (p->error_indicator) { |
| 18151 | D(p->level--); |
| 18152 | return NULL; |
| 18153 | } |
| 18154 | D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); |
| 18155 | Token * indent_var; |
| 18156 | Token * newline_var; |
| 18157 | Token * newline_var_1; |
| 18158 | Token * type_comment_var; |
| 18159 | Token * type_comment_var_1; |
| 18160 | if ( |
| 18161 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 18162 | && |
| 18163 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 18164 | && |
| 18165 | (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 18166 | && |
| 18167 | (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 18168 | && |
| 18169 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
| 18170 | ) |
| 18171 | { |
| 18172 | 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")); |
| 18173 | _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" ); |
| 18174 | if (_res == NULL && PyErr_Occurred()) { |
| 18175 | p->error_indicator = 1; |
| 18176 | D(p->level--); |
| 18177 | return NULL; |
| 18178 | } |
| 18179 | goto done; |
| 18180 | } |
| 18181 | p->mark = _mark; |
| 18182 | D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ', |
| 18183 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); |
| 18184 | } |
| 18185 | _res = NULL; |
| 18186 | done: |
| 18187 | D(p->level--); |
| 18188 | return _res; |
| 18189 | } |
| 18190 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18191 | // invalid_with_item: expression 'as' expression &(',' | ')' | ':') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18192 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18193 | invalid_with_item_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18194 | { |
| 18195 | D(p->level++); |
| 18196 | if (p->error_indicator) { |
| 18197 | D(p->level--); |
| 18198 | return NULL; |
| 18199 | } |
| 18200 | void * _res = NULL; |
| 18201 | int _mark = p->mark; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18202 | { // expression 'as' expression &(',' | ')' | ':') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18203 | if (p->error_indicator) { |
| 18204 | D(p->level--); |
| 18205 | return NULL; |
| 18206 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18207 | D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18208 | Token * _keyword; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18209 | expr_ty a; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18210 | expr_ty expression_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18211 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18212 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18213 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18214 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 18215 | && |
| 18216 | (a = expression_rule(p)) // expression |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18217 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18218 | _PyPegen_lookahead(1, _tmp_155_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18219 | ) |
| 18220 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18221 | D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); |
Lysandros Nikolaou | 6c4e0bd | 2020-06-21 05:18:01 +0300 | [diff] [blame] | 18222 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18223 | if (_res == NULL && PyErr_Occurred()) { |
| 18224 | p->error_indicator = 1; |
| 18225 | D(p->level--); |
| 18226 | return NULL; |
| 18227 | } |
| 18228 | goto done; |
| 18229 | } |
| 18230 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18231 | D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18232 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18233 | } |
| 18234 | _res = NULL; |
| 18235 | done: |
| 18236 | D(p->level--); |
| 18237 | return _res; |
| 18238 | } |
| 18239 | |
| 18240 | // invalid_for_target: ASYNC? 'for' star_expressions |
| 18241 | static void * |
| 18242 | invalid_for_target_rule(Parser *p) |
| 18243 | { |
| 18244 | D(p->level++); |
| 18245 | if (p->error_indicator) { |
| 18246 | D(p->level--); |
| 18247 | return NULL; |
| 18248 | } |
| 18249 | void * _res = NULL; |
| 18250 | int _mark = p->mark; |
| 18251 | { // ASYNC? 'for' star_expressions |
| 18252 | if (p->error_indicator) { |
| 18253 | D(p->level--); |
| 18254 | return NULL; |
| 18255 | } |
| 18256 | D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions")); |
| 18257 | Token * _keyword; |
| 18258 | void *_opt_var; |
| 18259 | UNUSED(_opt_var); // Silence compiler warnings |
| 18260 | expr_ty a; |
| 18261 | if ( |
| 18262 | (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC? |
| 18263 | && |
| 18264 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 18265 | && |
| 18266 | (a = star_expressions_rule(p)) // star_expressions |
| 18267 | ) |
| 18268 | { |
| 18269 | D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions")); |
Lysandros Nikolaou | 6c4e0bd | 2020-06-21 05:18:01 +0300 | [diff] [blame] | 18270 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a ); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18271 | if (_res == NULL && PyErr_Occurred()) { |
| 18272 | p->error_indicator = 1; |
| 18273 | D(p->level--); |
| 18274 | return NULL; |
| 18275 | } |
| 18276 | goto done; |
| 18277 | } |
| 18278 | p->mark = _mark; |
| 18279 | D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 18280 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions")); |
| 18281 | } |
| 18282 | _res = NULL; |
| 18283 | done: |
| 18284 | D(p->level--); |
| 18285 | return _res; |
| 18286 | } |
| 18287 | |
| 18288 | // invalid_group: '(' starred_expression ')' |
| 18289 | static void * |
| 18290 | invalid_group_rule(Parser *p) |
| 18291 | { |
| 18292 | D(p->level++); |
| 18293 | if (p->error_indicator) { |
| 18294 | D(p->level--); |
| 18295 | return NULL; |
| 18296 | } |
| 18297 | void * _res = NULL; |
| 18298 | int _mark = p->mark; |
| 18299 | { // '(' starred_expression ')' |
| 18300 | if (p->error_indicator) { |
| 18301 | D(p->level--); |
| 18302 | return NULL; |
| 18303 | } |
| 18304 | D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'")); |
| 18305 | Token * _literal; |
| 18306 | Token * _literal_1; |
| 18307 | expr_ty a; |
| 18308 | if ( |
| 18309 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 18310 | && |
| 18311 | (a = starred_expression_rule(p)) // starred_expression |
| 18312 | && |
| 18313 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 18314 | ) |
| 18315 | { |
| 18316 | D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'")); |
| 18317 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" ); |
| 18318 | if (_res == NULL && PyErr_Occurred()) { |
| 18319 | p->error_indicator = 1; |
| 18320 | D(p->level--); |
| 18321 | return NULL; |
| 18322 | } |
| 18323 | goto done; |
| 18324 | } |
| 18325 | p->mark = _mark; |
| 18326 | D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ', |
| 18327 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18328 | } |
| 18329 | _res = NULL; |
| 18330 | done: |
| 18331 | D(p->level--); |
| 18332 | return _res; |
| 18333 | } |
| 18334 | |
| 18335 | // invalid_import_from_targets: import_from_as_names ',' |
| 18336 | static void * |
| 18337 | invalid_import_from_targets_rule(Parser *p) |
| 18338 | { |
| 18339 | D(p->level++); |
| 18340 | if (p->error_indicator) { |
| 18341 | D(p->level--); |
| 18342 | return NULL; |
| 18343 | } |
| 18344 | void * _res = NULL; |
| 18345 | int _mark = p->mark; |
| 18346 | { // import_from_as_names ',' |
| 18347 | if (p->error_indicator) { |
| 18348 | D(p->level--); |
| 18349 | return NULL; |
| 18350 | } |
| 18351 | D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); |
| 18352 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18353 | asdl_alias_seq* import_from_as_names_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18354 | if ( |
| 18355 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
| 18356 | && |
| 18357 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 18358 | ) |
| 18359 | { |
| 18360 | D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); |
| 18361 | _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" ); |
| 18362 | if (_res == NULL && PyErr_Occurred()) { |
| 18363 | p->error_indicator = 1; |
| 18364 | D(p->level--); |
| 18365 | return NULL; |
| 18366 | } |
| 18367 | goto done; |
| 18368 | } |
| 18369 | p->mark = _mark; |
| 18370 | D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 18371 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','")); |
| 18372 | } |
| 18373 | _res = NULL; |
| 18374 | done: |
| 18375 | D(p->level--); |
| 18376 | return _res; |
| 18377 | } |
| 18378 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18379 | // invalid_with_stmt: |
| 18380 | // | ASYNC? 'with' ','.(expression ['as' star_target])+ &&':' |
| 18381 | // | ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':' |
| 18382 | static void * |
| 18383 | invalid_with_stmt_rule(Parser *p) |
| 18384 | { |
| 18385 | D(p->level++); |
| 18386 | if (p->error_indicator) { |
| 18387 | D(p->level--); |
| 18388 | return NULL; |
| 18389 | } |
| 18390 | void * _res = NULL; |
| 18391 | int _mark = p->mark; |
| 18392 | { // ASYNC? 'with' ','.(expression ['as' star_target])+ &&':' |
| 18393 | if (p->error_indicator) { |
| 18394 | D(p->level--); |
| 18395 | return NULL; |
| 18396 | } |
| 18397 | D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18398 | asdl_seq * _gather_156_var; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18399 | Token * _keyword; |
| 18400 | Token * _literal; |
| 18401 | void *_opt_var; |
| 18402 | UNUSED(_opt_var); // Silence compiler warnings |
| 18403 | if ( |
| 18404 | (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC? |
| 18405 | && |
| 18406 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 18407 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18408 | (_gather_156_var = _gather_156_rule(p)) // ','.(expression ['as' star_target])+ |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18409 | && |
| 18410 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
| 18411 | ) |
| 18412 | { |
| 18413 | D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18414 | _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _gather_156_var, _literal); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18415 | goto done; |
| 18416 | } |
| 18417 | p->mark = _mark; |
| 18418 | D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 18419 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'")); |
| 18420 | } |
| 18421 | { // ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':' |
| 18422 | if (p->error_indicator) { |
| 18423 | D(p->level--); |
| 18424 | return NULL; |
| 18425 | } |
| 18426 | D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18427 | asdl_seq * _gather_158_var; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18428 | Token * _keyword; |
| 18429 | Token * _literal; |
| 18430 | Token * _literal_1; |
| 18431 | Token * _literal_2; |
| 18432 | void *_opt_var; |
| 18433 | UNUSED(_opt_var); // Silence compiler warnings |
| 18434 | void *_opt_var_1; |
| 18435 | UNUSED(_opt_var_1); // Silence compiler warnings |
| 18436 | if ( |
| 18437 | (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC? |
| 18438 | && |
| 18439 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 18440 | && |
| 18441 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 18442 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18443 | (_gather_158_var = _gather_158_rule(p)) // ','.(expressions ['as' star_target])+ |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18444 | && |
| 18445 | (_opt_var_1 = _PyPegen_expect_token(p, 12), 1) // ','? |
| 18446 | && |
| 18447 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 18448 | && |
| 18449 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
| 18450 | ) |
| 18451 | { |
| 18452 | D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18453 | _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _literal, _gather_158_var, _opt_var_1, _literal_1, _literal_2); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18454 | goto done; |
| 18455 | } |
| 18456 | p->mark = _mark; |
| 18457 | D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 18458 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'")); |
| 18459 | } |
| 18460 | _res = NULL; |
| 18461 | done: |
| 18462 | D(p->level--); |
| 18463 | return _res; |
| 18464 | } |
| 18465 | |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 18466 | // invalid_except_block: |
| 18467 | // | 'except' expression ',' expressions ['as' NAME] ':' |
| 18468 | // | 'except' expression ['as' NAME] &&':' |
| 18469 | // | 'except' &&':' |
| 18470 | static void * |
| 18471 | invalid_except_block_rule(Parser *p) |
| 18472 | { |
| 18473 | D(p->level++); |
| 18474 | if (p->error_indicator) { |
| 18475 | D(p->level--); |
| 18476 | return NULL; |
| 18477 | } |
| 18478 | void * _res = NULL; |
| 18479 | int _mark = p->mark; |
| 18480 | { // 'except' expression ',' expressions ['as' NAME] ':' |
| 18481 | if (p->error_indicator) { |
| 18482 | D(p->level--); |
| 18483 | return NULL; |
| 18484 | } |
| 18485 | D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); |
| 18486 | Token * _keyword; |
| 18487 | Token * _literal; |
| 18488 | Token * _literal_1; |
| 18489 | void *_opt_var; |
| 18490 | UNUSED(_opt_var); // Silence compiler warnings |
| 18491 | expr_ty a; |
| 18492 | expr_ty expressions_var; |
| 18493 | if ( |
| 18494 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
| 18495 | && |
| 18496 | (a = expression_rule(p)) // expression |
| 18497 | && |
| 18498 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 18499 | && |
| 18500 | (expressions_var = expressions_rule(p)) // expressions |
| 18501 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18502 | (_opt_var = _tmp_160_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 18503 | && |
| 18504 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
| 18505 | ) |
| 18506 | { |
| 18507 | D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); |
| 18508 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "exception group must be parenthesized" ); |
| 18509 | if (_res == NULL && PyErr_Occurred()) { |
| 18510 | p->error_indicator = 1; |
| 18511 | D(p->level--); |
| 18512 | return NULL; |
| 18513 | } |
| 18514 | goto done; |
| 18515 | } |
| 18516 | p->mark = _mark; |
| 18517 | D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 18518 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); |
| 18519 | } |
| 18520 | { // 'except' expression ['as' NAME] &&':' |
| 18521 | if (p->error_indicator) { |
| 18522 | D(p->level--); |
| 18523 | return NULL; |
| 18524 | } |
| 18525 | D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] &&':'")); |
| 18526 | Token * _keyword; |
| 18527 | Token * _literal; |
| 18528 | void *_opt_var; |
| 18529 | UNUSED(_opt_var); // Silence compiler warnings |
| 18530 | expr_ty expression_var; |
| 18531 | if ( |
| 18532 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
| 18533 | && |
| 18534 | (expression_var = expression_rule(p)) // expression |
| 18535 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18536 | (_opt_var = _tmp_161_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 18537 | && |
| 18538 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
| 18539 | ) |
| 18540 | { |
| 18541 | D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] &&':'")); |
| 18542 | _res = _PyPegen_dummy_name(p, _keyword, expression_var, _opt_var, _literal); |
| 18543 | goto done; |
| 18544 | } |
| 18545 | p->mark = _mark; |
| 18546 | D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 18547 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] &&':'")); |
| 18548 | } |
| 18549 | { // 'except' &&':' |
| 18550 | if (p->error_indicator) { |
| 18551 | D(p->level--); |
| 18552 | return NULL; |
| 18553 | } |
| 18554 | D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' &&':'")); |
| 18555 | Token * _keyword; |
| 18556 | Token * _literal; |
| 18557 | if ( |
| 18558 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
| 18559 | && |
| 18560 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
| 18561 | ) |
| 18562 | { |
| 18563 | D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' &&':'")); |
| 18564 | _res = _PyPegen_dummy_name(p, _keyword, _literal); |
| 18565 | goto done; |
| 18566 | } |
| 18567 | p->mark = _mark; |
| 18568 | D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 18569 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' &&':'")); |
| 18570 | } |
| 18571 | _res = NULL; |
| 18572 | done: |
| 18573 | D(p->level--); |
| 18574 | return _res; |
| 18575 | } |
| 18576 | |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 18577 | // invalid_match_stmt: "match" subject_expr !':' |
| 18578 | static void * |
| 18579 | invalid_match_stmt_rule(Parser *p) |
| 18580 | { |
| 18581 | D(p->level++); |
| 18582 | if (p->error_indicator) { |
| 18583 | D(p->level--); |
| 18584 | return NULL; |
| 18585 | } |
| 18586 | void * _res = NULL; |
| 18587 | int _mark = p->mark; |
| 18588 | { // "match" subject_expr !':' |
| 18589 | if (p->error_indicator) { |
| 18590 | D(p->level--); |
| 18591 | return NULL; |
| 18592 | } |
| 18593 | D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr !':'")); |
| 18594 | expr_ty _keyword; |
| 18595 | expr_ty subject_expr_var; |
| 18596 | if ( |
| 18597 | (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' |
| 18598 | && |
| 18599 | (subject_expr_var = subject_expr_rule(p)) // subject_expr |
| 18600 | && |
| 18601 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=':' |
| 18602 | ) |
| 18603 | { |
| 18604 | D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr !':'")); |
| 18605 | _res = CHECK_VERSION ( void * , 10 , "Pattern matching is" , RAISE_SYNTAX_ERROR ( "expected ':'" ) ); |
| 18606 | if (_res == NULL && PyErr_Occurred()) { |
| 18607 | p->error_indicator = 1; |
| 18608 | D(p->level--); |
| 18609 | return NULL; |
| 18610 | } |
| 18611 | goto done; |
| 18612 | } |
| 18613 | p->mark = _mark; |
| 18614 | D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 18615 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr !':'")); |
| 18616 | } |
| 18617 | _res = NULL; |
| 18618 | done: |
| 18619 | D(p->level--); |
| 18620 | return _res; |
| 18621 | } |
| 18622 | |
| 18623 | // invalid_case_block: "case" patterns guard? !':' |
| 18624 | static void * |
| 18625 | invalid_case_block_rule(Parser *p) |
| 18626 | { |
| 18627 | D(p->level++); |
| 18628 | if (p->error_indicator) { |
| 18629 | D(p->level--); |
| 18630 | return NULL; |
| 18631 | } |
| 18632 | void * _res = NULL; |
| 18633 | int _mark = p->mark; |
| 18634 | { // "case" patterns guard? !':' |
| 18635 | if (p->error_indicator) { |
| 18636 | D(p->level--); |
| 18637 | return NULL; |
| 18638 | } |
| 18639 | D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? !':'")); |
| 18640 | expr_ty _keyword; |
| 18641 | void *_opt_var; |
| 18642 | UNUSED(_opt_var); // Silence compiler warnings |
| 18643 | expr_ty patterns_var; |
| 18644 | if ( |
| 18645 | (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' |
| 18646 | && |
| 18647 | (patterns_var = patterns_rule(p)) // patterns |
| 18648 | && |
| 18649 | (_opt_var = guard_rule(p), 1) // guard? |
| 18650 | && |
| 18651 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=':' |
| 18652 | ) |
| 18653 | { |
| 18654 | D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? !':'")); |
| 18655 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
| 18656 | if (_res == NULL && PyErr_Occurred()) { |
| 18657 | p->error_indicator = 1; |
| 18658 | D(p->level--); |
| 18659 | return NULL; |
| 18660 | } |
| 18661 | goto done; |
| 18662 | } |
| 18663 | p->mark = _mark; |
| 18664 | D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 18665 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? !':'")); |
| 18666 | } |
| 18667 | _res = NULL; |
| 18668 | done: |
| 18669 | D(p->level--); |
| 18670 | return _res; |
| 18671 | } |
| 18672 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18673 | // _loop0_1: NEWLINE |
| 18674 | static asdl_seq * |
| 18675 | _loop0_1_rule(Parser *p) |
| 18676 | { |
| 18677 | D(p->level++); |
| 18678 | if (p->error_indicator) { |
| 18679 | D(p->level--); |
| 18680 | return NULL; |
| 18681 | } |
| 18682 | void *_res = NULL; |
| 18683 | int _mark = p->mark; |
| 18684 | int _start_mark = p->mark; |
| 18685 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18686 | if (!_children) { |
| 18687 | p->error_indicator = 1; |
| 18688 | PyErr_NoMemory(); |
| 18689 | D(p->level--); |
| 18690 | return NULL; |
| 18691 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 18692 | Py_ssize_t _children_capacity = 1; |
| 18693 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18694 | { // NEWLINE |
| 18695 | if (p->error_indicator) { |
| 18696 | D(p->level--); |
| 18697 | return NULL; |
| 18698 | } |
| 18699 | D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 18700 | Token * newline_var; |
| 18701 | while ( |
| 18702 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 18703 | ) |
| 18704 | { |
| 18705 | _res = newline_var; |
| 18706 | if (_n == _children_capacity) { |
| 18707 | _children_capacity *= 2; |
| 18708 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18709 | if (!_new_children) { |
| 18710 | p->error_indicator = 1; |
| 18711 | PyErr_NoMemory(); |
| 18712 | D(p->level--); |
| 18713 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18714 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18715 | _children = _new_children; |
| 18716 | } |
| 18717 | _children[_n++] = _res; |
| 18718 | _mark = p->mark; |
| 18719 | } |
| 18720 | p->mark = _mark; |
| 18721 | D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ', |
| 18722 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
| 18723 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18724 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18725 | if (!_seq) { |
| 18726 | PyMem_Free(_children); |
| 18727 | p->error_indicator = 1; |
| 18728 | PyErr_NoMemory(); |
| 18729 | D(p->level--); |
| 18730 | return NULL; |
| 18731 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18732 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18733 | PyMem_Free(_children); |
| 18734 | _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq); |
| 18735 | D(p->level--); |
| 18736 | return _seq; |
| 18737 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18738 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18739 | // _loop0_2: NEWLINE |
| 18740 | static asdl_seq * |
| 18741 | _loop0_2_rule(Parser *p) |
| 18742 | { |
| 18743 | D(p->level++); |
| 18744 | if (p->error_indicator) { |
| 18745 | D(p->level--); |
| 18746 | return NULL; |
| 18747 | } |
| 18748 | void *_res = NULL; |
| 18749 | int _mark = p->mark; |
| 18750 | int _start_mark = p->mark; |
| 18751 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18752 | if (!_children) { |
| 18753 | p->error_indicator = 1; |
| 18754 | PyErr_NoMemory(); |
| 18755 | D(p->level--); |
| 18756 | return NULL; |
| 18757 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 18758 | Py_ssize_t _children_capacity = 1; |
| 18759 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18760 | { // NEWLINE |
| 18761 | if (p->error_indicator) { |
| 18762 | D(p->level--); |
| 18763 | return NULL; |
| 18764 | } |
| 18765 | D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 18766 | Token * newline_var; |
| 18767 | while ( |
| 18768 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 18769 | ) |
| 18770 | { |
| 18771 | _res = newline_var; |
| 18772 | if (_n == _children_capacity) { |
| 18773 | _children_capacity *= 2; |
| 18774 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18775 | if (!_new_children) { |
| 18776 | p->error_indicator = 1; |
| 18777 | PyErr_NoMemory(); |
| 18778 | D(p->level--); |
| 18779 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18780 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18781 | _children = _new_children; |
| 18782 | } |
| 18783 | _children[_n++] = _res; |
| 18784 | _mark = p->mark; |
| 18785 | } |
| 18786 | p->mark = _mark; |
| 18787 | D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ', |
| 18788 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
| 18789 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18790 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18791 | if (!_seq) { |
| 18792 | PyMem_Free(_children); |
| 18793 | p->error_indicator = 1; |
| 18794 | PyErr_NoMemory(); |
| 18795 | D(p->level--); |
| 18796 | return NULL; |
| 18797 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18798 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18799 | PyMem_Free(_children); |
| 18800 | _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq); |
| 18801 | D(p->level--); |
| 18802 | return _seq; |
| 18803 | } |
| 18804 | |
| 18805 | // _loop0_4: ',' expression |
| 18806 | static asdl_seq * |
| 18807 | _loop0_4_rule(Parser *p) |
| 18808 | { |
| 18809 | D(p->level++); |
| 18810 | if (p->error_indicator) { |
| 18811 | D(p->level--); |
| 18812 | return NULL; |
| 18813 | } |
| 18814 | void *_res = NULL; |
| 18815 | int _mark = p->mark; |
| 18816 | int _start_mark = p->mark; |
| 18817 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18818 | if (!_children) { |
| 18819 | p->error_indicator = 1; |
| 18820 | PyErr_NoMemory(); |
| 18821 | D(p->level--); |
| 18822 | return NULL; |
| 18823 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 18824 | Py_ssize_t _children_capacity = 1; |
| 18825 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18826 | { // ',' expression |
| 18827 | if (p->error_indicator) { |
| 18828 | D(p->level--); |
| 18829 | return NULL; |
| 18830 | } |
| 18831 | D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 18832 | Token * _literal; |
| 18833 | expr_ty elem; |
| 18834 | while ( |
| 18835 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 18836 | && |
| 18837 | (elem = expression_rule(p)) // expression |
| 18838 | ) |
| 18839 | { |
| 18840 | _res = elem; |
| 18841 | if (_res == NULL && PyErr_Occurred()) { |
| 18842 | p->error_indicator = 1; |
| 18843 | PyMem_Free(_children); |
| 18844 | D(p->level--); |
| 18845 | return NULL; |
| 18846 | } |
| 18847 | if (_n == _children_capacity) { |
| 18848 | _children_capacity *= 2; |
| 18849 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18850 | if (!_new_children) { |
| 18851 | p->error_indicator = 1; |
| 18852 | PyErr_NoMemory(); |
| 18853 | D(p->level--); |
| 18854 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18855 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18856 | _children = _new_children; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18857 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18858 | _children[_n++] = _res; |
| 18859 | _mark = p->mark; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18860 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18861 | p->mark = _mark; |
| 18862 | D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ', |
| 18863 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18864 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18865 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18866 | if (!_seq) { |
| 18867 | PyMem_Free(_children); |
| 18868 | p->error_indicator = 1; |
| 18869 | PyErr_NoMemory(); |
| 18870 | D(p->level--); |
| 18871 | return NULL; |
| 18872 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18873 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18874 | PyMem_Free(_children); |
| 18875 | _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq); |
| 18876 | D(p->level--); |
| 18877 | return _seq; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18878 | } |
| 18879 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18880 | // _gather_3: expression _loop0_4 |
| 18881 | static asdl_seq * |
| 18882 | _gather_3_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18883 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18884 | D(p->level++); |
| 18885 | if (p->error_indicator) { |
| 18886 | D(p->level--); |
| 18887 | return NULL; |
| 18888 | } |
| 18889 | asdl_seq * _res = NULL; |
| 18890 | int _mark = p->mark; |
| 18891 | { // expression _loop0_4 |
| 18892 | if (p->error_indicator) { |
| 18893 | D(p->level--); |
| 18894 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18895 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18896 | D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); |
| 18897 | expr_ty elem; |
| 18898 | asdl_seq * seq; |
| 18899 | if ( |
| 18900 | (elem = expression_rule(p)) // expression |
| 18901 | && |
| 18902 | (seq = _loop0_4_rule(p)) // _loop0_4 |
| 18903 | ) |
| 18904 | { |
| 18905 | D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); |
| 18906 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 18907 | goto done; |
| 18908 | } |
| 18909 | p->mark = _mark; |
| 18910 | D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ', |
| 18911 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4")); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18912 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18913 | _res = NULL; |
| 18914 | done: |
| 18915 | D(p->level--); |
| 18916 | return _res; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18917 | } |
| 18918 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18919 | // _loop0_6: ',' expression |
| 18920 | static asdl_seq * |
| 18921 | _loop0_6_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18922 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18923 | D(p->level++); |
| 18924 | if (p->error_indicator) { |
| 18925 | D(p->level--); |
| 18926 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18927 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18928 | void *_res = NULL; |
| 18929 | int _mark = p->mark; |
| 18930 | int _start_mark = p->mark; |
| 18931 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18932 | if (!_children) { |
| 18933 | p->error_indicator = 1; |
| 18934 | PyErr_NoMemory(); |
| 18935 | D(p->level--); |
| 18936 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18937 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 18938 | Py_ssize_t _children_capacity = 1; |
| 18939 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18940 | { // ',' expression |
| 18941 | if (p->error_indicator) { |
| 18942 | D(p->level--); |
| 18943 | return NULL; |
| 18944 | } |
| 18945 | D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 18946 | Token * _literal; |
| 18947 | expr_ty elem; |
| 18948 | while ( |
| 18949 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 18950 | && |
| 18951 | (elem = expression_rule(p)) // expression |
| 18952 | ) |
| 18953 | { |
| 18954 | _res = elem; |
| 18955 | if (_res == NULL && PyErr_Occurred()) { |
| 18956 | p->error_indicator = 1; |
| 18957 | PyMem_Free(_children); |
| 18958 | D(p->level--); |
| 18959 | return NULL; |
| 18960 | } |
| 18961 | if (_n == _children_capacity) { |
| 18962 | _children_capacity *= 2; |
| 18963 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18964 | if (!_new_children) { |
| 18965 | p->error_indicator = 1; |
| 18966 | PyErr_NoMemory(); |
| 18967 | D(p->level--); |
| 18968 | return NULL; |
| 18969 | } |
| 18970 | _children = _new_children; |
| 18971 | } |
| 18972 | _children[_n++] = _res; |
| 18973 | _mark = p->mark; |
| 18974 | } |
| 18975 | p->mark = _mark; |
| 18976 | D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ', |
| 18977 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 18978 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18979 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18980 | if (!_seq) { |
| 18981 | PyMem_Free(_children); |
| 18982 | p->error_indicator = 1; |
| 18983 | PyErr_NoMemory(); |
| 18984 | D(p->level--); |
| 18985 | return NULL; |
| 18986 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18987 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18988 | PyMem_Free(_children); |
| 18989 | _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq); |
| 18990 | D(p->level--); |
| 18991 | return _seq; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18992 | } |
| 18993 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18994 | // _gather_5: expression _loop0_6 |
| 18995 | static asdl_seq * |
| 18996 | _gather_5_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18997 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18998 | D(p->level++); |
| 18999 | if (p->error_indicator) { |
| 19000 | D(p->level--); |
| 19001 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 19002 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19003 | asdl_seq * _res = NULL; |
| 19004 | int _mark = p->mark; |
| 19005 | { // expression _loop0_6 |
| 19006 | if (p->error_indicator) { |
| 19007 | D(p->level--); |
| 19008 | return NULL; |
| 19009 | } |
| 19010 | D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); |
| 19011 | expr_ty elem; |
| 19012 | asdl_seq * seq; |
| 19013 | if ( |
| 19014 | (elem = expression_rule(p)) // expression |
| 19015 | && |
| 19016 | (seq = _loop0_6_rule(p)) // _loop0_6 |
| 19017 | ) |
| 19018 | { |
| 19019 | D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); |
| 19020 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 19021 | goto done; |
| 19022 | } |
| 19023 | p->mark = _mark; |
| 19024 | D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ', |
| 19025 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6")); |
| 19026 | } |
| 19027 | _res = NULL; |
| 19028 | done: |
| 19029 | D(p->level--); |
| 19030 | return _res; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19031 | } |
| 19032 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19033 | // _loop0_8: ',' expression |
| 19034 | static asdl_seq * |
| 19035 | _loop0_8_rule(Parser *p) |
| 19036 | { |
| 19037 | D(p->level++); |
| 19038 | if (p->error_indicator) { |
| 19039 | D(p->level--); |
| 19040 | return NULL; |
| 19041 | } |
| 19042 | void *_res = NULL; |
| 19043 | int _mark = p->mark; |
| 19044 | int _start_mark = p->mark; |
| 19045 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19046 | if (!_children) { |
| 19047 | p->error_indicator = 1; |
| 19048 | PyErr_NoMemory(); |
| 19049 | D(p->level--); |
| 19050 | return NULL; |
| 19051 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19052 | Py_ssize_t _children_capacity = 1; |
| 19053 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19054 | { // ',' expression |
| 19055 | if (p->error_indicator) { |
| 19056 | D(p->level--); |
| 19057 | return NULL; |
| 19058 | } |
| 19059 | D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 19060 | Token * _literal; |
| 19061 | expr_ty elem; |
| 19062 | while ( |
| 19063 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 19064 | && |
| 19065 | (elem = expression_rule(p)) // expression |
| 19066 | ) |
| 19067 | { |
| 19068 | _res = elem; |
| 19069 | if (_res == NULL && PyErr_Occurred()) { |
| 19070 | p->error_indicator = 1; |
| 19071 | PyMem_Free(_children); |
| 19072 | D(p->level--); |
| 19073 | return NULL; |
| 19074 | } |
| 19075 | if (_n == _children_capacity) { |
| 19076 | _children_capacity *= 2; |
| 19077 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19078 | if (!_new_children) { |
| 19079 | p->error_indicator = 1; |
| 19080 | PyErr_NoMemory(); |
| 19081 | D(p->level--); |
| 19082 | return NULL; |
| 19083 | } |
| 19084 | _children = _new_children; |
| 19085 | } |
| 19086 | _children[_n++] = _res; |
| 19087 | _mark = p->mark; |
| 19088 | } |
| 19089 | p->mark = _mark; |
| 19090 | D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ', |
| 19091 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 19092 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19093 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19094 | if (!_seq) { |
| 19095 | PyMem_Free(_children); |
| 19096 | p->error_indicator = 1; |
| 19097 | PyErr_NoMemory(); |
| 19098 | D(p->level--); |
| 19099 | return NULL; |
| 19100 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19101 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19102 | PyMem_Free(_children); |
| 19103 | _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq); |
| 19104 | D(p->level--); |
| 19105 | return _seq; |
| 19106 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19107 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19108 | // _gather_7: expression _loop0_8 |
| 19109 | static asdl_seq * |
| 19110 | _gather_7_rule(Parser *p) |
| 19111 | { |
| 19112 | D(p->level++); |
| 19113 | if (p->error_indicator) { |
| 19114 | D(p->level--); |
| 19115 | return NULL; |
| 19116 | } |
| 19117 | asdl_seq * _res = NULL; |
| 19118 | int _mark = p->mark; |
| 19119 | { // expression _loop0_8 |
| 19120 | if (p->error_indicator) { |
| 19121 | D(p->level--); |
| 19122 | return NULL; |
| 19123 | } |
| 19124 | D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); |
| 19125 | expr_ty elem; |
| 19126 | asdl_seq * seq; |
| 19127 | if ( |
| 19128 | (elem = expression_rule(p)) // expression |
| 19129 | && |
| 19130 | (seq = _loop0_8_rule(p)) // _loop0_8 |
| 19131 | ) |
| 19132 | { |
| 19133 | D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); |
| 19134 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 19135 | goto done; |
| 19136 | } |
| 19137 | p->mark = _mark; |
| 19138 | D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ', |
| 19139 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8")); |
| 19140 | } |
| 19141 | _res = NULL; |
| 19142 | done: |
| 19143 | D(p->level--); |
| 19144 | return _res; |
| 19145 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19146 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19147 | // _loop0_10: ',' expression |
| 19148 | static asdl_seq * |
| 19149 | _loop0_10_rule(Parser *p) |
| 19150 | { |
| 19151 | D(p->level++); |
| 19152 | if (p->error_indicator) { |
| 19153 | D(p->level--); |
| 19154 | return NULL; |
| 19155 | } |
| 19156 | void *_res = NULL; |
| 19157 | int _mark = p->mark; |
| 19158 | int _start_mark = p->mark; |
| 19159 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19160 | if (!_children) { |
| 19161 | p->error_indicator = 1; |
| 19162 | PyErr_NoMemory(); |
| 19163 | D(p->level--); |
| 19164 | return NULL; |
| 19165 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19166 | Py_ssize_t _children_capacity = 1; |
| 19167 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19168 | { // ',' expression |
| 19169 | if (p->error_indicator) { |
| 19170 | D(p->level--); |
| 19171 | return NULL; |
| 19172 | } |
| 19173 | D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 19174 | Token * _literal; |
| 19175 | expr_ty elem; |
| 19176 | while ( |
| 19177 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 19178 | && |
| 19179 | (elem = expression_rule(p)) // expression |
| 19180 | ) |
| 19181 | { |
| 19182 | _res = elem; |
| 19183 | if (_res == NULL && PyErr_Occurred()) { |
| 19184 | p->error_indicator = 1; |
| 19185 | PyMem_Free(_children); |
| 19186 | D(p->level--); |
| 19187 | return NULL; |
| 19188 | } |
| 19189 | if (_n == _children_capacity) { |
| 19190 | _children_capacity *= 2; |
| 19191 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19192 | if (!_new_children) { |
| 19193 | p->error_indicator = 1; |
| 19194 | PyErr_NoMemory(); |
| 19195 | D(p->level--); |
| 19196 | return NULL; |
| 19197 | } |
| 19198 | _children = _new_children; |
| 19199 | } |
| 19200 | _children[_n++] = _res; |
| 19201 | _mark = p->mark; |
| 19202 | } |
| 19203 | p->mark = _mark; |
| 19204 | D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ', |
| 19205 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 19206 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19207 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19208 | if (!_seq) { |
| 19209 | PyMem_Free(_children); |
| 19210 | p->error_indicator = 1; |
| 19211 | PyErr_NoMemory(); |
| 19212 | D(p->level--); |
| 19213 | return NULL; |
| 19214 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19215 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19216 | PyMem_Free(_children); |
| 19217 | _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq); |
| 19218 | D(p->level--); |
| 19219 | return _seq; |
| 19220 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19221 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19222 | // _gather_9: expression _loop0_10 |
| 19223 | static asdl_seq * |
| 19224 | _gather_9_rule(Parser *p) |
| 19225 | { |
| 19226 | D(p->level++); |
| 19227 | if (p->error_indicator) { |
| 19228 | D(p->level--); |
| 19229 | return NULL; |
| 19230 | } |
| 19231 | asdl_seq * _res = NULL; |
| 19232 | int _mark = p->mark; |
| 19233 | { // expression _loop0_10 |
| 19234 | if (p->error_indicator) { |
| 19235 | D(p->level--); |
| 19236 | return NULL; |
| 19237 | } |
| 19238 | D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); |
| 19239 | expr_ty elem; |
| 19240 | asdl_seq * seq; |
| 19241 | if ( |
| 19242 | (elem = expression_rule(p)) // expression |
| 19243 | && |
| 19244 | (seq = _loop0_10_rule(p)) // _loop0_10 |
| 19245 | ) |
| 19246 | { |
| 19247 | D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); |
| 19248 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 19249 | goto done; |
| 19250 | } |
| 19251 | p->mark = _mark; |
| 19252 | D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ', |
| 19253 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10")); |
| 19254 | } |
| 19255 | _res = NULL; |
| 19256 | done: |
| 19257 | D(p->level--); |
| 19258 | return _res; |
| 19259 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19260 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19261 | // _loop1_11: statement |
| 19262 | static asdl_seq * |
| 19263 | _loop1_11_rule(Parser *p) |
| 19264 | { |
| 19265 | D(p->level++); |
| 19266 | if (p->error_indicator) { |
| 19267 | D(p->level--); |
| 19268 | return NULL; |
| 19269 | } |
| 19270 | void *_res = NULL; |
| 19271 | int _mark = p->mark; |
| 19272 | int _start_mark = p->mark; |
| 19273 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19274 | if (!_children) { |
| 19275 | p->error_indicator = 1; |
| 19276 | PyErr_NoMemory(); |
| 19277 | D(p->level--); |
| 19278 | return NULL; |
| 19279 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19280 | Py_ssize_t _children_capacity = 1; |
| 19281 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19282 | { // statement |
| 19283 | if (p->error_indicator) { |
| 19284 | D(p->level--); |
| 19285 | return NULL; |
| 19286 | } |
| 19287 | D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement")); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19288 | asdl_stmt_seq* statement_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19289 | while ( |
| 19290 | (statement_var = statement_rule(p)) // statement |
| 19291 | ) |
| 19292 | { |
| 19293 | _res = statement_var; |
| 19294 | if (_n == _children_capacity) { |
| 19295 | _children_capacity *= 2; |
| 19296 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19297 | if (!_new_children) { |
| 19298 | p->error_indicator = 1; |
| 19299 | PyErr_NoMemory(); |
| 19300 | D(p->level--); |
| 19301 | return NULL; |
| 19302 | } |
| 19303 | _children = _new_children; |
| 19304 | } |
| 19305 | _children[_n++] = _res; |
| 19306 | _mark = p->mark; |
| 19307 | } |
| 19308 | p->mark = _mark; |
| 19309 | D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ', |
| 19310 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement")); |
| 19311 | } |
| 19312 | if (_n == 0 || p->error_indicator) { |
| 19313 | PyMem_Free(_children); |
| 19314 | D(p->level--); |
| 19315 | return NULL; |
| 19316 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19317 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19318 | if (!_seq) { |
| 19319 | PyMem_Free(_children); |
| 19320 | p->error_indicator = 1; |
| 19321 | PyErr_NoMemory(); |
| 19322 | D(p->level--); |
| 19323 | return NULL; |
| 19324 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19325 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19326 | PyMem_Free(_children); |
| 19327 | _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq); |
| 19328 | D(p->level--); |
| 19329 | return _seq; |
| 19330 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19331 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19332 | // _loop0_13: ';' simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19333 | static asdl_seq * |
| 19334 | _loop0_13_rule(Parser *p) |
| 19335 | { |
| 19336 | D(p->level++); |
| 19337 | if (p->error_indicator) { |
| 19338 | D(p->level--); |
| 19339 | return NULL; |
| 19340 | } |
| 19341 | void *_res = NULL; |
| 19342 | int _mark = p->mark; |
| 19343 | int _start_mark = p->mark; |
| 19344 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19345 | if (!_children) { |
| 19346 | p->error_indicator = 1; |
| 19347 | PyErr_NoMemory(); |
| 19348 | D(p->level--); |
| 19349 | return NULL; |
| 19350 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19351 | Py_ssize_t _children_capacity = 1; |
| 19352 | Py_ssize_t _n = 0; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19353 | { // ';' simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19354 | if (p->error_indicator) { |
| 19355 | D(p->level--); |
| 19356 | return NULL; |
| 19357 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19358 | D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' simple_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19359 | Token * _literal; |
| 19360 | stmt_ty elem; |
| 19361 | while ( |
| 19362 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
| 19363 | && |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19364 | (elem = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19365 | ) |
| 19366 | { |
| 19367 | _res = elem; |
| 19368 | if (_res == NULL && PyErr_Occurred()) { |
| 19369 | p->error_indicator = 1; |
| 19370 | PyMem_Free(_children); |
| 19371 | D(p->level--); |
| 19372 | return NULL; |
| 19373 | } |
| 19374 | if (_n == _children_capacity) { |
| 19375 | _children_capacity *= 2; |
| 19376 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19377 | if (!_new_children) { |
| 19378 | p->error_indicator = 1; |
| 19379 | PyErr_NoMemory(); |
| 19380 | D(p->level--); |
| 19381 | return NULL; |
| 19382 | } |
| 19383 | _children = _new_children; |
| 19384 | } |
| 19385 | _children[_n++] = _res; |
| 19386 | _mark = p->mark; |
| 19387 | } |
| 19388 | p->mark = _mark; |
| 19389 | D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19390 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' simple_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19391 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19392 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19393 | if (!_seq) { |
| 19394 | PyMem_Free(_children); |
| 19395 | p->error_indicator = 1; |
| 19396 | PyErr_NoMemory(); |
| 19397 | D(p->level--); |
| 19398 | return NULL; |
| 19399 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19400 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19401 | PyMem_Free(_children); |
| 19402 | _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq); |
| 19403 | D(p->level--); |
| 19404 | return _seq; |
| 19405 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19406 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19407 | // _gather_12: simple_stmt _loop0_13 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19408 | static asdl_seq * |
| 19409 | _gather_12_rule(Parser *p) |
| 19410 | { |
| 19411 | D(p->level++); |
| 19412 | if (p->error_indicator) { |
| 19413 | D(p->level--); |
| 19414 | return NULL; |
| 19415 | } |
| 19416 | asdl_seq * _res = NULL; |
| 19417 | int _mark = p->mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19418 | { // simple_stmt _loop0_13 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19419 | if (p->error_indicator) { |
| 19420 | D(p->level--); |
| 19421 | return NULL; |
| 19422 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19423 | D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19424 | stmt_ty elem; |
| 19425 | asdl_seq * seq; |
| 19426 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19427 | (elem = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19428 | && |
| 19429 | (seq = _loop0_13_rule(p)) // _loop0_13 |
| 19430 | ) |
| 19431 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19432 | D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19433 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 19434 | goto done; |
| 19435 | } |
| 19436 | p->mark = _mark; |
| 19437 | D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19438 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_13")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19439 | } |
| 19440 | _res = NULL; |
| 19441 | done: |
| 19442 | D(p->level--); |
| 19443 | return _res; |
| 19444 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19445 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19446 | // _tmp_14: 'import' | 'from' |
| 19447 | static void * |
| 19448 | _tmp_14_rule(Parser *p) |
| 19449 | { |
| 19450 | D(p->level++); |
| 19451 | if (p->error_indicator) { |
| 19452 | D(p->level--); |
| 19453 | return NULL; |
| 19454 | } |
| 19455 | void * _res = NULL; |
| 19456 | int _mark = p->mark; |
| 19457 | { // 'import' |
| 19458 | if (p->error_indicator) { |
| 19459 | D(p->level--); |
| 19460 | return NULL; |
| 19461 | } |
| 19462 | D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'")); |
| 19463 | Token * _keyword; |
| 19464 | if ( |
| 19465 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
| 19466 | ) |
| 19467 | { |
| 19468 | D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'")); |
| 19469 | _res = _keyword; |
| 19470 | goto done; |
| 19471 | } |
| 19472 | p->mark = _mark; |
| 19473 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', |
| 19474 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'")); |
| 19475 | } |
| 19476 | { // 'from' |
| 19477 | if (p->error_indicator) { |
| 19478 | D(p->level--); |
| 19479 | return NULL; |
| 19480 | } |
| 19481 | D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'")); |
| 19482 | Token * _keyword; |
| 19483 | if ( |
| 19484 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
| 19485 | ) |
| 19486 | { |
| 19487 | D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'")); |
| 19488 | _res = _keyword; |
| 19489 | goto done; |
| 19490 | } |
| 19491 | p->mark = _mark; |
| 19492 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', |
| 19493 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'")); |
| 19494 | } |
| 19495 | _res = NULL; |
| 19496 | done: |
| 19497 | D(p->level--); |
| 19498 | return _res; |
| 19499 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19500 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19501 | // _tmp_15: 'def' | '@' | ASYNC |
| 19502 | static void * |
| 19503 | _tmp_15_rule(Parser *p) |
| 19504 | { |
| 19505 | D(p->level++); |
| 19506 | if (p->error_indicator) { |
| 19507 | D(p->level--); |
| 19508 | return NULL; |
| 19509 | } |
| 19510 | void * _res = NULL; |
| 19511 | int _mark = p->mark; |
| 19512 | { // 'def' |
| 19513 | if (p->error_indicator) { |
| 19514 | D(p->level--); |
| 19515 | return NULL; |
| 19516 | } |
| 19517 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); |
| 19518 | Token * _keyword; |
| 19519 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19520 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19521 | ) |
| 19522 | { |
| 19523 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); |
| 19524 | _res = _keyword; |
| 19525 | goto done; |
| 19526 | } |
| 19527 | p->mark = _mark; |
| 19528 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 19529 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'")); |
| 19530 | } |
| 19531 | { // '@' |
| 19532 | if (p->error_indicator) { |
| 19533 | D(p->level--); |
| 19534 | return NULL; |
| 19535 | } |
| 19536 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
| 19537 | Token * _literal; |
| 19538 | if ( |
| 19539 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
| 19540 | ) |
| 19541 | { |
| 19542 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
| 19543 | _res = _literal; |
| 19544 | goto done; |
| 19545 | } |
| 19546 | p->mark = _mark; |
| 19547 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 19548 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
| 19549 | } |
| 19550 | { // ASYNC |
| 19551 | if (p->error_indicator) { |
| 19552 | D(p->level--); |
| 19553 | return NULL; |
| 19554 | } |
| 19555 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19556 | Token * async_var; |
| 19557 | if ( |
| 19558 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 19559 | ) |
| 19560 | { |
| 19561 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19562 | _res = async_var; |
| 19563 | goto done; |
| 19564 | } |
| 19565 | p->mark = _mark; |
| 19566 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 19567 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
| 19568 | } |
| 19569 | _res = NULL; |
| 19570 | done: |
| 19571 | D(p->level--); |
| 19572 | return _res; |
| 19573 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19574 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19575 | // _tmp_16: 'class' | '@' |
| 19576 | static void * |
| 19577 | _tmp_16_rule(Parser *p) |
| 19578 | { |
| 19579 | D(p->level++); |
| 19580 | if (p->error_indicator) { |
| 19581 | D(p->level--); |
| 19582 | return NULL; |
| 19583 | } |
| 19584 | void * _res = NULL; |
| 19585 | int _mark = p->mark; |
| 19586 | { // 'class' |
| 19587 | if (p->error_indicator) { |
| 19588 | D(p->level--); |
| 19589 | return NULL; |
| 19590 | } |
| 19591 | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); |
| 19592 | Token * _keyword; |
| 19593 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19594 | (_keyword = _PyPegen_expect_token(p, 527)) // token='class' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19595 | ) |
| 19596 | { |
| 19597 | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); |
| 19598 | _res = _keyword; |
| 19599 | goto done; |
| 19600 | } |
| 19601 | p->mark = _mark; |
| 19602 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
| 19603 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'")); |
| 19604 | } |
| 19605 | { // '@' |
| 19606 | if (p->error_indicator) { |
| 19607 | D(p->level--); |
| 19608 | return NULL; |
| 19609 | } |
| 19610 | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
| 19611 | Token * _literal; |
| 19612 | if ( |
| 19613 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
| 19614 | ) |
| 19615 | { |
| 19616 | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
| 19617 | _res = _literal; |
| 19618 | goto done; |
| 19619 | } |
| 19620 | p->mark = _mark; |
| 19621 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
| 19622 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
| 19623 | } |
| 19624 | _res = NULL; |
| 19625 | done: |
| 19626 | D(p->level--); |
| 19627 | return _res; |
| 19628 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19629 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19630 | // _tmp_17: 'with' | ASYNC |
| 19631 | static void * |
| 19632 | _tmp_17_rule(Parser *p) |
| 19633 | { |
| 19634 | D(p->level++); |
| 19635 | if (p->error_indicator) { |
| 19636 | D(p->level--); |
| 19637 | return NULL; |
| 19638 | } |
| 19639 | void * _res = NULL; |
| 19640 | int _mark = p->mark; |
| 19641 | { // 'with' |
| 19642 | if (p->error_indicator) { |
| 19643 | D(p->level--); |
| 19644 | return NULL; |
| 19645 | } |
| 19646 | D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'")); |
| 19647 | Token * _keyword; |
| 19648 | if ( |
| 19649 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 19650 | ) |
| 19651 | { |
| 19652 | D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'")); |
| 19653 | _res = _keyword; |
| 19654 | goto done; |
| 19655 | } |
| 19656 | p->mark = _mark; |
| 19657 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', |
| 19658 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'")); |
| 19659 | } |
| 19660 | { // ASYNC |
| 19661 | if (p->error_indicator) { |
| 19662 | D(p->level--); |
| 19663 | return NULL; |
| 19664 | } |
| 19665 | D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19666 | Token * async_var; |
| 19667 | if ( |
| 19668 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 19669 | ) |
| 19670 | { |
| 19671 | D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19672 | _res = async_var; |
| 19673 | goto done; |
| 19674 | } |
| 19675 | p->mark = _mark; |
| 19676 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', |
| 19677 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
| 19678 | } |
| 19679 | _res = NULL; |
| 19680 | done: |
| 19681 | D(p->level--); |
| 19682 | return _res; |
| 19683 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19684 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19685 | // _tmp_18: 'for' | ASYNC |
| 19686 | static void * |
| 19687 | _tmp_18_rule(Parser *p) |
| 19688 | { |
| 19689 | D(p->level++); |
| 19690 | if (p->error_indicator) { |
| 19691 | D(p->level--); |
| 19692 | return NULL; |
| 19693 | } |
| 19694 | void * _res = NULL; |
| 19695 | int _mark = p->mark; |
| 19696 | { // 'for' |
| 19697 | if (p->error_indicator) { |
| 19698 | D(p->level--); |
| 19699 | return NULL; |
| 19700 | } |
| 19701 | D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); |
| 19702 | Token * _keyword; |
| 19703 | if ( |
| 19704 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 19705 | ) |
| 19706 | { |
| 19707 | D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); |
| 19708 | _res = _keyword; |
| 19709 | goto done; |
| 19710 | } |
| 19711 | p->mark = _mark; |
| 19712 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', |
| 19713 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'")); |
| 19714 | } |
| 19715 | { // ASYNC |
| 19716 | if (p->error_indicator) { |
| 19717 | D(p->level--); |
| 19718 | return NULL; |
| 19719 | } |
| 19720 | D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19721 | Token * async_var; |
| 19722 | if ( |
| 19723 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 19724 | ) |
| 19725 | { |
| 19726 | D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19727 | _res = async_var; |
| 19728 | goto done; |
| 19729 | } |
| 19730 | p->mark = _mark; |
| 19731 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', |
| 19732 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
| 19733 | } |
| 19734 | _res = NULL; |
| 19735 | done: |
| 19736 | D(p->level--); |
| 19737 | return _res; |
| 19738 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19739 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19740 | // _tmp_19: '=' annotated_rhs |
| 19741 | static void * |
| 19742 | _tmp_19_rule(Parser *p) |
| 19743 | { |
| 19744 | D(p->level++); |
| 19745 | if (p->error_indicator) { |
| 19746 | D(p->level--); |
| 19747 | return NULL; |
| 19748 | } |
| 19749 | void * _res = NULL; |
| 19750 | int _mark = p->mark; |
| 19751 | { // '=' annotated_rhs |
| 19752 | if (p->error_indicator) { |
| 19753 | D(p->level--); |
| 19754 | return NULL; |
| 19755 | } |
| 19756 | D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
| 19757 | Token * _literal; |
| 19758 | expr_ty d; |
| 19759 | if ( |
| 19760 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 19761 | && |
| 19762 | (d = annotated_rhs_rule(p)) // annotated_rhs |
| 19763 | ) |
| 19764 | { |
| 19765 | D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
| 19766 | _res = d; |
| 19767 | if (_res == NULL && PyErr_Occurred()) { |
| 19768 | p->error_indicator = 1; |
| 19769 | D(p->level--); |
| 19770 | return NULL; |
| 19771 | } |
| 19772 | goto done; |
| 19773 | } |
| 19774 | p->mark = _mark; |
| 19775 | D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ', |
| 19776 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
| 19777 | } |
| 19778 | _res = NULL; |
| 19779 | done: |
| 19780 | D(p->level--); |
| 19781 | return _res; |
| 19782 | } |
| 19783 | |
| 19784 | // _tmp_20: '(' single_target ')' | single_subscript_attribute_target |
| 19785 | static void * |
| 19786 | _tmp_20_rule(Parser *p) |
| 19787 | { |
| 19788 | D(p->level++); |
| 19789 | if (p->error_indicator) { |
| 19790 | D(p->level--); |
| 19791 | return NULL; |
| 19792 | } |
| 19793 | void * _res = NULL; |
| 19794 | int _mark = p->mark; |
| 19795 | { // '(' single_target ')' |
| 19796 | if (p->error_indicator) { |
| 19797 | D(p->level--); |
| 19798 | return NULL; |
| 19799 | } |
| 19800 | D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
| 19801 | Token * _literal; |
| 19802 | Token * _literal_1; |
| 19803 | expr_ty b; |
| 19804 | if ( |
| 19805 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 19806 | && |
| 19807 | (b = single_target_rule(p)) // single_target |
| 19808 | && |
| 19809 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 19810 | ) |
| 19811 | { |
| 19812 | D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
| 19813 | _res = b; |
| 19814 | if (_res == NULL && PyErr_Occurred()) { |
| 19815 | p->error_indicator = 1; |
| 19816 | D(p->level--); |
| 19817 | return NULL; |
| 19818 | } |
| 19819 | goto done; |
| 19820 | } |
| 19821 | p->mark = _mark; |
| 19822 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', |
| 19823 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
| 19824 | } |
| 19825 | { // single_subscript_attribute_target |
| 19826 | if (p->error_indicator) { |
| 19827 | D(p->level--); |
| 19828 | return NULL; |
| 19829 | } |
| 19830 | D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
| 19831 | expr_ty single_subscript_attribute_target_var; |
| 19832 | if ( |
| 19833 | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
| 19834 | ) |
| 19835 | { |
| 19836 | D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
| 19837 | _res = single_subscript_attribute_target_var; |
| 19838 | goto done; |
| 19839 | } |
| 19840 | p->mark = _mark; |
| 19841 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', |
| 19842 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
| 19843 | } |
| 19844 | _res = NULL; |
| 19845 | done: |
| 19846 | D(p->level--); |
| 19847 | return _res; |
| 19848 | } |
| 19849 | |
| 19850 | // _tmp_21: '=' annotated_rhs |
| 19851 | static void * |
| 19852 | _tmp_21_rule(Parser *p) |
| 19853 | { |
| 19854 | D(p->level++); |
| 19855 | if (p->error_indicator) { |
| 19856 | D(p->level--); |
| 19857 | return NULL; |
| 19858 | } |
| 19859 | void * _res = NULL; |
| 19860 | int _mark = p->mark; |
| 19861 | { // '=' annotated_rhs |
| 19862 | if (p->error_indicator) { |
| 19863 | D(p->level--); |
| 19864 | return NULL; |
| 19865 | } |
| 19866 | D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
| 19867 | Token * _literal; |
| 19868 | expr_ty d; |
| 19869 | if ( |
| 19870 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 19871 | && |
| 19872 | (d = annotated_rhs_rule(p)) // annotated_rhs |
| 19873 | ) |
| 19874 | { |
| 19875 | D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
| 19876 | _res = d; |
| 19877 | if (_res == NULL && PyErr_Occurred()) { |
| 19878 | p->error_indicator = 1; |
| 19879 | D(p->level--); |
| 19880 | return NULL; |
| 19881 | } |
| 19882 | goto done; |
| 19883 | } |
| 19884 | p->mark = _mark; |
| 19885 | D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ', |
| 19886 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
| 19887 | } |
| 19888 | _res = NULL; |
| 19889 | done: |
| 19890 | D(p->level--); |
| 19891 | return _res; |
| 19892 | } |
| 19893 | |
| 19894 | // _loop1_22: (star_targets '=') |
| 19895 | static asdl_seq * |
| 19896 | _loop1_22_rule(Parser *p) |
| 19897 | { |
| 19898 | D(p->level++); |
| 19899 | if (p->error_indicator) { |
| 19900 | D(p->level--); |
| 19901 | return NULL; |
| 19902 | } |
| 19903 | void *_res = NULL; |
| 19904 | int _mark = p->mark; |
| 19905 | int _start_mark = p->mark; |
| 19906 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19907 | if (!_children) { |
| 19908 | p->error_indicator = 1; |
| 19909 | PyErr_NoMemory(); |
| 19910 | D(p->level--); |
| 19911 | return NULL; |
| 19912 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19913 | Py_ssize_t _children_capacity = 1; |
| 19914 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19915 | { // (star_targets '=') |
| 19916 | if (p->error_indicator) { |
| 19917 | D(p->level--); |
| 19918 | return NULL; |
| 19919 | } |
| 19920 | D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19921 | void *_tmp_162_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19922 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19923 | (_tmp_162_var = _tmp_162_rule(p)) // star_targets '=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19924 | ) |
| 19925 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19926 | _res = _tmp_162_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19927 | if (_n == _children_capacity) { |
| 19928 | _children_capacity *= 2; |
| 19929 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19930 | if (!_new_children) { |
| 19931 | p->error_indicator = 1; |
| 19932 | PyErr_NoMemory(); |
| 19933 | D(p->level--); |
| 19934 | return NULL; |
| 19935 | } |
| 19936 | _children = _new_children; |
| 19937 | } |
| 19938 | _children[_n++] = _res; |
| 19939 | _mark = p->mark; |
| 19940 | } |
| 19941 | p->mark = _mark; |
| 19942 | D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ', |
| 19943 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
| 19944 | } |
| 19945 | if (_n == 0 || p->error_indicator) { |
| 19946 | PyMem_Free(_children); |
| 19947 | D(p->level--); |
| 19948 | return NULL; |
| 19949 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19950 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19951 | if (!_seq) { |
| 19952 | PyMem_Free(_children); |
| 19953 | p->error_indicator = 1; |
| 19954 | PyErr_NoMemory(); |
| 19955 | D(p->level--); |
| 19956 | return NULL; |
| 19957 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19958 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19959 | PyMem_Free(_children); |
| 19960 | _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq); |
| 19961 | D(p->level--); |
| 19962 | return _seq; |
| 19963 | } |
| 19964 | |
| 19965 | // _tmp_23: yield_expr | star_expressions |
| 19966 | static void * |
| 19967 | _tmp_23_rule(Parser *p) |
| 19968 | { |
| 19969 | D(p->level++); |
| 19970 | if (p->error_indicator) { |
| 19971 | D(p->level--); |
| 19972 | return NULL; |
| 19973 | } |
| 19974 | void * _res = NULL; |
| 19975 | int _mark = p->mark; |
| 19976 | { // yield_expr |
| 19977 | if (p->error_indicator) { |
| 19978 | D(p->level--); |
| 19979 | return NULL; |
| 19980 | } |
| 19981 | D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 19982 | expr_ty yield_expr_var; |
| 19983 | if ( |
| 19984 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 19985 | ) |
| 19986 | { |
| 19987 | D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 19988 | _res = yield_expr_var; |
| 19989 | goto done; |
| 19990 | } |
| 19991 | p->mark = _mark; |
| 19992 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', |
| 19993 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 19994 | } |
| 19995 | { // star_expressions |
| 19996 | if (p->error_indicator) { |
| 19997 | D(p->level--); |
| 19998 | return NULL; |
| 19999 | } |
| 20000 | D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 20001 | expr_ty star_expressions_var; |
| 20002 | if ( |
| 20003 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 20004 | ) |
| 20005 | { |
| 20006 | D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 20007 | _res = star_expressions_var; |
| 20008 | goto done; |
| 20009 | } |
| 20010 | p->mark = _mark; |
| 20011 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', |
| 20012 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 20013 | } |
| 20014 | _res = NULL; |
| 20015 | done: |
| 20016 | D(p->level--); |
| 20017 | return _res; |
| 20018 | } |
| 20019 | |
| 20020 | // _tmp_24: yield_expr | star_expressions |
| 20021 | static void * |
| 20022 | _tmp_24_rule(Parser *p) |
| 20023 | { |
| 20024 | D(p->level++); |
| 20025 | if (p->error_indicator) { |
| 20026 | D(p->level--); |
| 20027 | return NULL; |
| 20028 | } |
| 20029 | void * _res = NULL; |
| 20030 | int _mark = p->mark; |
| 20031 | { // yield_expr |
| 20032 | if (p->error_indicator) { |
| 20033 | D(p->level--); |
| 20034 | return NULL; |
| 20035 | } |
| 20036 | D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 20037 | expr_ty yield_expr_var; |
| 20038 | if ( |
| 20039 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 20040 | ) |
| 20041 | { |
| 20042 | D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 20043 | _res = yield_expr_var; |
| 20044 | goto done; |
| 20045 | } |
| 20046 | p->mark = _mark; |
| 20047 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', |
| 20048 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 20049 | } |
| 20050 | { // star_expressions |
| 20051 | if (p->error_indicator) { |
| 20052 | D(p->level--); |
| 20053 | return NULL; |
| 20054 | } |
| 20055 | D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 20056 | expr_ty star_expressions_var; |
| 20057 | if ( |
| 20058 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 20059 | ) |
| 20060 | { |
| 20061 | D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 20062 | _res = star_expressions_var; |
| 20063 | goto done; |
| 20064 | } |
| 20065 | p->mark = _mark; |
| 20066 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', |
| 20067 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 20068 | } |
| 20069 | _res = NULL; |
| 20070 | done: |
| 20071 | D(p->level--); |
| 20072 | return _res; |
| 20073 | } |
| 20074 | |
| 20075 | // _loop0_26: ',' NAME |
| 20076 | static asdl_seq * |
| 20077 | _loop0_26_rule(Parser *p) |
| 20078 | { |
| 20079 | D(p->level++); |
| 20080 | if (p->error_indicator) { |
| 20081 | D(p->level--); |
| 20082 | return NULL; |
| 20083 | } |
| 20084 | void *_res = NULL; |
| 20085 | int _mark = p->mark; |
| 20086 | int _start_mark = p->mark; |
| 20087 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20088 | if (!_children) { |
| 20089 | p->error_indicator = 1; |
| 20090 | PyErr_NoMemory(); |
| 20091 | D(p->level--); |
| 20092 | return NULL; |
| 20093 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20094 | Py_ssize_t _children_capacity = 1; |
| 20095 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20096 | { // ',' NAME |
| 20097 | if (p->error_indicator) { |
| 20098 | D(p->level--); |
| 20099 | return NULL; |
| 20100 | } |
| 20101 | D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); |
| 20102 | Token * _literal; |
| 20103 | expr_ty elem; |
| 20104 | while ( |
| 20105 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20106 | && |
| 20107 | (elem = _PyPegen_name_token(p)) // NAME |
| 20108 | ) |
| 20109 | { |
| 20110 | _res = elem; |
| 20111 | if (_res == NULL && PyErr_Occurred()) { |
| 20112 | p->error_indicator = 1; |
| 20113 | PyMem_Free(_children); |
| 20114 | D(p->level--); |
| 20115 | return NULL; |
| 20116 | } |
| 20117 | if (_n == _children_capacity) { |
| 20118 | _children_capacity *= 2; |
| 20119 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20120 | if (!_new_children) { |
| 20121 | p->error_indicator = 1; |
| 20122 | PyErr_NoMemory(); |
| 20123 | D(p->level--); |
| 20124 | return NULL; |
| 20125 | } |
| 20126 | _children = _new_children; |
| 20127 | } |
| 20128 | _children[_n++] = _res; |
| 20129 | _mark = p->mark; |
| 20130 | } |
| 20131 | p->mark = _mark; |
| 20132 | D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ', |
| 20133 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
| 20134 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20135 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20136 | if (!_seq) { |
| 20137 | PyMem_Free(_children); |
| 20138 | p->error_indicator = 1; |
| 20139 | PyErr_NoMemory(); |
| 20140 | D(p->level--); |
| 20141 | return NULL; |
| 20142 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20143 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20144 | PyMem_Free(_children); |
| 20145 | _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); |
| 20146 | D(p->level--); |
| 20147 | return _seq; |
| 20148 | } |
| 20149 | |
| 20150 | // _gather_25: NAME _loop0_26 |
| 20151 | static asdl_seq * |
| 20152 | _gather_25_rule(Parser *p) |
| 20153 | { |
| 20154 | D(p->level++); |
| 20155 | if (p->error_indicator) { |
| 20156 | D(p->level--); |
| 20157 | return NULL; |
| 20158 | } |
| 20159 | asdl_seq * _res = NULL; |
| 20160 | int _mark = p->mark; |
| 20161 | { // NAME _loop0_26 |
| 20162 | if (p->error_indicator) { |
| 20163 | D(p->level--); |
| 20164 | return NULL; |
| 20165 | } |
| 20166 | D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); |
| 20167 | expr_ty elem; |
| 20168 | asdl_seq * seq; |
| 20169 | if ( |
| 20170 | (elem = _PyPegen_name_token(p)) // NAME |
| 20171 | && |
| 20172 | (seq = _loop0_26_rule(p)) // _loop0_26 |
| 20173 | ) |
| 20174 | { |
| 20175 | D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); |
| 20176 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20177 | goto done; |
| 20178 | } |
| 20179 | p->mark = _mark; |
| 20180 | D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ', |
| 20181 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26")); |
| 20182 | } |
| 20183 | _res = NULL; |
| 20184 | done: |
| 20185 | D(p->level--); |
| 20186 | return _res; |
| 20187 | } |
| 20188 | |
| 20189 | // _loop0_28: ',' NAME |
| 20190 | static asdl_seq * |
| 20191 | _loop0_28_rule(Parser *p) |
| 20192 | { |
| 20193 | D(p->level++); |
| 20194 | if (p->error_indicator) { |
| 20195 | D(p->level--); |
| 20196 | return NULL; |
| 20197 | } |
| 20198 | void *_res = NULL; |
| 20199 | int _mark = p->mark; |
| 20200 | int _start_mark = p->mark; |
| 20201 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20202 | if (!_children) { |
| 20203 | p->error_indicator = 1; |
| 20204 | PyErr_NoMemory(); |
| 20205 | D(p->level--); |
| 20206 | return NULL; |
| 20207 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20208 | Py_ssize_t _children_capacity = 1; |
| 20209 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20210 | { // ',' NAME |
| 20211 | if (p->error_indicator) { |
| 20212 | D(p->level--); |
| 20213 | return NULL; |
| 20214 | } |
| 20215 | D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); |
| 20216 | Token * _literal; |
| 20217 | expr_ty elem; |
| 20218 | while ( |
| 20219 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20220 | && |
| 20221 | (elem = _PyPegen_name_token(p)) // NAME |
| 20222 | ) |
| 20223 | { |
| 20224 | _res = elem; |
| 20225 | if (_res == NULL && PyErr_Occurred()) { |
| 20226 | p->error_indicator = 1; |
| 20227 | PyMem_Free(_children); |
| 20228 | D(p->level--); |
| 20229 | return NULL; |
| 20230 | } |
| 20231 | if (_n == _children_capacity) { |
| 20232 | _children_capacity *= 2; |
| 20233 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20234 | if (!_new_children) { |
| 20235 | p->error_indicator = 1; |
| 20236 | PyErr_NoMemory(); |
| 20237 | D(p->level--); |
| 20238 | return NULL; |
| 20239 | } |
| 20240 | _children = _new_children; |
| 20241 | } |
| 20242 | _children[_n++] = _res; |
| 20243 | _mark = p->mark; |
| 20244 | } |
| 20245 | p->mark = _mark; |
| 20246 | D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', |
| 20247 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
| 20248 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20249 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20250 | if (!_seq) { |
| 20251 | PyMem_Free(_children); |
| 20252 | p->error_indicator = 1; |
| 20253 | PyErr_NoMemory(); |
| 20254 | D(p->level--); |
| 20255 | return NULL; |
| 20256 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20257 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20258 | PyMem_Free(_children); |
| 20259 | _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); |
| 20260 | D(p->level--); |
| 20261 | return _seq; |
| 20262 | } |
| 20263 | |
| 20264 | // _gather_27: NAME _loop0_28 |
| 20265 | static asdl_seq * |
| 20266 | _gather_27_rule(Parser *p) |
| 20267 | { |
| 20268 | D(p->level++); |
| 20269 | if (p->error_indicator) { |
| 20270 | D(p->level--); |
| 20271 | return NULL; |
| 20272 | } |
| 20273 | asdl_seq * _res = NULL; |
| 20274 | int _mark = p->mark; |
| 20275 | { // NAME _loop0_28 |
| 20276 | if (p->error_indicator) { |
| 20277 | D(p->level--); |
| 20278 | return NULL; |
| 20279 | } |
| 20280 | D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); |
| 20281 | expr_ty elem; |
| 20282 | asdl_seq * seq; |
| 20283 | if ( |
| 20284 | (elem = _PyPegen_name_token(p)) // NAME |
| 20285 | && |
| 20286 | (seq = _loop0_28_rule(p)) // _loop0_28 |
| 20287 | ) |
| 20288 | { |
| 20289 | D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); |
| 20290 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20291 | goto done; |
| 20292 | } |
| 20293 | p->mark = _mark; |
| 20294 | D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ', |
| 20295 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28")); |
| 20296 | } |
| 20297 | _res = NULL; |
| 20298 | done: |
| 20299 | D(p->level--); |
| 20300 | return _res; |
| 20301 | } |
| 20302 | |
| 20303 | // _tmp_29: ',' expression |
| 20304 | static void * |
| 20305 | _tmp_29_rule(Parser *p) |
| 20306 | { |
| 20307 | D(p->level++); |
| 20308 | if (p->error_indicator) { |
| 20309 | D(p->level--); |
| 20310 | return NULL; |
| 20311 | } |
| 20312 | void * _res = NULL; |
| 20313 | int _mark = p->mark; |
| 20314 | { // ',' expression |
| 20315 | if (p->error_indicator) { |
| 20316 | D(p->level--); |
| 20317 | return NULL; |
| 20318 | } |
| 20319 | D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 20320 | Token * _literal; |
| 20321 | expr_ty z; |
| 20322 | if ( |
| 20323 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20324 | && |
| 20325 | (z = expression_rule(p)) // expression |
| 20326 | ) |
| 20327 | { |
| 20328 | D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 20329 | _res = z; |
| 20330 | if (_res == NULL && PyErr_Occurred()) { |
| 20331 | p->error_indicator = 1; |
| 20332 | D(p->level--); |
| 20333 | return NULL; |
| 20334 | } |
| 20335 | goto done; |
| 20336 | } |
| 20337 | p->mark = _mark; |
| 20338 | D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ', |
| 20339 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 20340 | } |
| 20341 | _res = NULL; |
| 20342 | done: |
| 20343 | D(p->level--); |
| 20344 | return _res; |
| 20345 | } |
| 20346 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20347 | // _tmp_30: ';' | NEWLINE |
| 20348 | static void * |
| 20349 | _tmp_30_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20350 | { |
| 20351 | D(p->level++); |
| 20352 | if (p->error_indicator) { |
| 20353 | D(p->level--); |
| 20354 | return NULL; |
| 20355 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20356 | void * _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20357 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20358 | { // ';' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20359 | if (p->error_indicator) { |
| 20360 | D(p->level--); |
| 20361 | return NULL; |
| 20362 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20363 | D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'")); |
| 20364 | Token * _literal; |
| 20365 | if ( |
| 20366 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20367 | ) |
| 20368 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20369 | D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'")); |
| 20370 | _res = _literal; |
| 20371 | goto done; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20372 | } |
| 20373 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20374 | D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ', |
| 20375 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20376 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20377 | { // NEWLINE |
| 20378 | if (p->error_indicator) { |
| 20379 | D(p->level--); |
| 20380 | return NULL; |
| 20381 | } |
| 20382 | D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 20383 | Token * newline_var; |
| 20384 | if ( |
| 20385 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 20386 | ) |
| 20387 | { |
| 20388 | D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 20389 | _res = newline_var; |
| 20390 | goto done; |
| 20391 | } |
| 20392 | p->mark = _mark; |
| 20393 | D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ', |
| 20394 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20395 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20396 | _res = NULL; |
| 20397 | done: |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20398 | D(p->level--); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20399 | return _res; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20400 | } |
| 20401 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20402 | // _loop0_31: ('.' | '...') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20403 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20404 | _loop0_31_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20405 | { |
| 20406 | D(p->level++); |
| 20407 | if (p->error_indicator) { |
| 20408 | D(p->level--); |
| 20409 | return NULL; |
| 20410 | } |
| 20411 | void *_res = NULL; |
| 20412 | int _mark = p->mark; |
| 20413 | int _start_mark = p->mark; |
| 20414 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20415 | if (!_children) { |
| 20416 | p->error_indicator = 1; |
| 20417 | PyErr_NoMemory(); |
| 20418 | D(p->level--); |
| 20419 | return NULL; |
| 20420 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20421 | Py_ssize_t _children_capacity = 1; |
| 20422 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20423 | { // ('.' | '...') |
| 20424 | if (p->error_indicator) { |
| 20425 | D(p->level--); |
| 20426 | return NULL; |
| 20427 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20428 | D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20429 | void *_tmp_163_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20430 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20431 | (_tmp_163_var = _tmp_163_rule(p)) // '.' | '...' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20432 | ) |
| 20433 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20434 | _res = _tmp_163_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20435 | if (_n == _children_capacity) { |
| 20436 | _children_capacity *= 2; |
| 20437 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20438 | if (!_new_children) { |
| 20439 | p->error_indicator = 1; |
| 20440 | PyErr_NoMemory(); |
| 20441 | D(p->level--); |
| 20442 | return NULL; |
| 20443 | } |
| 20444 | _children = _new_children; |
| 20445 | } |
| 20446 | _children[_n++] = _res; |
| 20447 | _mark = p->mark; |
| 20448 | } |
| 20449 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20450 | D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ', |
| 20451 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
| 20452 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20453 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20454 | if (!_seq) { |
| 20455 | PyMem_Free(_children); |
| 20456 | p->error_indicator = 1; |
| 20457 | PyErr_NoMemory(); |
| 20458 | D(p->level--); |
| 20459 | return NULL; |
| 20460 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20461 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20462 | PyMem_Free(_children); |
| 20463 | _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq); |
| 20464 | D(p->level--); |
| 20465 | return _seq; |
| 20466 | } |
| 20467 | |
| 20468 | // _loop1_32: ('.' | '...') |
| 20469 | static asdl_seq * |
| 20470 | _loop1_32_rule(Parser *p) |
| 20471 | { |
| 20472 | D(p->level++); |
| 20473 | if (p->error_indicator) { |
| 20474 | D(p->level--); |
| 20475 | return NULL; |
| 20476 | } |
| 20477 | void *_res = NULL; |
| 20478 | int _mark = p->mark; |
| 20479 | int _start_mark = p->mark; |
| 20480 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20481 | if (!_children) { |
| 20482 | p->error_indicator = 1; |
| 20483 | PyErr_NoMemory(); |
| 20484 | D(p->level--); |
| 20485 | return NULL; |
| 20486 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20487 | Py_ssize_t _children_capacity = 1; |
| 20488 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20489 | { // ('.' | '...') |
| 20490 | if (p->error_indicator) { |
| 20491 | D(p->level--); |
| 20492 | return NULL; |
| 20493 | } |
| 20494 | D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20495 | void *_tmp_164_var; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20496 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20497 | (_tmp_164_var = _tmp_164_rule(p)) // '.' | '...' |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20498 | ) |
| 20499 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20500 | _res = _tmp_164_var; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20501 | if (_n == _children_capacity) { |
| 20502 | _children_capacity *= 2; |
| 20503 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20504 | if (!_new_children) { |
| 20505 | p->error_indicator = 1; |
| 20506 | PyErr_NoMemory(); |
| 20507 | D(p->level--); |
| 20508 | return NULL; |
| 20509 | } |
| 20510 | _children = _new_children; |
| 20511 | } |
| 20512 | _children[_n++] = _res; |
| 20513 | _mark = p->mark; |
| 20514 | } |
| 20515 | p->mark = _mark; |
| 20516 | D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20517 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
| 20518 | } |
| 20519 | if (_n == 0 || p->error_indicator) { |
| 20520 | PyMem_Free(_children); |
| 20521 | D(p->level--); |
| 20522 | return NULL; |
| 20523 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20524 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20525 | if (!_seq) { |
| 20526 | PyMem_Free(_children); |
| 20527 | p->error_indicator = 1; |
| 20528 | PyErr_NoMemory(); |
| 20529 | D(p->level--); |
| 20530 | return NULL; |
| 20531 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20532 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20533 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20534 | _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20535 | D(p->level--); |
| 20536 | return _seq; |
| 20537 | } |
| 20538 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20539 | // _loop0_34: ',' import_from_as_name |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20540 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20541 | _loop0_34_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20542 | { |
| 20543 | D(p->level++); |
| 20544 | if (p->error_indicator) { |
| 20545 | D(p->level--); |
| 20546 | return NULL; |
| 20547 | } |
| 20548 | void *_res = NULL; |
| 20549 | int _mark = p->mark; |
| 20550 | int _start_mark = p->mark; |
| 20551 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20552 | if (!_children) { |
| 20553 | p->error_indicator = 1; |
| 20554 | PyErr_NoMemory(); |
| 20555 | D(p->level--); |
| 20556 | return NULL; |
| 20557 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20558 | Py_ssize_t _children_capacity = 1; |
| 20559 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20560 | { // ',' import_from_as_name |
| 20561 | if (p->error_indicator) { |
| 20562 | D(p->level--); |
| 20563 | return NULL; |
| 20564 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20565 | D(fprintf(stderr, "%*c> _loop0_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20566 | Token * _literal; |
| 20567 | alias_ty elem; |
| 20568 | while ( |
| 20569 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20570 | && |
| 20571 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
| 20572 | ) |
| 20573 | { |
| 20574 | _res = elem; |
| 20575 | if (_res == NULL && PyErr_Occurred()) { |
| 20576 | p->error_indicator = 1; |
| 20577 | PyMem_Free(_children); |
| 20578 | D(p->level--); |
| 20579 | return NULL; |
| 20580 | } |
| 20581 | if (_n == _children_capacity) { |
| 20582 | _children_capacity *= 2; |
| 20583 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20584 | if (!_new_children) { |
| 20585 | p->error_indicator = 1; |
| 20586 | PyErr_NoMemory(); |
| 20587 | D(p->level--); |
| 20588 | return NULL; |
| 20589 | } |
| 20590 | _children = _new_children; |
| 20591 | } |
| 20592 | _children[_n++] = _res; |
| 20593 | _mark = p->mark; |
| 20594 | } |
| 20595 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20596 | D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20597 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); |
| 20598 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20599 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20600 | if (!_seq) { |
| 20601 | PyMem_Free(_children); |
| 20602 | p->error_indicator = 1; |
| 20603 | PyErr_NoMemory(); |
| 20604 | D(p->level--); |
| 20605 | return NULL; |
| 20606 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20607 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20608 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20609 | _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20610 | D(p->level--); |
| 20611 | return _seq; |
| 20612 | } |
| 20613 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20614 | // _gather_33: import_from_as_name _loop0_34 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20615 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20616 | _gather_33_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20617 | { |
| 20618 | D(p->level++); |
| 20619 | if (p->error_indicator) { |
| 20620 | D(p->level--); |
| 20621 | return NULL; |
| 20622 | } |
| 20623 | asdl_seq * _res = NULL; |
| 20624 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20625 | { // import_from_as_name _loop0_34 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20626 | if (p->error_indicator) { |
| 20627 | D(p->level--); |
| 20628 | return NULL; |
| 20629 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20630 | D(fprintf(stderr, "%*c> _gather_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20631 | alias_ty elem; |
| 20632 | asdl_seq * seq; |
| 20633 | if ( |
| 20634 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
| 20635 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20636 | (seq = _loop0_34_rule(p)) // _loop0_34 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20637 | ) |
| 20638 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20639 | D(fprintf(stderr, "%*c+ _gather_33[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20640 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20641 | goto done; |
| 20642 | } |
| 20643 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20644 | D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ', |
| 20645 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20646 | } |
| 20647 | _res = NULL; |
| 20648 | done: |
| 20649 | D(p->level--); |
| 20650 | return _res; |
| 20651 | } |
| 20652 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20653 | // _tmp_35: 'as' NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20654 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20655 | _tmp_35_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20656 | { |
| 20657 | D(p->level++); |
| 20658 | if (p->error_indicator) { |
| 20659 | D(p->level--); |
| 20660 | return NULL; |
| 20661 | } |
| 20662 | void * _res = NULL; |
| 20663 | int _mark = p->mark; |
| 20664 | { // 'as' NAME |
| 20665 | if (p->error_indicator) { |
| 20666 | D(p->level--); |
| 20667 | return NULL; |
| 20668 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20669 | D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20670 | Token * _keyword; |
| 20671 | expr_ty z; |
| 20672 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20673 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20674 | && |
| 20675 | (z = _PyPegen_name_token(p)) // NAME |
| 20676 | ) |
| 20677 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20678 | D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20679 | _res = z; |
| 20680 | if (_res == NULL && PyErr_Occurred()) { |
| 20681 | p->error_indicator = 1; |
| 20682 | D(p->level--); |
| 20683 | return NULL; |
| 20684 | } |
| 20685 | goto done; |
| 20686 | } |
| 20687 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20688 | D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20689 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 20690 | } |
| 20691 | _res = NULL; |
| 20692 | done: |
| 20693 | D(p->level--); |
| 20694 | return _res; |
| 20695 | } |
| 20696 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20697 | // _loop0_37: ',' dotted_as_name |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20698 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20699 | _loop0_37_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20700 | { |
| 20701 | D(p->level++); |
| 20702 | if (p->error_indicator) { |
| 20703 | D(p->level--); |
| 20704 | return NULL; |
| 20705 | } |
| 20706 | void *_res = NULL; |
| 20707 | int _mark = p->mark; |
| 20708 | int _start_mark = p->mark; |
| 20709 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20710 | if (!_children) { |
| 20711 | p->error_indicator = 1; |
| 20712 | PyErr_NoMemory(); |
| 20713 | D(p->level--); |
| 20714 | return NULL; |
| 20715 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20716 | Py_ssize_t _children_capacity = 1; |
| 20717 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20718 | { // ',' dotted_as_name |
| 20719 | if (p->error_indicator) { |
| 20720 | D(p->level--); |
| 20721 | return NULL; |
| 20722 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20723 | D(fprintf(stderr, "%*c> _loop0_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20724 | Token * _literal; |
| 20725 | alias_ty elem; |
| 20726 | while ( |
| 20727 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20728 | && |
| 20729 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
| 20730 | ) |
| 20731 | { |
| 20732 | _res = elem; |
| 20733 | if (_res == NULL && PyErr_Occurred()) { |
| 20734 | p->error_indicator = 1; |
| 20735 | PyMem_Free(_children); |
| 20736 | D(p->level--); |
| 20737 | return NULL; |
| 20738 | } |
| 20739 | if (_n == _children_capacity) { |
| 20740 | _children_capacity *= 2; |
| 20741 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20742 | if (!_new_children) { |
| 20743 | p->error_indicator = 1; |
| 20744 | PyErr_NoMemory(); |
| 20745 | D(p->level--); |
| 20746 | return NULL; |
| 20747 | } |
| 20748 | _children = _new_children; |
| 20749 | } |
| 20750 | _children[_n++] = _res; |
| 20751 | _mark = p->mark; |
| 20752 | } |
| 20753 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20754 | D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20755 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); |
| 20756 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20757 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20758 | if (!_seq) { |
| 20759 | PyMem_Free(_children); |
| 20760 | p->error_indicator = 1; |
| 20761 | PyErr_NoMemory(); |
| 20762 | D(p->level--); |
| 20763 | return NULL; |
| 20764 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20765 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20766 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20767 | _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20768 | D(p->level--); |
| 20769 | return _seq; |
| 20770 | } |
| 20771 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20772 | // _gather_36: dotted_as_name _loop0_37 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20773 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20774 | _gather_36_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20775 | { |
| 20776 | D(p->level++); |
| 20777 | if (p->error_indicator) { |
| 20778 | D(p->level--); |
| 20779 | return NULL; |
| 20780 | } |
| 20781 | asdl_seq * _res = NULL; |
| 20782 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20783 | { // dotted_as_name _loop0_37 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20784 | if (p->error_indicator) { |
| 20785 | D(p->level--); |
| 20786 | return NULL; |
| 20787 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20788 | D(fprintf(stderr, "%*c> _gather_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20789 | alias_ty elem; |
| 20790 | asdl_seq * seq; |
| 20791 | if ( |
| 20792 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
| 20793 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20794 | (seq = _loop0_37_rule(p)) // _loop0_37 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20795 | ) |
| 20796 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20797 | D(fprintf(stderr, "%*c+ _gather_36[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20798 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20799 | goto done; |
| 20800 | } |
| 20801 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20802 | D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ', |
| 20803 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20804 | } |
| 20805 | _res = NULL; |
| 20806 | done: |
| 20807 | D(p->level--); |
| 20808 | return _res; |
| 20809 | } |
| 20810 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20811 | // _tmp_38: 'as' NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20812 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20813 | _tmp_38_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20814 | { |
| 20815 | D(p->level++); |
| 20816 | if (p->error_indicator) { |
| 20817 | D(p->level--); |
| 20818 | return NULL; |
| 20819 | } |
| 20820 | void * _res = NULL; |
| 20821 | int _mark = p->mark; |
| 20822 | { // 'as' NAME |
| 20823 | if (p->error_indicator) { |
| 20824 | D(p->level--); |
| 20825 | return NULL; |
| 20826 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20827 | D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20828 | Token * _keyword; |
| 20829 | expr_ty z; |
| 20830 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20831 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20832 | && |
| 20833 | (z = _PyPegen_name_token(p)) // NAME |
| 20834 | ) |
| 20835 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20836 | D(fprintf(stderr, "%*c+ _tmp_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20837 | _res = z; |
| 20838 | if (_res == NULL && PyErr_Occurred()) { |
| 20839 | p->error_indicator = 1; |
| 20840 | D(p->level--); |
| 20841 | return NULL; |
| 20842 | } |
| 20843 | goto done; |
| 20844 | } |
| 20845 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20846 | D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20847 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 20848 | } |
| 20849 | _res = NULL; |
| 20850 | done: |
| 20851 | D(p->level--); |
| 20852 | return _res; |
| 20853 | } |
| 20854 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20855 | // _loop0_40: ',' with_item |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20856 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20857 | _loop0_40_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20858 | { |
| 20859 | D(p->level++); |
| 20860 | if (p->error_indicator) { |
| 20861 | D(p->level--); |
| 20862 | return NULL; |
| 20863 | } |
| 20864 | void *_res = NULL; |
| 20865 | int _mark = p->mark; |
| 20866 | int _start_mark = p->mark; |
| 20867 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20868 | if (!_children) { |
| 20869 | p->error_indicator = 1; |
| 20870 | PyErr_NoMemory(); |
| 20871 | D(p->level--); |
| 20872 | return NULL; |
| 20873 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20874 | Py_ssize_t _children_capacity = 1; |
| 20875 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20876 | { // ',' with_item |
| 20877 | if (p->error_indicator) { |
| 20878 | D(p->level--); |
| 20879 | return NULL; |
| 20880 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20881 | D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20882 | Token * _literal; |
| 20883 | withitem_ty elem; |
| 20884 | while ( |
| 20885 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20886 | && |
| 20887 | (elem = with_item_rule(p)) // with_item |
| 20888 | ) |
| 20889 | { |
| 20890 | _res = elem; |
| 20891 | if (_res == NULL && PyErr_Occurred()) { |
| 20892 | p->error_indicator = 1; |
| 20893 | PyMem_Free(_children); |
| 20894 | D(p->level--); |
| 20895 | return NULL; |
| 20896 | } |
| 20897 | if (_n == _children_capacity) { |
| 20898 | _children_capacity *= 2; |
| 20899 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20900 | if (!_new_children) { |
| 20901 | p->error_indicator = 1; |
| 20902 | PyErr_NoMemory(); |
| 20903 | D(p->level--); |
| 20904 | return NULL; |
| 20905 | } |
| 20906 | _children = _new_children; |
| 20907 | } |
| 20908 | _children[_n++] = _res; |
| 20909 | _mark = p->mark; |
| 20910 | } |
| 20911 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20912 | D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20913 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
| 20914 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20915 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20916 | if (!_seq) { |
| 20917 | PyMem_Free(_children); |
| 20918 | p->error_indicator = 1; |
| 20919 | PyErr_NoMemory(); |
| 20920 | D(p->level--); |
| 20921 | return NULL; |
| 20922 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20923 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20924 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20925 | _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20926 | D(p->level--); |
| 20927 | return _seq; |
| 20928 | } |
| 20929 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20930 | // _gather_39: with_item _loop0_40 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20931 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20932 | _gather_39_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20933 | { |
| 20934 | D(p->level++); |
| 20935 | if (p->error_indicator) { |
| 20936 | D(p->level--); |
| 20937 | return NULL; |
| 20938 | } |
| 20939 | asdl_seq * _res = NULL; |
| 20940 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20941 | { // with_item _loop0_40 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20942 | if (p->error_indicator) { |
| 20943 | D(p->level--); |
| 20944 | return NULL; |
| 20945 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20946 | D(fprintf(stderr, "%*c> _gather_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20947 | withitem_ty elem; |
| 20948 | asdl_seq * seq; |
| 20949 | if ( |
| 20950 | (elem = with_item_rule(p)) // with_item |
| 20951 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20952 | (seq = _loop0_40_rule(p)) // _loop0_40 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20953 | ) |
| 20954 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20955 | D(fprintf(stderr, "%*c+ _gather_39[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20956 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20957 | goto done; |
| 20958 | } |
| 20959 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20960 | D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ', |
| 20961 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20962 | } |
| 20963 | _res = NULL; |
| 20964 | done: |
| 20965 | D(p->level--); |
| 20966 | return _res; |
| 20967 | } |
| 20968 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20969 | // _loop0_42: ',' with_item |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20970 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20971 | _loop0_42_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20972 | { |
| 20973 | D(p->level++); |
| 20974 | if (p->error_indicator) { |
| 20975 | D(p->level--); |
| 20976 | return NULL; |
| 20977 | } |
| 20978 | void *_res = NULL; |
| 20979 | int _mark = p->mark; |
| 20980 | int _start_mark = p->mark; |
| 20981 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20982 | if (!_children) { |
| 20983 | p->error_indicator = 1; |
| 20984 | PyErr_NoMemory(); |
| 20985 | D(p->level--); |
| 20986 | return NULL; |
| 20987 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20988 | Py_ssize_t _children_capacity = 1; |
| 20989 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20990 | { // ',' with_item |
| 20991 | if (p->error_indicator) { |
| 20992 | D(p->level--); |
| 20993 | return NULL; |
| 20994 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20995 | D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20996 | Token * _literal; |
| 20997 | withitem_ty elem; |
| 20998 | while ( |
| 20999 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 21000 | && |
| 21001 | (elem = with_item_rule(p)) // with_item |
| 21002 | ) |
| 21003 | { |
| 21004 | _res = elem; |
| 21005 | if (_res == NULL && PyErr_Occurred()) { |
| 21006 | p->error_indicator = 1; |
| 21007 | PyMem_Free(_children); |
| 21008 | D(p->level--); |
| 21009 | return NULL; |
| 21010 | } |
| 21011 | if (_n == _children_capacity) { |
| 21012 | _children_capacity *= 2; |
| 21013 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21014 | if (!_new_children) { |
| 21015 | p->error_indicator = 1; |
| 21016 | PyErr_NoMemory(); |
| 21017 | D(p->level--); |
| 21018 | return NULL; |
| 21019 | } |
| 21020 | _children = _new_children; |
| 21021 | } |
| 21022 | _children[_n++] = _res; |
| 21023 | _mark = p->mark; |
| 21024 | } |
| 21025 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21026 | D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21027 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
| 21028 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21029 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21030 | if (!_seq) { |
| 21031 | PyMem_Free(_children); |
| 21032 | p->error_indicator = 1; |
| 21033 | PyErr_NoMemory(); |
| 21034 | D(p->level--); |
| 21035 | return NULL; |
| 21036 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21037 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21038 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21039 | _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21040 | D(p->level--); |
| 21041 | return _seq; |
| 21042 | } |
| 21043 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21044 | // _gather_41: with_item _loop0_42 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21045 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21046 | _gather_41_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21047 | { |
| 21048 | D(p->level++); |
| 21049 | if (p->error_indicator) { |
| 21050 | D(p->level--); |
| 21051 | return NULL; |
| 21052 | } |
| 21053 | asdl_seq * _res = NULL; |
| 21054 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21055 | { // with_item _loop0_42 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21056 | if (p->error_indicator) { |
| 21057 | D(p->level--); |
| 21058 | return NULL; |
| 21059 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21060 | D(fprintf(stderr, "%*c> _gather_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21061 | withitem_ty elem; |
| 21062 | asdl_seq * seq; |
| 21063 | if ( |
| 21064 | (elem = with_item_rule(p)) // with_item |
| 21065 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21066 | (seq = _loop0_42_rule(p)) // _loop0_42 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21067 | ) |
| 21068 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21069 | D(fprintf(stderr, "%*c+ _gather_41[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21070 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21071 | goto done; |
| 21072 | } |
| 21073 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21074 | D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ', |
| 21075 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21076 | } |
| 21077 | _res = NULL; |
| 21078 | done: |
| 21079 | D(p->level--); |
| 21080 | return _res; |
| 21081 | } |
| 21082 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21083 | // _loop0_44: ',' with_item |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21084 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21085 | _loop0_44_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21086 | { |
| 21087 | D(p->level++); |
| 21088 | if (p->error_indicator) { |
| 21089 | D(p->level--); |
| 21090 | return NULL; |
| 21091 | } |
| 21092 | void *_res = NULL; |
| 21093 | int _mark = p->mark; |
| 21094 | int _start_mark = p->mark; |
| 21095 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21096 | if (!_children) { |
| 21097 | p->error_indicator = 1; |
| 21098 | PyErr_NoMemory(); |
| 21099 | D(p->level--); |
| 21100 | return NULL; |
| 21101 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21102 | Py_ssize_t _children_capacity = 1; |
| 21103 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21104 | { // ',' with_item |
| 21105 | if (p->error_indicator) { |
| 21106 | D(p->level--); |
| 21107 | return NULL; |
| 21108 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21109 | D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21110 | Token * _literal; |
| 21111 | withitem_ty elem; |
| 21112 | while ( |
| 21113 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 21114 | && |
| 21115 | (elem = with_item_rule(p)) // with_item |
| 21116 | ) |
| 21117 | { |
| 21118 | _res = elem; |
| 21119 | if (_res == NULL && PyErr_Occurred()) { |
| 21120 | p->error_indicator = 1; |
| 21121 | PyMem_Free(_children); |
| 21122 | D(p->level--); |
| 21123 | return NULL; |
| 21124 | } |
| 21125 | if (_n == _children_capacity) { |
| 21126 | _children_capacity *= 2; |
| 21127 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21128 | if (!_new_children) { |
| 21129 | p->error_indicator = 1; |
| 21130 | PyErr_NoMemory(); |
| 21131 | D(p->level--); |
| 21132 | return NULL; |
| 21133 | } |
| 21134 | _children = _new_children; |
| 21135 | } |
| 21136 | _children[_n++] = _res; |
| 21137 | _mark = p->mark; |
| 21138 | } |
| 21139 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21140 | D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21141 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
| 21142 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21143 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21144 | if (!_seq) { |
| 21145 | PyMem_Free(_children); |
| 21146 | p->error_indicator = 1; |
| 21147 | PyErr_NoMemory(); |
| 21148 | D(p->level--); |
| 21149 | return NULL; |
| 21150 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21151 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21152 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21153 | _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21154 | D(p->level--); |
| 21155 | return _seq; |
| 21156 | } |
| 21157 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21158 | // _gather_43: with_item _loop0_44 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21159 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21160 | _gather_43_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21161 | { |
| 21162 | D(p->level++); |
| 21163 | if (p->error_indicator) { |
| 21164 | D(p->level--); |
| 21165 | return NULL; |
| 21166 | } |
| 21167 | asdl_seq * _res = NULL; |
| 21168 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21169 | { // with_item _loop0_44 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21170 | if (p->error_indicator) { |
| 21171 | D(p->level--); |
| 21172 | return NULL; |
| 21173 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21174 | D(fprintf(stderr, "%*c> _gather_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21175 | withitem_ty elem; |
| 21176 | asdl_seq * seq; |
| 21177 | if ( |
| 21178 | (elem = with_item_rule(p)) // with_item |
| 21179 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21180 | (seq = _loop0_44_rule(p)) // _loop0_44 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21181 | ) |
| 21182 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21183 | D(fprintf(stderr, "%*c+ _gather_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21184 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21185 | goto done; |
| 21186 | } |
| 21187 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21188 | D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ', |
| 21189 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21190 | } |
| 21191 | _res = NULL; |
| 21192 | done: |
| 21193 | D(p->level--); |
| 21194 | return _res; |
| 21195 | } |
| 21196 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21197 | // _loop0_46: ',' with_item |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21198 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21199 | _loop0_46_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21200 | { |
| 21201 | D(p->level++); |
| 21202 | if (p->error_indicator) { |
| 21203 | D(p->level--); |
| 21204 | return NULL; |
| 21205 | } |
| 21206 | void *_res = NULL; |
| 21207 | int _mark = p->mark; |
| 21208 | int _start_mark = p->mark; |
| 21209 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21210 | if (!_children) { |
| 21211 | p->error_indicator = 1; |
| 21212 | PyErr_NoMemory(); |
| 21213 | D(p->level--); |
| 21214 | return NULL; |
| 21215 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21216 | Py_ssize_t _children_capacity = 1; |
| 21217 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21218 | { // ',' with_item |
| 21219 | if (p->error_indicator) { |
| 21220 | D(p->level--); |
| 21221 | return NULL; |
| 21222 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21223 | D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21224 | Token * _literal; |
| 21225 | withitem_ty elem; |
| 21226 | while ( |
| 21227 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 21228 | && |
| 21229 | (elem = with_item_rule(p)) // with_item |
| 21230 | ) |
| 21231 | { |
| 21232 | _res = elem; |
| 21233 | if (_res == NULL && PyErr_Occurred()) { |
| 21234 | p->error_indicator = 1; |
| 21235 | PyMem_Free(_children); |
| 21236 | D(p->level--); |
| 21237 | return NULL; |
| 21238 | } |
| 21239 | if (_n == _children_capacity) { |
| 21240 | _children_capacity *= 2; |
| 21241 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21242 | if (!_new_children) { |
| 21243 | p->error_indicator = 1; |
| 21244 | PyErr_NoMemory(); |
| 21245 | D(p->level--); |
| 21246 | return NULL; |
| 21247 | } |
| 21248 | _children = _new_children; |
| 21249 | } |
| 21250 | _children[_n++] = _res; |
| 21251 | _mark = p->mark; |
| 21252 | } |
| 21253 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21254 | D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21255 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
| 21256 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21257 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21258 | if (!_seq) { |
| 21259 | PyMem_Free(_children); |
| 21260 | p->error_indicator = 1; |
| 21261 | PyErr_NoMemory(); |
| 21262 | D(p->level--); |
| 21263 | return NULL; |
| 21264 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21265 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21266 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21267 | _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21268 | D(p->level--); |
| 21269 | return _seq; |
| 21270 | } |
| 21271 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21272 | // _gather_45: with_item _loop0_46 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21273 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21274 | _gather_45_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21275 | { |
| 21276 | D(p->level++); |
| 21277 | if (p->error_indicator) { |
| 21278 | D(p->level--); |
| 21279 | return NULL; |
| 21280 | } |
| 21281 | asdl_seq * _res = NULL; |
| 21282 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21283 | { // with_item _loop0_46 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21284 | if (p->error_indicator) { |
| 21285 | D(p->level--); |
| 21286 | return NULL; |
| 21287 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21288 | D(fprintf(stderr, "%*c> _gather_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21289 | withitem_ty elem; |
| 21290 | asdl_seq * seq; |
| 21291 | if ( |
| 21292 | (elem = with_item_rule(p)) // with_item |
| 21293 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21294 | (seq = _loop0_46_rule(p)) // _loop0_46 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21295 | ) |
| 21296 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21297 | D(fprintf(stderr, "%*c+ _gather_45[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21298 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21299 | goto done; |
| 21300 | } |
| 21301 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21302 | D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ', |
| 21303 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21304 | } |
| 21305 | _res = NULL; |
| 21306 | done: |
| 21307 | D(p->level--); |
| 21308 | return _res; |
| 21309 | } |
| 21310 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21311 | // _tmp_47: ',' | ')' | ':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21312 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21313 | _tmp_47_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21314 | { |
| 21315 | D(p->level++); |
| 21316 | if (p->error_indicator) { |
| 21317 | D(p->level--); |
| 21318 | return NULL; |
| 21319 | } |
| 21320 | void * _res = NULL; |
| 21321 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21322 | { // ',' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21323 | if (p->error_indicator) { |
| 21324 | D(p->level--); |
| 21325 | return NULL; |
| 21326 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21327 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
| 21328 | Token * _literal; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21329 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21330 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21331 | ) |
| 21332 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21333 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
| 21334 | _res = _literal; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21335 | goto done; |
| 21336 | } |
| 21337 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21338 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ', |
| 21339 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
| 21340 | } |
| 21341 | { // ')' |
| 21342 | if (p->error_indicator) { |
| 21343 | D(p->level--); |
| 21344 | return NULL; |
| 21345 | } |
| 21346 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
| 21347 | Token * _literal; |
| 21348 | if ( |
| 21349 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 21350 | ) |
| 21351 | { |
| 21352 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
| 21353 | _res = _literal; |
| 21354 | goto done; |
| 21355 | } |
| 21356 | p->mark = _mark; |
| 21357 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ', |
| 21358 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
| 21359 | } |
| 21360 | { // ':' |
| 21361 | if (p->error_indicator) { |
| 21362 | D(p->level--); |
| 21363 | return NULL; |
| 21364 | } |
| 21365 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
| 21366 | Token * _literal; |
| 21367 | if ( |
| 21368 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 21369 | ) |
| 21370 | { |
| 21371 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
| 21372 | _res = _literal; |
| 21373 | goto done; |
| 21374 | } |
| 21375 | p->mark = _mark; |
| 21376 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ', |
| 21377 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21378 | } |
| 21379 | _res = NULL; |
| 21380 | done: |
| 21381 | D(p->level--); |
| 21382 | return _res; |
| 21383 | } |
| 21384 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21385 | // _loop1_48: except_block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21386 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21387 | _loop1_48_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21388 | { |
| 21389 | D(p->level++); |
| 21390 | if (p->error_indicator) { |
| 21391 | D(p->level--); |
| 21392 | return NULL; |
| 21393 | } |
| 21394 | void *_res = NULL; |
| 21395 | int _mark = p->mark; |
| 21396 | int _start_mark = p->mark; |
| 21397 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21398 | if (!_children) { |
| 21399 | p->error_indicator = 1; |
| 21400 | PyErr_NoMemory(); |
| 21401 | D(p->level--); |
| 21402 | return NULL; |
| 21403 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21404 | Py_ssize_t _children_capacity = 1; |
| 21405 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21406 | { // except_block |
| 21407 | if (p->error_indicator) { |
| 21408 | D(p->level--); |
| 21409 | return NULL; |
| 21410 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21411 | D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21412 | excepthandler_ty except_block_var; |
| 21413 | while ( |
| 21414 | (except_block_var = except_block_rule(p)) // except_block |
| 21415 | ) |
| 21416 | { |
| 21417 | _res = except_block_var; |
| 21418 | if (_n == _children_capacity) { |
| 21419 | _children_capacity *= 2; |
| 21420 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21421 | if (!_new_children) { |
| 21422 | p->error_indicator = 1; |
| 21423 | PyErr_NoMemory(); |
| 21424 | D(p->level--); |
| 21425 | return NULL; |
| 21426 | } |
| 21427 | _children = _new_children; |
| 21428 | } |
| 21429 | _children[_n++] = _res; |
| 21430 | _mark = p->mark; |
| 21431 | } |
| 21432 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21433 | D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21434 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); |
| 21435 | } |
| 21436 | if (_n == 0 || p->error_indicator) { |
| 21437 | PyMem_Free(_children); |
| 21438 | D(p->level--); |
| 21439 | return NULL; |
| 21440 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21441 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21442 | if (!_seq) { |
| 21443 | PyMem_Free(_children); |
| 21444 | p->error_indicator = 1; |
| 21445 | PyErr_NoMemory(); |
| 21446 | D(p->level--); |
| 21447 | return NULL; |
| 21448 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21449 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21450 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21451 | _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21452 | D(p->level--); |
| 21453 | return _seq; |
| 21454 | } |
| 21455 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21456 | // _tmp_49: 'as' NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21457 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21458 | _tmp_49_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21459 | { |
| 21460 | D(p->level++); |
| 21461 | if (p->error_indicator) { |
| 21462 | D(p->level--); |
| 21463 | return NULL; |
| 21464 | } |
| 21465 | void * _res = NULL; |
| 21466 | int _mark = p->mark; |
| 21467 | { // 'as' NAME |
| 21468 | if (p->error_indicator) { |
| 21469 | D(p->level--); |
| 21470 | return NULL; |
| 21471 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21472 | D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21473 | Token * _keyword; |
| 21474 | expr_ty z; |
| 21475 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21476 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21477 | && |
| 21478 | (z = _PyPegen_name_token(p)) // NAME |
| 21479 | ) |
| 21480 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21481 | D(fprintf(stderr, "%*c+ _tmp_49[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21482 | _res = z; |
| 21483 | if (_res == NULL && PyErr_Occurred()) { |
| 21484 | p->error_indicator = 1; |
| 21485 | D(p->level--); |
| 21486 | return NULL; |
| 21487 | } |
| 21488 | goto done; |
| 21489 | } |
| 21490 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21491 | D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21492 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 21493 | } |
| 21494 | _res = NULL; |
| 21495 | done: |
| 21496 | D(p->level--); |
| 21497 | return _res; |
| 21498 | } |
| 21499 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21500 | // _loop1_50: case_block |
| 21501 | static asdl_seq * |
| 21502 | _loop1_50_rule(Parser *p) |
| 21503 | { |
| 21504 | D(p->level++); |
| 21505 | if (p->error_indicator) { |
| 21506 | D(p->level--); |
| 21507 | return NULL; |
| 21508 | } |
| 21509 | void *_res = NULL; |
| 21510 | int _mark = p->mark; |
| 21511 | int _start_mark = p->mark; |
| 21512 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21513 | if (!_children) { |
| 21514 | p->error_indicator = 1; |
| 21515 | PyErr_NoMemory(); |
| 21516 | D(p->level--); |
| 21517 | return NULL; |
| 21518 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21519 | Py_ssize_t _children_capacity = 1; |
| 21520 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21521 | { // case_block |
| 21522 | if (p->error_indicator) { |
| 21523 | D(p->level--); |
| 21524 | return NULL; |
| 21525 | } |
| 21526 | D(fprintf(stderr, "%*c> _loop1_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block")); |
| 21527 | match_case_ty case_block_var; |
| 21528 | while ( |
| 21529 | (case_block_var = case_block_rule(p)) // case_block |
| 21530 | ) |
| 21531 | { |
| 21532 | _res = case_block_var; |
| 21533 | if (_n == _children_capacity) { |
| 21534 | _children_capacity *= 2; |
| 21535 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21536 | if (!_new_children) { |
| 21537 | p->error_indicator = 1; |
| 21538 | PyErr_NoMemory(); |
| 21539 | D(p->level--); |
| 21540 | return NULL; |
| 21541 | } |
| 21542 | _children = _new_children; |
| 21543 | } |
| 21544 | _children[_n++] = _res; |
| 21545 | _mark = p->mark; |
| 21546 | } |
| 21547 | p->mark = _mark; |
| 21548 | D(fprintf(stderr, "%*c%s _loop1_50[%d-%d]: %s failed!\n", p->level, ' ', |
| 21549 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block")); |
| 21550 | } |
| 21551 | if (_n == 0 || p->error_indicator) { |
| 21552 | PyMem_Free(_children); |
| 21553 | D(p->level--); |
| 21554 | return NULL; |
| 21555 | } |
| 21556 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 21557 | if (!_seq) { |
| 21558 | PyMem_Free(_children); |
| 21559 | p->error_indicator = 1; |
| 21560 | PyErr_NoMemory(); |
| 21561 | D(p->level--); |
| 21562 | return NULL; |
| 21563 | } |
| 21564 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 21565 | PyMem_Free(_children); |
| 21566 | _PyPegen_insert_memo(p, _start_mark, _loop1_50_type, _seq); |
| 21567 | D(p->level--); |
| 21568 | return _seq; |
| 21569 | } |
| 21570 | |
| 21571 | // _loop0_52: '|' closed_pattern |
| 21572 | static asdl_seq * |
| 21573 | _loop0_52_rule(Parser *p) |
| 21574 | { |
| 21575 | D(p->level++); |
| 21576 | if (p->error_indicator) { |
| 21577 | D(p->level--); |
| 21578 | return NULL; |
| 21579 | } |
| 21580 | void *_res = NULL; |
| 21581 | int _mark = p->mark; |
| 21582 | int _start_mark = p->mark; |
| 21583 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21584 | if (!_children) { |
| 21585 | p->error_indicator = 1; |
| 21586 | PyErr_NoMemory(); |
| 21587 | D(p->level--); |
| 21588 | return NULL; |
| 21589 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21590 | Py_ssize_t _children_capacity = 1; |
| 21591 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21592 | { // '|' closed_pattern |
| 21593 | if (p->error_indicator) { |
| 21594 | D(p->level--); |
| 21595 | return NULL; |
| 21596 | } |
| 21597 | D(fprintf(stderr, "%*c> _loop0_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern")); |
| 21598 | Token * _literal; |
| 21599 | expr_ty elem; |
| 21600 | while ( |
| 21601 | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
| 21602 | && |
| 21603 | (elem = closed_pattern_rule(p)) // closed_pattern |
| 21604 | ) |
| 21605 | { |
| 21606 | _res = elem; |
| 21607 | if (_res == NULL && PyErr_Occurred()) { |
| 21608 | p->error_indicator = 1; |
| 21609 | PyMem_Free(_children); |
| 21610 | D(p->level--); |
| 21611 | return NULL; |
| 21612 | } |
| 21613 | if (_n == _children_capacity) { |
| 21614 | _children_capacity *= 2; |
| 21615 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21616 | if (!_new_children) { |
| 21617 | p->error_indicator = 1; |
| 21618 | PyErr_NoMemory(); |
| 21619 | D(p->level--); |
| 21620 | return NULL; |
| 21621 | } |
| 21622 | _children = _new_children; |
| 21623 | } |
| 21624 | _children[_n++] = _res; |
| 21625 | _mark = p->mark; |
| 21626 | } |
| 21627 | p->mark = _mark; |
| 21628 | D(fprintf(stderr, "%*c%s _loop0_52[%d-%d]: %s failed!\n", p->level, ' ', |
| 21629 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern")); |
| 21630 | } |
| 21631 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 21632 | if (!_seq) { |
| 21633 | PyMem_Free(_children); |
| 21634 | p->error_indicator = 1; |
| 21635 | PyErr_NoMemory(); |
| 21636 | D(p->level--); |
| 21637 | return NULL; |
| 21638 | } |
| 21639 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 21640 | PyMem_Free(_children); |
| 21641 | _PyPegen_insert_memo(p, _start_mark, _loop0_52_type, _seq); |
| 21642 | D(p->level--); |
| 21643 | return _seq; |
| 21644 | } |
| 21645 | |
| 21646 | // _gather_51: closed_pattern _loop0_52 |
| 21647 | static asdl_seq * |
| 21648 | _gather_51_rule(Parser *p) |
| 21649 | { |
| 21650 | D(p->level++); |
| 21651 | if (p->error_indicator) { |
| 21652 | D(p->level--); |
| 21653 | return NULL; |
| 21654 | } |
| 21655 | asdl_seq * _res = NULL; |
| 21656 | int _mark = p->mark; |
| 21657 | { // closed_pattern _loop0_52 |
| 21658 | if (p->error_indicator) { |
| 21659 | D(p->level--); |
| 21660 | return NULL; |
| 21661 | } |
| 21662 | D(fprintf(stderr, "%*c> _gather_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52")); |
| 21663 | expr_ty elem; |
| 21664 | asdl_seq * seq; |
| 21665 | if ( |
| 21666 | (elem = closed_pattern_rule(p)) // closed_pattern |
| 21667 | && |
| 21668 | (seq = _loop0_52_rule(p)) // _loop0_52 |
| 21669 | ) |
| 21670 | { |
| 21671 | D(fprintf(stderr, "%*c+ _gather_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52")); |
| 21672 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21673 | goto done; |
| 21674 | } |
| 21675 | p->mark = _mark; |
| 21676 | D(fprintf(stderr, "%*c%s _gather_51[%d-%d]: %s failed!\n", p->level, ' ', |
| 21677 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_52")); |
| 21678 | } |
| 21679 | _res = NULL; |
| 21680 | done: |
| 21681 | D(p->level--); |
| 21682 | return _res; |
| 21683 | } |
| 21684 | |
| 21685 | // _tmp_53: '+' | '-' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21686 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21687 | _tmp_53_rule(Parser *p) |
| 21688 | { |
| 21689 | D(p->level++); |
| 21690 | if (p->error_indicator) { |
| 21691 | D(p->level--); |
| 21692 | return NULL; |
| 21693 | } |
| 21694 | void * _res = NULL; |
| 21695 | int _mark = p->mark; |
| 21696 | { // '+' |
| 21697 | if (p->error_indicator) { |
| 21698 | D(p->level--); |
| 21699 | return NULL; |
| 21700 | } |
| 21701 | D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); |
| 21702 | Token * _literal; |
| 21703 | if ( |
| 21704 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
| 21705 | ) |
| 21706 | { |
| 21707 | D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); |
| 21708 | _res = _literal; |
| 21709 | goto done; |
| 21710 | } |
| 21711 | p->mark = _mark; |
| 21712 | D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', |
| 21713 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); |
| 21714 | } |
| 21715 | { // '-' |
| 21716 | if (p->error_indicator) { |
| 21717 | D(p->level--); |
| 21718 | return NULL; |
| 21719 | } |
| 21720 | D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); |
| 21721 | Token * _literal; |
| 21722 | if ( |
| 21723 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 21724 | ) |
| 21725 | { |
| 21726 | D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'")); |
| 21727 | _res = _literal; |
| 21728 | goto done; |
| 21729 | } |
| 21730 | p->mark = _mark; |
| 21731 | D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', |
| 21732 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); |
| 21733 | } |
| 21734 | _res = NULL; |
| 21735 | done: |
| 21736 | D(p->level--); |
| 21737 | return _res; |
| 21738 | } |
| 21739 | |
| 21740 | // _tmp_54: '.' | '(' | '=' |
| 21741 | static void * |
| 21742 | _tmp_54_rule(Parser *p) |
| 21743 | { |
| 21744 | D(p->level++); |
| 21745 | if (p->error_indicator) { |
| 21746 | D(p->level--); |
| 21747 | return NULL; |
| 21748 | } |
| 21749 | void * _res = NULL; |
| 21750 | int _mark = p->mark; |
| 21751 | { // '.' |
| 21752 | if (p->error_indicator) { |
| 21753 | D(p->level--); |
| 21754 | return NULL; |
| 21755 | } |
| 21756 | D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 21757 | Token * _literal; |
| 21758 | if ( |
| 21759 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 21760 | ) |
| 21761 | { |
| 21762 | D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 21763 | _res = _literal; |
| 21764 | goto done; |
| 21765 | } |
| 21766 | p->mark = _mark; |
| 21767 | D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', |
| 21768 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 21769 | } |
| 21770 | { // '(' |
| 21771 | if (p->error_indicator) { |
| 21772 | D(p->level--); |
| 21773 | return NULL; |
| 21774 | } |
| 21775 | D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
| 21776 | Token * _literal; |
| 21777 | if ( |
| 21778 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 21779 | ) |
| 21780 | { |
| 21781 | D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
| 21782 | _res = _literal; |
| 21783 | goto done; |
| 21784 | } |
| 21785 | p->mark = _mark; |
| 21786 | D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', |
| 21787 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
| 21788 | } |
| 21789 | { // '=' |
| 21790 | if (p->error_indicator) { |
| 21791 | D(p->level--); |
| 21792 | return NULL; |
| 21793 | } |
| 21794 | D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); |
| 21795 | Token * _literal; |
| 21796 | if ( |
| 21797 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 21798 | ) |
| 21799 | { |
| 21800 | D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); |
| 21801 | _res = _literal; |
| 21802 | goto done; |
| 21803 | } |
| 21804 | p->mark = _mark; |
| 21805 | D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', |
| 21806 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); |
| 21807 | } |
| 21808 | _res = NULL; |
| 21809 | done: |
| 21810 | D(p->level--); |
| 21811 | return _res; |
| 21812 | } |
| 21813 | |
| 21814 | // _tmp_55: '.' | '(' | '=' |
| 21815 | static void * |
| 21816 | _tmp_55_rule(Parser *p) |
| 21817 | { |
| 21818 | D(p->level++); |
| 21819 | if (p->error_indicator) { |
| 21820 | D(p->level--); |
| 21821 | return NULL; |
| 21822 | } |
| 21823 | void * _res = NULL; |
| 21824 | int _mark = p->mark; |
| 21825 | { // '.' |
| 21826 | if (p->error_indicator) { |
| 21827 | D(p->level--); |
| 21828 | return NULL; |
| 21829 | } |
| 21830 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 21831 | Token * _literal; |
| 21832 | if ( |
| 21833 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 21834 | ) |
| 21835 | { |
| 21836 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 21837 | _res = _literal; |
| 21838 | goto done; |
| 21839 | } |
| 21840 | p->mark = _mark; |
| 21841 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', |
| 21842 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 21843 | } |
| 21844 | { // '(' |
| 21845 | if (p->error_indicator) { |
| 21846 | D(p->level--); |
| 21847 | return NULL; |
| 21848 | } |
| 21849 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
| 21850 | Token * _literal; |
| 21851 | if ( |
| 21852 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 21853 | ) |
| 21854 | { |
| 21855 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
| 21856 | _res = _literal; |
| 21857 | goto done; |
| 21858 | } |
| 21859 | p->mark = _mark; |
| 21860 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', |
| 21861 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
| 21862 | } |
| 21863 | { // '=' |
| 21864 | if (p->error_indicator) { |
| 21865 | D(p->level--); |
| 21866 | return NULL; |
| 21867 | } |
| 21868 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); |
| 21869 | Token * _literal; |
| 21870 | if ( |
| 21871 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 21872 | ) |
| 21873 | { |
| 21874 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); |
| 21875 | _res = _literal; |
| 21876 | goto done; |
| 21877 | } |
| 21878 | p->mark = _mark; |
| 21879 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', |
| 21880 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); |
| 21881 | } |
| 21882 | _res = NULL; |
| 21883 | done: |
| 21884 | D(p->level--); |
| 21885 | return _res; |
| 21886 | } |
| 21887 | |
| 21888 | // _loop0_57: ',' maybe_star_pattern |
| 21889 | static asdl_seq * |
| 21890 | _loop0_57_rule(Parser *p) |
| 21891 | { |
| 21892 | D(p->level++); |
| 21893 | if (p->error_indicator) { |
| 21894 | D(p->level--); |
| 21895 | return NULL; |
| 21896 | } |
| 21897 | void *_res = NULL; |
| 21898 | int _mark = p->mark; |
| 21899 | int _start_mark = p->mark; |
| 21900 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21901 | if (!_children) { |
| 21902 | p->error_indicator = 1; |
| 21903 | PyErr_NoMemory(); |
| 21904 | D(p->level--); |
| 21905 | return NULL; |
| 21906 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21907 | Py_ssize_t _children_capacity = 1; |
| 21908 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21909 | { // ',' maybe_star_pattern |
| 21910 | if (p->error_indicator) { |
| 21911 | D(p->level--); |
| 21912 | return NULL; |
| 21913 | } |
| 21914 | D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern")); |
| 21915 | Token * _literal; |
| 21916 | expr_ty elem; |
| 21917 | while ( |
| 21918 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 21919 | && |
| 21920 | (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern |
| 21921 | ) |
| 21922 | { |
| 21923 | _res = elem; |
| 21924 | if (_res == NULL && PyErr_Occurred()) { |
| 21925 | p->error_indicator = 1; |
| 21926 | PyMem_Free(_children); |
| 21927 | D(p->level--); |
| 21928 | return NULL; |
| 21929 | } |
| 21930 | if (_n == _children_capacity) { |
| 21931 | _children_capacity *= 2; |
| 21932 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21933 | if (!_new_children) { |
| 21934 | p->error_indicator = 1; |
| 21935 | PyErr_NoMemory(); |
| 21936 | D(p->level--); |
| 21937 | return NULL; |
| 21938 | } |
| 21939 | _children = _new_children; |
| 21940 | } |
| 21941 | _children[_n++] = _res; |
| 21942 | _mark = p->mark; |
| 21943 | } |
| 21944 | p->mark = _mark; |
| 21945 | D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', |
| 21946 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern")); |
| 21947 | } |
| 21948 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 21949 | if (!_seq) { |
| 21950 | PyMem_Free(_children); |
| 21951 | p->error_indicator = 1; |
| 21952 | PyErr_NoMemory(); |
| 21953 | D(p->level--); |
| 21954 | return NULL; |
| 21955 | } |
| 21956 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 21957 | PyMem_Free(_children); |
| 21958 | _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); |
| 21959 | D(p->level--); |
| 21960 | return _seq; |
| 21961 | } |
| 21962 | |
| 21963 | // _gather_56: maybe_star_pattern _loop0_57 |
| 21964 | static asdl_seq * |
| 21965 | _gather_56_rule(Parser *p) |
| 21966 | { |
| 21967 | D(p->level++); |
| 21968 | if (p->error_indicator) { |
| 21969 | D(p->level--); |
| 21970 | return NULL; |
| 21971 | } |
| 21972 | asdl_seq * _res = NULL; |
| 21973 | int _mark = p->mark; |
| 21974 | { // maybe_star_pattern _loop0_57 |
| 21975 | if (p->error_indicator) { |
| 21976 | D(p->level--); |
| 21977 | return NULL; |
| 21978 | } |
| 21979 | D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_57")); |
| 21980 | expr_ty elem; |
| 21981 | asdl_seq * seq; |
| 21982 | if ( |
| 21983 | (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern |
| 21984 | && |
| 21985 | (seq = _loop0_57_rule(p)) // _loop0_57 |
| 21986 | ) |
| 21987 | { |
| 21988 | D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_57")); |
| 21989 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21990 | goto done; |
| 21991 | } |
| 21992 | p->mark = _mark; |
| 21993 | D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ', |
| 21994 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_57")); |
| 21995 | } |
| 21996 | _res = NULL; |
| 21997 | done: |
| 21998 | D(p->level--); |
| 21999 | return _res; |
| 22000 | } |
| 22001 | |
| 22002 | // _tmp_58: capture_pattern | wildcard_pattern |
| 22003 | static void * |
| 22004 | _tmp_58_rule(Parser *p) |
| 22005 | { |
| 22006 | D(p->level++); |
| 22007 | if (p->error_indicator) { |
| 22008 | D(p->level--); |
| 22009 | return NULL; |
| 22010 | } |
| 22011 | void * _res = NULL; |
| 22012 | int _mark = p->mark; |
| 22013 | { // capture_pattern |
| 22014 | if (p->error_indicator) { |
| 22015 | D(p->level--); |
| 22016 | return NULL; |
| 22017 | } |
| 22018 | D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
| 22019 | expr_ty capture_pattern_var; |
| 22020 | if ( |
| 22021 | (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern |
| 22022 | ) |
| 22023 | { |
| 22024 | D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
| 22025 | _res = capture_pattern_var; |
| 22026 | goto done; |
| 22027 | } |
| 22028 | p->mark = _mark; |
| 22029 | D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ', |
| 22030 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern")); |
| 22031 | } |
| 22032 | { // wildcard_pattern |
| 22033 | if (p->error_indicator) { |
| 22034 | D(p->level--); |
| 22035 | return NULL; |
| 22036 | } |
| 22037 | D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
| 22038 | expr_ty wildcard_pattern_var; |
| 22039 | if ( |
| 22040 | (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern |
| 22041 | ) |
| 22042 | { |
| 22043 | D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
| 22044 | _res = wildcard_pattern_var; |
| 22045 | goto done; |
| 22046 | } |
| 22047 | p->mark = _mark; |
| 22048 | D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ', |
| 22049 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern")); |
| 22050 | } |
| 22051 | _res = NULL; |
| 22052 | done: |
| 22053 | D(p->level--); |
| 22054 | return _res; |
| 22055 | } |
| 22056 | |
| 22057 | // _loop0_60: ',' key_value_pattern |
| 22058 | static asdl_seq * |
| 22059 | _loop0_60_rule(Parser *p) |
| 22060 | { |
| 22061 | D(p->level++); |
| 22062 | if (p->error_indicator) { |
| 22063 | D(p->level--); |
| 22064 | return NULL; |
| 22065 | } |
| 22066 | void *_res = NULL; |
| 22067 | int _mark = p->mark; |
| 22068 | int _start_mark = p->mark; |
| 22069 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22070 | if (!_children) { |
| 22071 | p->error_indicator = 1; |
| 22072 | PyErr_NoMemory(); |
| 22073 | D(p->level--); |
| 22074 | return NULL; |
| 22075 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22076 | Py_ssize_t _children_capacity = 1; |
| 22077 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22078 | { // ',' key_value_pattern |
| 22079 | if (p->error_indicator) { |
| 22080 | D(p->level--); |
| 22081 | return NULL; |
| 22082 | } |
| 22083 | D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); |
| 22084 | Token * _literal; |
| 22085 | KeyValuePair* elem; |
| 22086 | while ( |
| 22087 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 22088 | && |
| 22089 | (elem = key_value_pattern_rule(p)) // key_value_pattern |
| 22090 | ) |
| 22091 | { |
| 22092 | _res = elem; |
| 22093 | if (_res == NULL && PyErr_Occurred()) { |
| 22094 | p->error_indicator = 1; |
| 22095 | PyMem_Free(_children); |
| 22096 | D(p->level--); |
| 22097 | return NULL; |
| 22098 | } |
| 22099 | if (_n == _children_capacity) { |
| 22100 | _children_capacity *= 2; |
| 22101 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22102 | if (!_new_children) { |
| 22103 | p->error_indicator = 1; |
| 22104 | PyErr_NoMemory(); |
| 22105 | D(p->level--); |
| 22106 | return NULL; |
| 22107 | } |
| 22108 | _children = _new_children; |
| 22109 | } |
| 22110 | _children[_n++] = _res; |
| 22111 | _mark = p->mark; |
| 22112 | } |
| 22113 | p->mark = _mark; |
| 22114 | D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n", p->level, ' ', |
| 22115 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); |
| 22116 | } |
| 22117 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 22118 | if (!_seq) { |
| 22119 | PyMem_Free(_children); |
| 22120 | p->error_indicator = 1; |
| 22121 | PyErr_NoMemory(); |
| 22122 | D(p->level--); |
| 22123 | return NULL; |
| 22124 | } |
| 22125 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 22126 | PyMem_Free(_children); |
| 22127 | _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq); |
| 22128 | D(p->level--); |
| 22129 | return _seq; |
| 22130 | } |
| 22131 | |
| 22132 | // _gather_59: key_value_pattern _loop0_60 |
| 22133 | static asdl_seq * |
| 22134 | _gather_59_rule(Parser *p) |
| 22135 | { |
| 22136 | D(p->level++); |
| 22137 | if (p->error_indicator) { |
| 22138 | D(p->level--); |
| 22139 | return NULL; |
| 22140 | } |
| 22141 | asdl_seq * _res = NULL; |
| 22142 | int _mark = p->mark; |
| 22143 | { // key_value_pattern _loop0_60 |
| 22144 | if (p->error_indicator) { |
| 22145 | D(p->level--); |
| 22146 | return NULL; |
| 22147 | } |
| 22148 | D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60")); |
| 22149 | KeyValuePair* elem; |
| 22150 | asdl_seq * seq; |
| 22151 | if ( |
| 22152 | (elem = key_value_pattern_rule(p)) // key_value_pattern |
| 22153 | && |
| 22154 | (seq = _loop0_60_rule(p)) // _loop0_60 |
| 22155 | ) |
| 22156 | { |
| 22157 | D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60")); |
| 22158 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 22159 | goto done; |
| 22160 | } |
| 22161 | p->mark = _mark; |
| 22162 | D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n", p->level, ' ', |
| 22163 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_60")); |
| 22164 | } |
| 22165 | _res = NULL; |
| 22166 | done: |
| 22167 | D(p->level--); |
| 22168 | return _res; |
| 22169 | } |
| 22170 | |
| 22171 | // _tmp_61: literal_pattern | value_pattern |
| 22172 | static void * |
| 22173 | _tmp_61_rule(Parser *p) |
| 22174 | { |
| 22175 | D(p->level++); |
| 22176 | if (p->error_indicator) { |
| 22177 | D(p->level--); |
| 22178 | return NULL; |
| 22179 | } |
| 22180 | void * _res = NULL; |
| 22181 | int _mark = p->mark; |
| 22182 | { // literal_pattern |
| 22183 | if (p->error_indicator) { |
| 22184 | D(p->level--); |
| 22185 | return NULL; |
| 22186 | } |
| 22187 | D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
| 22188 | expr_ty literal_pattern_var; |
| 22189 | if ( |
| 22190 | (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern |
| 22191 | ) |
| 22192 | { |
| 22193 | D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
| 22194 | _res = literal_pattern_var; |
| 22195 | goto done; |
| 22196 | } |
| 22197 | p->mark = _mark; |
| 22198 | D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', |
| 22199 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); |
| 22200 | } |
| 22201 | { // value_pattern |
| 22202 | if (p->error_indicator) { |
| 22203 | D(p->level--); |
| 22204 | return NULL; |
| 22205 | } |
| 22206 | D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
| 22207 | expr_ty value_pattern_var; |
| 22208 | if ( |
| 22209 | (value_pattern_var = value_pattern_rule(p)) // value_pattern |
| 22210 | ) |
| 22211 | { |
| 22212 | D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
| 22213 | _res = value_pattern_var; |
| 22214 | goto done; |
| 22215 | } |
| 22216 | p->mark = _mark; |
| 22217 | D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', |
| 22218 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern")); |
| 22219 | } |
| 22220 | _res = NULL; |
| 22221 | done: |
| 22222 | D(p->level--); |
| 22223 | return _res; |
| 22224 | } |
| 22225 | |
| 22226 | // _loop0_63: ',' pattern |
| 22227 | static asdl_seq * |
| 22228 | _loop0_63_rule(Parser *p) |
| 22229 | { |
| 22230 | D(p->level++); |
| 22231 | if (p->error_indicator) { |
| 22232 | D(p->level--); |
| 22233 | return NULL; |
| 22234 | } |
| 22235 | void *_res = NULL; |
| 22236 | int _mark = p->mark; |
| 22237 | int _start_mark = p->mark; |
| 22238 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22239 | if (!_children) { |
| 22240 | p->error_indicator = 1; |
| 22241 | PyErr_NoMemory(); |
| 22242 | D(p->level--); |
| 22243 | return NULL; |
| 22244 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22245 | Py_ssize_t _children_capacity = 1; |
| 22246 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22247 | { // ',' pattern |
| 22248 | if (p->error_indicator) { |
| 22249 | D(p->level--); |
| 22250 | return NULL; |
| 22251 | } |
| 22252 | D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); |
| 22253 | Token * _literal; |
| 22254 | expr_ty elem; |
| 22255 | while ( |
| 22256 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 22257 | && |
| 22258 | (elem = pattern_rule(p)) // pattern |
| 22259 | ) |
| 22260 | { |
| 22261 | _res = elem; |
| 22262 | if (_res == NULL && PyErr_Occurred()) { |
| 22263 | p->error_indicator = 1; |
| 22264 | PyMem_Free(_children); |
| 22265 | D(p->level--); |
| 22266 | return NULL; |
| 22267 | } |
| 22268 | if (_n == _children_capacity) { |
| 22269 | _children_capacity *= 2; |
| 22270 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22271 | if (!_new_children) { |
| 22272 | p->error_indicator = 1; |
| 22273 | PyErr_NoMemory(); |
| 22274 | D(p->level--); |
| 22275 | return NULL; |
| 22276 | } |
| 22277 | _children = _new_children; |
| 22278 | } |
| 22279 | _children[_n++] = _res; |
| 22280 | _mark = p->mark; |
| 22281 | } |
| 22282 | p->mark = _mark; |
| 22283 | D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', |
| 22284 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); |
| 22285 | } |
| 22286 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 22287 | if (!_seq) { |
| 22288 | PyMem_Free(_children); |
| 22289 | p->error_indicator = 1; |
| 22290 | PyErr_NoMemory(); |
| 22291 | D(p->level--); |
| 22292 | return NULL; |
| 22293 | } |
| 22294 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 22295 | PyMem_Free(_children); |
| 22296 | _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); |
| 22297 | D(p->level--); |
| 22298 | return _seq; |
| 22299 | } |
| 22300 | |
| 22301 | // _gather_62: pattern _loop0_63 |
| 22302 | static asdl_seq * |
| 22303 | _gather_62_rule(Parser *p) |
| 22304 | { |
| 22305 | D(p->level++); |
| 22306 | if (p->error_indicator) { |
| 22307 | D(p->level--); |
| 22308 | return NULL; |
| 22309 | } |
| 22310 | asdl_seq * _res = NULL; |
| 22311 | int _mark = p->mark; |
| 22312 | { // pattern _loop0_63 |
| 22313 | if (p->error_indicator) { |
| 22314 | D(p->level--); |
| 22315 | return NULL; |
| 22316 | } |
| 22317 | D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63")); |
| 22318 | expr_ty elem; |
| 22319 | asdl_seq * seq; |
| 22320 | if ( |
| 22321 | (elem = pattern_rule(p)) // pattern |
| 22322 | && |
| 22323 | (seq = _loop0_63_rule(p)) // _loop0_63 |
| 22324 | ) |
| 22325 | { |
| 22326 | D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63")); |
| 22327 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 22328 | goto done; |
| 22329 | } |
| 22330 | p->mark = _mark; |
| 22331 | D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', |
| 22332 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_63")); |
| 22333 | } |
| 22334 | _res = NULL; |
| 22335 | done: |
| 22336 | D(p->level--); |
| 22337 | return _res; |
| 22338 | } |
| 22339 | |
| 22340 | // _loop0_65: ',' keyword_pattern |
| 22341 | static asdl_seq * |
| 22342 | _loop0_65_rule(Parser *p) |
| 22343 | { |
| 22344 | D(p->level++); |
| 22345 | if (p->error_indicator) { |
| 22346 | D(p->level--); |
| 22347 | return NULL; |
| 22348 | } |
| 22349 | void *_res = NULL; |
| 22350 | int _mark = p->mark; |
| 22351 | int _start_mark = p->mark; |
| 22352 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22353 | if (!_children) { |
| 22354 | p->error_indicator = 1; |
| 22355 | PyErr_NoMemory(); |
| 22356 | D(p->level--); |
| 22357 | return NULL; |
| 22358 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22359 | Py_ssize_t _children_capacity = 1; |
| 22360 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22361 | { // ',' keyword_pattern |
| 22362 | if (p->error_indicator) { |
| 22363 | D(p->level--); |
| 22364 | return NULL; |
| 22365 | } |
| 22366 | D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); |
| 22367 | Token * _literal; |
| 22368 | keyword_ty elem; |
| 22369 | while ( |
| 22370 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 22371 | && |
| 22372 | (elem = keyword_pattern_rule(p)) // keyword_pattern |
| 22373 | ) |
| 22374 | { |
| 22375 | _res = elem; |
| 22376 | if (_res == NULL && PyErr_Occurred()) { |
| 22377 | p->error_indicator = 1; |
| 22378 | PyMem_Free(_children); |
| 22379 | D(p->level--); |
| 22380 | return NULL; |
| 22381 | } |
| 22382 | if (_n == _children_capacity) { |
| 22383 | _children_capacity *= 2; |
| 22384 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22385 | if (!_new_children) { |
| 22386 | p->error_indicator = 1; |
| 22387 | PyErr_NoMemory(); |
| 22388 | D(p->level--); |
| 22389 | return NULL; |
| 22390 | } |
| 22391 | _children = _new_children; |
| 22392 | } |
| 22393 | _children[_n++] = _res; |
| 22394 | _mark = p->mark; |
| 22395 | } |
| 22396 | p->mark = _mark; |
| 22397 | D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ', |
| 22398 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); |
| 22399 | } |
| 22400 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 22401 | if (!_seq) { |
| 22402 | PyMem_Free(_children); |
| 22403 | p->error_indicator = 1; |
| 22404 | PyErr_NoMemory(); |
| 22405 | D(p->level--); |
| 22406 | return NULL; |
| 22407 | } |
| 22408 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 22409 | PyMem_Free(_children); |
| 22410 | _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); |
| 22411 | D(p->level--); |
| 22412 | return _seq; |
| 22413 | } |
| 22414 | |
| 22415 | // _gather_64: keyword_pattern _loop0_65 |
| 22416 | static asdl_seq * |
| 22417 | _gather_64_rule(Parser *p) |
| 22418 | { |
| 22419 | D(p->level++); |
| 22420 | if (p->error_indicator) { |
| 22421 | D(p->level--); |
| 22422 | return NULL; |
| 22423 | } |
| 22424 | asdl_seq * _res = NULL; |
| 22425 | int _mark = p->mark; |
| 22426 | { // keyword_pattern _loop0_65 |
| 22427 | if (p->error_indicator) { |
| 22428 | D(p->level--); |
| 22429 | return NULL; |
| 22430 | } |
| 22431 | D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65")); |
| 22432 | keyword_ty elem; |
| 22433 | asdl_seq * seq; |
| 22434 | if ( |
| 22435 | (elem = keyword_pattern_rule(p)) // keyword_pattern |
| 22436 | && |
| 22437 | (seq = _loop0_65_rule(p)) // _loop0_65 |
| 22438 | ) |
| 22439 | { |
| 22440 | D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65")); |
| 22441 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 22442 | goto done; |
| 22443 | } |
| 22444 | p->mark = _mark; |
| 22445 | D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ', |
| 22446 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_65")); |
| 22447 | } |
| 22448 | _res = NULL; |
| 22449 | done: |
| 22450 | D(p->level--); |
| 22451 | return _res; |
| 22452 | } |
| 22453 | |
| 22454 | // _tmp_66: 'from' expression |
| 22455 | static void * |
| 22456 | _tmp_66_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22457 | { |
| 22458 | D(p->level++); |
| 22459 | if (p->error_indicator) { |
| 22460 | D(p->level--); |
| 22461 | return NULL; |
| 22462 | } |
| 22463 | void * _res = NULL; |
| 22464 | int _mark = p->mark; |
| 22465 | { // 'from' expression |
| 22466 | if (p->error_indicator) { |
| 22467 | D(p->level--); |
| 22468 | return NULL; |
| 22469 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22470 | D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22471 | Token * _keyword; |
| 22472 | expr_ty z; |
| 22473 | if ( |
| 22474 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
| 22475 | && |
| 22476 | (z = expression_rule(p)) // expression |
| 22477 | ) |
| 22478 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22479 | D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22480 | _res = z; |
| 22481 | if (_res == NULL && PyErr_Occurred()) { |
| 22482 | p->error_indicator = 1; |
| 22483 | D(p->level--); |
| 22484 | return NULL; |
| 22485 | } |
| 22486 | goto done; |
| 22487 | } |
| 22488 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22489 | D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22490 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22491 | } |
| 22492 | _res = NULL; |
| 22493 | done: |
| 22494 | D(p->level--); |
| 22495 | return _res; |
| 22496 | } |
| 22497 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22498 | // _tmp_67: '->' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22499 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22500 | _tmp_67_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22501 | { |
| 22502 | D(p->level++); |
| 22503 | if (p->error_indicator) { |
| 22504 | D(p->level--); |
| 22505 | return NULL; |
| 22506 | } |
| 22507 | void * _res = NULL; |
| 22508 | int _mark = p->mark; |
| 22509 | { // '->' expression |
| 22510 | if (p->error_indicator) { |
| 22511 | D(p->level--); |
| 22512 | return NULL; |
| 22513 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22514 | D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22515 | Token * _literal; |
| 22516 | expr_ty z; |
| 22517 | if ( |
| 22518 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
| 22519 | && |
| 22520 | (z = expression_rule(p)) // expression |
| 22521 | ) |
| 22522 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22523 | D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22524 | _res = z; |
| 22525 | if (_res == NULL && PyErr_Occurred()) { |
| 22526 | p->error_indicator = 1; |
| 22527 | D(p->level--); |
| 22528 | return NULL; |
| 22529 | } |
| 22530 | goto done; |
| 22531 | } |
| 22532 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22533 | D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22534 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
| 22535 | } |
| 22536 | _res = NULL; |
| 22537 | done: |
| 22538 | D(p->level--); |
| 22539 | return _res; |
| 22540 | } |
| 22541 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22542 | // _tmp_68: '->' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22543 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22544 | _tmp_68_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22545 | { |
| 22546 | D(p->level++); |
| 22547 | if (p->error_indicator) { |
| 22548 | D(p->level--); |
| 22549 | return NULL; |
| 22550 | } |
| 22551 | void * _res = NULL; |
| 22552 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22553 | { // '->' expression |
| 22554 | if (p->error_indicator) { |
| 22555 | D(p->level--); |
| 22556 | return NULL; |
| 22557 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22558 | D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22559 | Token * _literal; |
| 22560 | expr_ty z; |
| 22561 | if ( |
| 22562 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
| 22563 | && |
| 22564 | (z = expression_rule(p)) // expression |
| 22565 | ) |
| 22566 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22567 | D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22568 | _res = z; |
| 22569 | if (_res == NULL && PyErr_Occurred()) { |
| 22570 | p->error_indicator = 1; |
| 22571 | D(p->level--); |
| 22572 | return NULL; |
| 22573 | } |
| 22574 | goto done; |
| 22575 | } |
| 22576 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22577 | D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22578 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
| 22579 | } |
| 22580 | _res = NULL; |
| 22581 | done: |
| 22582 | D(p->level--); |
| 22583 | return _res; |
| 22584 | } |
| 22585 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22586 | // _tmp_69: NEWLINE INDENT |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22587 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22588 | _tmp_69_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22589 | { |
| 22590 | D(p->level++); |
| 22591 | if (p->error_indicator) { |
| 22592 | D(p->level--); |
| 22593 | return NULL; |
| 22594 | } |
| 22595 | void * _res = NULL; |
| 22596 | int _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22597 | { // NEWLINE INDENT |
| 22598 | if (p->error_indicator) { |
| 22599 | D(p->level--); |
| 22600 | return NULL; |
| 22601 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22602 | D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22603 | Token * indent_var; |
| 22604 | Token * newline_var; |
| 22605 | if ( |
| 22606 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 22607 | && |
| 22608 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
| 22609 | ) |
| 22610 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22611 | D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22612 | _res = _PyPegen_dummy_name(p, newline_var, indent_var); |
| 22613 | goto done; |
| 22614 | } |
| 22615 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22616 | D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22617 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); |
| 22618 | } |
| 22619 | _res = NULL; |
| 22620 | done: |
| 22621 | D(p->level--); |
| 22622 | return _res; |
| 22623 | } |
| 22624 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22625 | // _loop0_70: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22626 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22627 | _loop0_70_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22628 | { |
| 22629 | D(p->level++); |
| 22630 | if (p->error_indicator) { |
| 22631 | D(p->level--); |
| 22632 | return NULL; |
| 22633 | } |
| 22634 | void *_res = NULL; |
| 22635 | int _mark = p->mark; |
| 22636 | int _start_mark = p->mark; |
| 22637 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22638 | if (!_children) { |
| 22639 | p->error_indicator = 1; |
| 22640 | PyErr_NoMemory(); |
| 22641 | D(p->level--); |
| 22642 | return NULL; |
| 22643 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22644 | Py_ssize_t _children_capacity = 1; |
| 22645 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22646 | { // param_no_default |
| 22647 | if (p->error_indicator) { |
| 22648 | D(p->level--); |
| 22649 | return NULL; |
| 22650 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22651 | D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22652 | arg_ty param_no_default_var; |
| 22653 | while ( |
| 22654 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 22655 | ) |
| 22656 | { |
| 22657 | _res = param_no_default_var; |
| 22658 | if (_n == _children_capacity) { |
| 22659 | _children_capacity *= 2; |
| 22660 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22661 | if (!_new_children) { |
| 22662 | p->error_indicator = 1; |
| 22663 | PyErr_NoMemory(); |
| 22664 | D(p->level--); |
| 22665 | return NULL; |
| 22666 | } |
| 22667 | _children = _new_children; |
| 22668 | } |
| 22669 | _children[_n++] = _res; |
| 22670 | _mark = p->mark; |
| 22671 | } |
| 22672 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22673 | D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22674 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22675 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22676 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22677 | if (!_seq) { |
| 22678 | PyMem_Free(_children); |
| 22679 | p->error_indicator = 1; |
| 22680 | PyErr_NoMemory(); |
| 22681 | D(p->level--); |
| 22682 | return NULL; |
| 22683 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22684 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22685 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22686 | _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22687 | D(p->level--); |
| 22688 | return _seq; |
| 22689 | } |
| 22690 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22691 | // _loop0_71: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22692 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22693 | _loop0_71_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22694 | { |
| 22695 | D(p->level++); |
| 22696 | if (p->error_indicator) { |
| 22697 | D(p->level--); |
| 22698 | return NULL; |
| 22699 | } |
| 22700 | void *_res = NULL; |
| 22701 | int _mark = p->mark; |
| 22702 | int _start_mark = p->mark; |
| 22703 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22704 | if (!_children) { |
| 22705 | p->error_indicator = 1; |
| 22706 | PyErr_NoMemory(); |
| 22707 | D(p->level--); |
| 22708 | return NULL; |
| 22709 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22710 | Py_ssize_t _children_capacity = 1; |
| 22711 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22712 | { // param_with_default |
| 22713 | if (p->error_indicator) { |
| 22714 | D(p->level--); |
| 22715 | return NULL; |
| 22716 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22717 | D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22718 | NameDefaultPair* param_with_default_var; |
| 22719 | while ( |
| 22720 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 22721 | ) |
| 22722 | { |
| 22723 | _res = param_with_default_var; |
| 22724 | if (_n == _children_capacity) { |
| 22725 | _children_capacity *= 2; |
| 22726 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22727 | if (!_new_children) { |
| 22728 | p->error_indicator = 1; |
| 22729 | PyErr_NoMemory(); |
| 22730 | D(p->level--); |
| 22731 | return NULL; |
| 22732 | } |
| 22733 | _children = _new_children; |
| 22734 | } |
| 22735 | _children[_n++] = _res; |
| 22736 | _mark = p->mark; |
| 22737 | } |
| 22738 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22739 | D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22740 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 22741 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22742 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22743 | if (!_seq) { |
| 22744 | PyMem_Free(_children); |
| 22745 | p->error_indicator = 1; |
| 22746 | PyErr_NoMemory(); |
| 22747 | D(p->level--); |
| 22748 | return NULL; |
| 22749 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22750 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22751 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22752 | _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22753 | D(p->level--); |
| 22754 | return _seq; |
| 22755 | } |
| 22756 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22757 | // _loop0_72: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22758 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22759 | _loop0_72_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22760 | { |
| 22761 | D(p->level++); |
| 22762 | if (p->error_indicator) { |
| 22763 | D(p->level--); |
| 22764 | return NULL; |
| 22765 | } |
| 22766 | void *_res = NULL; |
| 22767 | int _mark = p->mark; |
| 22768 | int _start_mark = p->mark; |
| 22769 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22770 | if (!_children) { |
| 22771 | p->error_indicator = 1; |
| 22772 | PyErr_NoMemory(); |
| 22773 | D(p->level--); |
| 22774 | return NULL; |
| 22775 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22776 | Py_ssize_t _children_capacity = 1; |
| 22777 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22778 | { // param_with_default |
| 22779 | if (p->error_indicator) { |
| 22780 | D(p->level--); |
| 22781 | return NULL; |
| 22782 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22783 | D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22784 | NameDefaultPair* param_with_default_var; |
| 22785 | while ( |
| 22786 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 22787 | ) |
| 22788 | { |
| 22789 | _res = param_with_default_var; |
| 22790 | if (_n == _children_capacity) { |
| 22791 | _children_capacity *= 2; |
| 22792 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22793 | if (!_new_children) { |
| 22794 | p->error_indicator = 1; |
| 22795 | PyErr_NoMemory(); |
| 22796 | D(p->level--); |
| 22797 | return NULL; |
| 22798 | } |
| 22799 | _children = _new_children; |
| 22800 | } |
| 22801 | _children[_n++] = _res; |
| 22802 | _mark = p->mark; |
| 22803 | } |
| 22804 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22805 | D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22806 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 22807 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22808 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22809 | if (!_seq) { |
| 22810 | PyMem_Free(_children); |
| 22811 | p->error_indicator = 1; |
| 22812 | PyErr_NoMemory(); |
| 22813 | D(p->level--); |
| 22814 | return NULL; |
| 22815 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22816 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22817 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22818 | _PyPegen_insert_memo(p, _start_mark, _loop0_72_type, _seq); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22819 | D(p->level--); |
| 22820 | return _seq; |
| 22821 | } |
| 22822 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22823 | // _loop1_73: param_no_default |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22824 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22825 | _loop1_73_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22826 | { |
| 22827 | D(p->level++); |
| 22828 | if (p->error_indicator) { |
| 22829 | D(p->level--); |
| 22830 | return NULL; |
| 22831 | } |
| 22832 | void *_res = NULL; |
| 22833 | int _mark = p->mark; |
| 22834 | int _start_mark = p->mark; |
| 22835 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22836 | if (!_children) { |
| 22837 | p->error_indicator = 1; |
| 22838 | PyErr_NoMemory(); |
| 22839 | D(p->level--); |
| 22840 | return NULL; |
| 22841 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22842 | Py_ssize_t _children_capacity = 1; |
| 22843 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22844 | { // param_no_default |
| 22845 | if (p->error_indicator) { |
| 22846 | D(p->level--); |
| 22847 | return NULL; |
| 22848 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22849 | D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22850 | arg_ty param_no_default_var; |
| 22851 | while ( |
| 22852 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 22853 | ) |
| 22854 | { |
| 22855 | _res = param_no_default_var; |
| 22856 | if (_n == _children_capacity) { |
| 22857 | _children_capacity *= 2; |
| 22858 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22859 | if (!_new_children) { |
| 22860 | p->error_indicator = 1; |
| 22861 | PyErr_NoMemory(); |
| 22862 | D(p->level--); |
| 22863 | return NULL; |
| 22864 | } |
| 22865 | _children = _new_children; |
| 22866 | } |
| 22867 | _children[_n++] = _res; |
| 22868 | _mark = p->mark; |
| 22869 | } |
| 22870 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22871 | D(fprintf(stderr, "%*c%s _loop1_73[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22872 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 22873 | } |
| 22874 | if (_n == 0 || p->error_indicator) { |
| 22875 | PyMem_Free(_children); |
| 22876 | D(p->level--); |
| 22877 | return NULL; |
| 22878 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22879 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22880 | if (!_seq) { |
| 22881 | PyMem_Free(_children); |
| 22882 | p->error_indicator = 1; |
| 22883 | PyErr_NoMemory(); |
| 22884 | D(p->level--); |
| 22885 | return NULL; |
| 22886 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22887 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22888 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22889 | _PyPegen_insert_memo(p, _start_mark, _loop1_73_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22890 | D(p->level--); |
| 22891 | return _seq; |
| 22892 | } |
| 22893 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22894 | // _loop0_74: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22895 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22896 | _loop0_74_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22897 | { |
| 22898 | D(p->level++); |
| 22899 | if (p->error_indicator) { |
| 22900 | D(p->level--); |
| 22901 | return NULL; |
| 22902 | } |
| 22903 | void *_res = NULL; |
| 22904 | int _mark = p->mark; |
| 22905 | int _start_mark = p->mark; |
| 22906 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22907 | if (!_children) { |
| 22908 | p->error_indicator = 1; |
| 22909 | PyErr_NoMemory(); |
| 22910 | D(p->level--); |
| 22911 | return NULL; |
| 22912 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22913 | Py_ssize_t _children_capacity = 1; |
| 22914 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22915 | { // param_with_default |
| 22916 | if (p->error_indicator) { |
| 22917 | D(p->level--); |
| 22918 | return NULL; |
| 22919 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22920 | D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22921 | NameDefaultPair* param_with_default_var; |
| 22922 | while ( |
| 22923 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 22924 | ) |
| 22925 | { |
| 22926 | _res = param_with_default_var; |
| 22927 | if (_n == _children_capacity) { |
| 22928 | _children_capacity *= 2; |
| 22929 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22930 | if (!_new_children) { |
| 22931 | p->error_indicator = 1; |
| 22932 | PyErr_NoMemory(); |
| 22933 | D(p->level--); |
| 22934 | return NULL; |
| 22935 | } |
| 22936 | _children = _new_children; |
| 22937 | } |
| 22938 | _children[_n++] = _res; |
| 22939 | _mark = p->mark; |
| 22940 | } |
| 22941 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22942 | D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22943 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 22944 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22945 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22946 | if (!_seq) { |
| 22947 | PyMem_Free(_children); |
| 22948 | p->error_indicator = 1; |
| 22949 | PyErr_NoMemory(); |
| 22950 | D(p->level--); |
| 22951 | return NULL; |
| 22952 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22953 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22954 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22955 | _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22956 | D(p->level--); |
| 22957 | return _seq; |
| 22958 | } |
| 22959 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22960 | // _loop1_75: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22961 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22962 | _loop1_75_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22963 | { |
| 22964 | D(p->level++); |
| 22965 | if (p->error_indicator) { |
| 22966 | D(p->level--); |
| 22967 | return NULL; |
| 22968 | } |
| 22969 | void *_res = NULL; |
| 22970 | int _mark = p->mark; |
| 22971 | int _start_mark = p->mark; |
| 22972 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22973 | if (!_children) { |
| 22974 | p->error_indicator = 1; |
| 22975 | PyErr_NoMemory(); |
| 22976 | D(p->level--); |
| 22977 | return NULL; |
| 22978 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22979 | Py_ssize_t _children_capacity = 1; |
| 22980 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22981 | { // param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22982 | if (p->error_indicator) { |
| 22983 | D(p->level--); |
| 22984 | return NULL; |
| 22985 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22986 | D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22987 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22988 | while ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22989 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22990 | ) |
| 22991 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22992 | _res = param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22993 | if (_n == _children_capacity) { |
| 22994 | _children_capacity *= 2; |
| 22995 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22996 | if (!_new_children) { |
| 22997 | p->error_indicator = 1; |
| 22998 | PyErr_NoMemory(); |
| 22999 | D(p->level--); |
| 23000 | return NULL; |
| 23001 | } |
| 23002 | _children = _new_children; |
| 23003 | } |
| 23004 | _children[_n++] = _res; |
| 23005 | _mark = p->mark; |
| 23006 | } |
| 23007 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23008 | D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23009 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23010 | } |
| 23011 | if (_n == 0 || p->error_indicator) { |
| 23012 | PyMem_Free(_children); |
| 23013 | D(p->level--); |
| 23014 | return NULL; |
| 23015 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23016 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23017 | if (!_seq) { |
| 23018 | PyMem_Free(_children); |
| 23019 | p->error_indicator = 1; |
| 23020 | PyErr_NoMemory(); |
| 23021 | D(p->level--); |
| 23022 | return NULL; |
| 23023 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23024 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23025 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23026 | _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23027 | D(p->level--); |
| 23028 | return _seq; |
| 23029 | } |
| 23030 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23031 | // _loop1_76: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23032 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23033 | _loop1_76_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23034 | { |
| 23035 | D(p->level++); |
| 23036 | if (p->error_indicator) { |
| 23037 | D(p->level--); |
| 23038 | return NULL; |
| 23039 | } |
| 23040 | void *_res = NULL; |
| 23041 | int _mark = p->mark; |
| 23042 | int _start_mark = p->mark; |
| 23043 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23044 | if (!_children) { |
| 23045 | p->error_indicator = 1; |
| 23046 | PyErr_NoMemory(); |
| 23047 | D(p->level--); |
| 23048 | return NULL; |
| 23049 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23050 | Py_ssize_t _children_capacity = 1; |
| 23051 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23052 | { // param_no_default |
| 23053 | if (p->error_indicator) { |
| 23054 | D(p->level--); |
| 23055 | return NULL; |
| 23056 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23057 | D(fprintf(stderr, "%*c> _loop1_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23058 | arg_ty param_no_default_var; |
| 23059 | while ( |
| 23060 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 23061 | ) |
| 23062 | { |
| 23063 | _res = param_no_default_var; |
| 23064 | if (_n == _children_capacity) { |
| 23065 | _children_capacity *= 2; |
| 23066 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23067 | if (!_new_children) { |
| 23068 | p->error_indicator = 1; |
| 23069 | PyErr_NoMemory(); |
| 23070 | D(p->level--); |
| 23071 | return NULL; |
| 23072 | } |
| 23073 | _children = _new_children; |
| 23074 | } |
| 23075 | _children[_n++] = _res; |
| 23076 | _mark = p->mark; |
| 23077 | } |
| 23078 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23079 | D(fprintf(stderr, "%*c%s _loop1_76[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23080 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 23081 | } |
| 23082 | if (_n == 0 || p->error_indicator) { |
| 23083 | PyMem_Free(_children); |
| 23084 | D(p->level--); |
| 23085 | return NULL; |
| 23086 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23087 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23088 | if (!_seq) { |
| 23089 | PyMem_Free(_children); |
| 23090 | p->error_indicator = 1; |
| 23091 | PyErr_NoMemory(); |
| 23092 | D(p->level--); |
| 23093 | return NULL; |
| 23094 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23095 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23096 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23097 | _PyPegen_insert_memo(p, _start_mark, _loop1_76_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23098 | D(p->level--); |
| 23099 | return _seq; |
| 23100 | } |
| 23101 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23102 | // _loop1_77: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23103 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23104 | _loop1_77_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23105 | { |
| 23106 | D(p->level++); |
| 23107 | if (p->error_indicator) { |
| 23108 | D(p->level--); |
| 23109 | return NULL; |
| 23110 | } |
| 23111 | void *_res = NULL; |
| 23112 | int _mark = p->mark; |
| 23113 | int _start_mark = p->mark; |
| 23114 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23115 | if (!_children) { |
| 23116 | p->error_indicator = 1; |
| 23117 | PyErr_NoMemory(); |
| 23118 | D(p->level--); |
| 23119 | return NULL; |
| 23120 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23121 | Py_ssize_t _children_capacity = 1; |
| 23122 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23123 | { // param_no_default |
| 23124 | if (p->error_indicator) { |
| 23125 | D(p->level--); |
| 23126 | return NULL; |
| 23127 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23128 | D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23129 | arg_ty param_no_default_var; |
| 23130 | while ( |
| 23131 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 23132 | ) |
| 23133 | { |
| 23134 | _res = param_no_default_var; |
| 23135 | if (_n == _children_capacity) { |
| 23136 | _children_capacity *= 2; |
| 23137 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23138 | if (!_new_children) { |
| 23139 | p->error_indicator = 1; |
| 23140 | PyErr_NoMemory(); |
| 23141 | D(p->level--); |
| 23142 | return NULL; |
| 23143 | } |
| 23144 | _children = _new_children; |
| 23145 | } |
| 23146 | _children[_n++] = _res; |
| 23147 | _mark = p->mark; |
| 23148 | } |
| 23149 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23150 | D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23151 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 23152 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23153 | if (_n == 0 || p->error_indicator) { |
| 23154 | PyMem_Free(_children); |
| 23155 | D(p->level--); |
| 23156 | return NULL; |
| 23157 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23158 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23159 | if (!_seq) { |
| 23160 | PyMem_Free(_children); |
| 23161 | p->error_indicator = 1; |
| 23162 | PyErr_NoMemory(); |
| 23163 | D(p->level--); |
| 23164 | return NULL; |
| 23165 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23166 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23167 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23168 | _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23169 | D(p->level--); |
| 23170 | return _seq; |
| 23171 | } |
| 23172 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23173 | // _loop0_78: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23174 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23175 | _loop0_78_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23176 | { |
| 23177 | D(p->level++); |
| 23178 | if (p->error_indicator) { |
| 23179 | D(p->level--); |
| 23180 | return NULL; |
| 23181 | } |
| 23182 | void *_res = NULL; |
| 23183 | int _mark = p->mark; |
| 23184 | int _start_mark = p->mark; |
| 23185 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23186 | if (!_children) { |
| 23187 | p->error_indicator = 1; |
| 23188 | PyErr_NoMemory(); |
| 23189 | D(p->level--); |
| 23190 | return NULL; |
| 23191 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23192 | Py_ssize_t _children_capacity = 1; |
| 23193 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23194 | { // param_no_default |
| 23195 | if (p->error_indicator) { |
| 23196 | D(p->level--); |
| 23197 | return NULL; |
| 23198 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23199 | D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23200 | arg_ty param_no_default_var; |
| 23201 | while ( |
| 23202 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 23203 | ) |
| 23204 | { |
| 23205 | _res = param_no_default_var; |
| 23206 | if (_n == _children_capacity) { |
| 23207 | _children_capacity *= 2; |
| 23208 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23209 | if (!_new_children) { |
| 23210 | p->error_indicator = 1; |
| 23211 | PyErr_NoMemory(); |
| 23212 | D(p->level--); |
| 23213 | return NULL; |
| 23214 | } |
| 23215 | _children = _new_children; |
| 23216 | } |
| 23217 | _children[_n++] = _res; |
| 23218 | _mark = p->mark; |
| 23219 | } |
| 23220 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23221 | D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23222 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 23223 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23224 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23225 | if (!_seq) { |
| 23226 | PyMem_Free(_children); |
| 23227 | p->error_indicator = 1; |
| 23228 | PyErr_NoMemory(); |
| 23229 | D(p->level--); |
| 23230 | return NULL; |
| 23231 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23232 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23233 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23234 | _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23235 | D(p->level--); |
| 23236 | return _seq; |
| 23237 | } |
| 23238 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23239 | // _loop1_79: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23240 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23241 | _loop1_79_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23242 | { |
| 23243 | D(p->level++); |
| 23244 | if (p->error_indicator) { |
| 23245 | D(p->level--); |
| 23246 | return NULL; |
| 23247 | } |
| 23248 | void *_res = NULL; |
| 23249 | int _mark = p->mark; |
| 23250 | int _start_mark = p->mark; |
| 23251 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23252 | if (!_children) { |
| 23253 | p->error_indicator = 1; |
| 23254 | PyErr_NoMemory(); |
| 23255 | D(p->level--); |
| 23256 | return NULL; |
| 23257 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23258 | Py_ssize_t _children_capacity = 1; |
| 23259 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23260 | { // param_with_default |
| 23261 | if (p->error_indicator) { |
| 23262 | D(p->level--); |
| 23263 | return NULL; |
| 23264 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23265 | D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23266 | NameDefaultPair* param_with_default_var; |
| 23267 | while ( |
| 23268 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 23269 | ) |
| 23270 | { |
| 23271 | _res = param_with_default_var; |
| 23272 | if (_n == _children_capacity) { |
| 23273 | _children_capacity *= 2; |
| 23274 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23275 | if (!_new_children) { |
| 23276 | p->error_indicator = 1; |
| 23277 | PyErr_NoMemory(); |
| 23278 | D(p->level--); |
| 23279 | return NULL; |
| 23280 | } |
| 23281 | _children = _new_children; |
| 23282 | } |
| 23283 | _children[_n++] = _res; |
| 23284 | _mark = p->mark; |
| 23285 | } |
| 23286 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23287 | D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23288 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 23289 | } |
| 23290 | if (_n == 0 || p->error_indicator) { |
| 23291 | PyMem_Free(_children); |
| 23292 | D(p->level--); |
| 23293 | return NULL; |
| 23294 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23295 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23296 | if (!_seq) { |
| 23297 | PyMem_Free(_children); |
| 23298 | p->error_indicator = 1; |
| 23299 | PyErr_NoMemory(); |
| 23300 | D(p->level--); |
| 23301 | return NULL; |
| 23302 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23303 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23304 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23305 | _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23306 | D(p->level--); |
| 23307 | return _seq; |
| 23308 | } |
| 23309 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23310 | // _loop0_80: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23311 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23312 | _loop0_80_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23313 | { |
| 23314 | D(p->level++); |
| 23315 | if (p->error_indicator) { |
| 23316 | D(p->level--); |
| 23317 | return NULL; |
| 23318 | } |
| 23319 | void *_res = NULL; |
| 23320 | int _mark = p->mark; |
| 23321 | int _start_mark = p->mark; |
| 23322 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23323 | if (!_children) { |
| 23324 | p->error_indicator = 1; |
| 23325 | PyErr_NoMemory(); |
| 23326 | D(p->level--); |
| 23327 | return NULL; |
| 23328 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23329 | Py_ssize_t _children_capacity = 1; |
| 23330 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23331 | { // param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23332 | if (p->error_indicator) { |
| 23333 | D(p->level--); |
| 23334 | return NULL; |
| 23335 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23336 | D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23337 | arg_ty param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23338 | while ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23339 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23340 | ) |
| 23341 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23342 | _res = param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23343 | if (_n == _children_capacity) { |
| 23344 | _children_capacity *= 2; |
| 23345 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23346 | if (!_new_children) { |
| 23347 | p->error_indicator = 1; |
| 23348 | PyErr_NoMemory(); |
| 23349 | D(p->level--); |
| 23350 | return NULL; |
| 23351 | } |
| 23352 | _children = _new_children; |
| 23353 | } |
| 23354 | _children[_n++] = _res; |
| 23355 | _mark = p->mark; |
| 23356 | } |
| 23357 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23358 | D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23359 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23360 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23361 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23362 | if (!_seq) { |
| 23363 | PyMem_Free(_children); |
| 23364 | p->error_indicator = 1; |
| 23365 | PyErr_NoMemory(); |
| 23366 | D(p->level--); |
| 23367 | return NULL; |
| 23368 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23369 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23370 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23371 | _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23372 | D(p->level--); |
| 23373 | return _seq; |
| 23374 | } |
| 23375 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23376 | // _loop1_81: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23377 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23378 | _loop1_81_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23379 | { |
| 23380 | D(p->level++); |
| 23381 | if (p->error_indicator) { |
| 23382 | D(p->level--); |
| 23383 | return NULL; |
| 23384 | } |
| 23385 | void *_res = NULL; |
| 23386 | int _mark = p->mark; |
| 23387 | int _start_mark = p->mark; |
| 23388 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23389 | if (!_children) { |
| 23390 | p->error_indicator = 1; |
| 23391 | PyErr_NoMemory(); |
| 23392 | D(p->level--); |
| 23393 | return NULL; |
| 23394 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23395 | Py_ssize_t _children_capacity = 1; |
| 23396 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23397 | { // param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23398 | if (p->error_indicator) { |
| 23399 | D(p->level--); |
| 23400 | return NULL; |
| 23401 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23402 | D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23403 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23404 | while ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23405 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23406 | ) |
| 23407 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23408 | _res = param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23409 | if (_n == _children_capacity) { |
| 23410 | _children_capacity *= 2; |
| 23411 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23412 | if (!_new_children) { |
| 23413 | p->error_indicator = 1; |
| 23414 | PyErr_NoMemory(); |
| 23415 | D(p->level--); |
| 23416 | return NULL; |
| 23417 | } |
| 23418 | _children = _new_children; |
| 23419 | } |
| 23420 | _children[_n++] = _res; |
| 23421 | _mark = p->mark; |
| 23422 | } |
| 23423 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23424 | D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23425 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23426 | } |
| 23427 | if (_n == 0 || p->error_indicator) { |
| 23428 | PyMem_Free(_children); |
| 23429 | D(p->level--); |
| 23430 | return NULL; |
| 23431 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23432 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23433 | if (!_seq) { |
| 23434 | PyMem_Free(_children); |
| 23435 | p->error_indicator = 1; |
| 23436 | PyErr_NoMemory(); |
| 23437 | D(p->level--); |
| 23438 | return NULL; |
| 23439 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23440 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23441 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23442 | _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23443 | D(p->level--); |
| 23444 | return _seq; |
| 23445 | } |
| 23446 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23447 | // _loop0_82: param_maybe_default |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23448 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23449 | _loop0_82_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23450 | { |
| 23451 | D(p->level++); |
| 23452 | if (p->error_indicator) { |
| 23453 | D(p->level--); |
| 23454 | return NULL; |
| 23455 | } |
| 23456 | void *_res = NULL; |
| 23457 | int _mark = p->mark; |
| 23458 | int _start_mark = p->mark; |
| 23459 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23460 | if (!_children) { |
| 23461 | p->error_indicator = 1; |
| 23462 | PyErr_NoMemory(); |
| 23463 | D(p->level--); |
| 23464 | return NULL; |
| 23465 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23466 | Py_ssize_t _children_capacity = 1; |
| 23467 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23468 | { // param_maybe_default |
| 23469 | if (p->error_indicator) { |
| 23470 | D(p->level--); |
| 23471 | return NULL; |
| 23472 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23473 | D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23474 | NameDefaultPair* param_maybe_default_var; |
| 23475 | while ( |
| 23476 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
| 23477 | ) |
| 23478 | { |
| 23479 | _res = param_maybe_default_var; |
| 23480 | if (_n == _children_capacity) { |
| 23481 | _children_capacity *= 2; |
| 23482 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23483 | if (!_new_children) { |
| 23484 | p->error_indicator = 1; |
| 23485 | PyErr_NoMemory(); |
| 23486 | D(p->level--); |
| 23487 | return NULL; |
| 23488 | } |
| 23489 | _children = _new_children; |
| 23490 | } |
| 23491 | _children[_n++] = _res; |
| 23492 | _mark = p->mark; |
| 23493 | } |
| 23494 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23495 | D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23496 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
| 23497 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23498 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23499 | if (!_seq) { |
| 23500 | PyMem_Free(_children); |
| 23501 | p->error_indicator = 1; |
| 23502 | PyErr_NoMemory(); |
| 23503 | D(p->level--); |
| 23504 | return NULL; |
| 23505 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23506 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23507 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23508 | _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23509 | D(p->level--); |
| 23510 | return _seq; |
| 23511 | } |
| 23512 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23513 | // _loop1_83: param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23514 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23515 | _loop1_83_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23516 | { |
| 23517 | D(p->level++); |
| 23518 | if (p->error_indicator) { |
| 23519 | D(p->level--); |
| 23520 | return NULL; |
| 23521 | } |
| 23522 | void *_res = NULL; |
| 23523 | int _mark = p->mark; |
| 23524 | int _start_mark = p->mark; |
| 23525 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23526 | if (!_children) { |
| 23527 | p->error_indicator = 1; |
| 23528 | PyErr_NoMemory(); |
| 23529 | D(p->level--); |
| 23530 | return NULL; |
| 23531 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23532 | Py_ssize_t _children_capacity = 1; |
| 23533 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23534 | { // param_maybe_default |
| 23535 | if (p->error_indicator) { |
| 23536 | D(p->level--); |
| 23537 | return NULL; |
| 23538 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23539 | D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23540 | NameDefaultPair* param_maybe_default_var; |
| 23541 | while ( |
| 23542 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
| 23543 | ) |
| 23544 | { |
| 23545 | _res = param_maybe_default_var; |
| 23546 | if (_n == _children_capacity) { |
| 23547 | _children_capacity *= 2; |
| 23548 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23549 | if (!_new_children) { |
| 23550 | p->error_indicator = 1; |
| 23551 | PyErr_NoMemory(); |
| 23552 | D(p->level--); |
| 23553 | return NULL; |
| 23554 | } |
| 23555 | _children = _new_children; |
| 23556 | } |
| 23557 | _children[_n++] = _res; |
| 23558 | _mark = p->mark; |
| 23559 | } |
| 23560 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23561 | D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23562 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
| 23563 | } |
| 23564 | if (_n == 0 || p->error_indicator) { |
| 23565 | PyMem_Free(_children); |
| 23566 | D(p->level--); |
| 23567 | return NULL; |
| 23568 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23569 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23570 | if (!_seq) { |
| 23571 | PyMem_Free(_children); |
| 23572 | p->error_indicator = 1; |
| 23573 | PyErr_NoMemory(); |
| 23574 | D(p->level--); |
| 23575 | return NULL; |
| 23576 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23577 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23578 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23579 | _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23580 | D(p->level--); |
| 23581 | return _seq; |
| 23582 | } |
| 23583 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23584 | // _loop1_84: ('@' named_expression NEWLINE) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23585 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23586 | _loop1_84_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23587 | { |
| 23588 | D(p->level++); |
| 23589 | if (p->error_indicator) { |
| 23590 | D(p->level--); |
| 23591 | return NULL; |
| 23592 | } |
| 23593 | void *_res = NULL; |
| 23594 | int _mark = p->mark; |
| 23595 | int _start_mark = p->mark; |
| 23596 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23597 | if (!_children) { |
| 23598 | p->error_indicator = 1; |
| 23599 | PyErr_NoMemory(); |
| 23600 | D(p->level--); |
| 23601 | return NULL; |
| 23602 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23603 | Py_ssize_t _children_capacity = 1; |
| 23604 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23605 | { // ('@' named_expression NEWLINE) |
| 23606 | if (p->error_indicator) { |
| 23607 | D(p->level--); |
| 23608 | return NULL; |
| 23609 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23610 | D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); |
| 23611 | void *_tmp_165_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23612 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23613 | (_tmp_165_var = _tmp_165_rule(p)) // '@' named_expression NEWLINE |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23614 | ) |
| 23615 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23616 | _res = _tmp_165_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23617 | if (_n == _children_capacity) { |
| 23618 | _children_capacity *= 2; |
| 23619 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23620 | if (!_new_children) { |
| 23621 | p->error_indicator = 1; |
| 23622 | PyErr_NoMemory(); |
| 23623 | D(p->level--); |
| 23624 | return NULL; |
| 23625 | } |
| 23626 | _children = _new_children; |
| 23627 | } |
| 23628 | _children[_n++] = _res; |
| 23629 | _mark = p->mark; |
| 23630 | } |
| 23631 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23632 | D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23633 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); |
| 23634 | } |
| 23635 | if (_n == 0 || p->error_indicator) { |
| 23636 | PyMem_Free(_children); |
| 23637 | D(p->level--); |
| 23638 | return NULL; |
| 23639 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23640 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23641 | if (!_seq) { |
| 23642 | PyMem_Free(_children); |
| 23643 | p->error_indicator = 1; |
| 23644 | PyErr_NoMemory(); |
| 23645 | D(p->level--); |
| 23646 | return NULL; |
| 23647 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23648 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23649 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23650 | _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23651 | D(p->level--); |
| 23652 | return _seq; |
| 23653 | } |
| 23654 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23655 | // _tmp_85: '(' arguments? ')' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23656 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23657 | _tmp_85_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23658 | { |
| 23659 | D(p->level++); |
| 23660 | if (p->error_indicator) { |
| 23661 | D(p->level--); |
| 23662 | return NULL; |
| 23663 | } |
| 23664 | void * _res = NULL; |
| 23665 | int _mark = p->mark; |
| 23666 | { // '(' arguments? ')' |
| 23667 | if (p->error_indicator) { |
| 23668 | D(p->level--); |
| 23669 | return NULL; |
| 23670 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23671 | D(fprintf(stderr, "%*c> _tmp_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23672 | Token * _literal; |
| 23673 | Token * _literal_1; |
| 23674 | void *z; |
| 23675 | if ( |
| 23676 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 23677 | && |
| 23678 | (z = arguments_rule(p), 1) // arguments? |
| 23679 | && |
| 23680 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 23681 | ) |
| 23682 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23683 | D(fprintf(stderr, "%*c+ _tmp_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23684 | _res = z; |
| 23685 | if (_res == NULL && PyErr_Occurred()) { |
| 23686 | p->error_indicator = 1; |
| 23687 | D(p->level--); |
| 23688 | return NULL; |
| 23689 | } |
| 23690 | goto done; |
| 23691 | } |
| 23692 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23693 | D(fprintf(stderr, "%*c%s _tmp_85[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23694 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); |
| 23695 | } |
| 23696 | _res = NULL; |
| 23697 | done: |
| 23698 | D(p->level--); |
| 23699 | return _res; |
| 23700 | } |
| 23701 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23702 | // _loop1_86: (',' star_expression) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23703 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23704 | _loop1_86_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23705 | { |
| 23706 | D(p->level++); |
| 23707 | if (p->error_indicator) { |
| 23708 | D(p->level--); |
| 23709 | return NULL; |
| 23710 | } |
| 23711 | void *_res = NULL; |
| 23712 | int _mark = p->mark; |
| 23713 | int _start_mark = p->mark; |
| 23714 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23715 | if (!_children) { |
| 23716 | p->error_indicator = 1; |
| 23717 | PyErr_NoMemory(); |
| 23718 | D(p->level--); |
| 23719 | return NULL; |
| 23720 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23721 | Py_ssize_t _children_capacity = 1; |
| 23722 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23723 | { // (',' star_expression) |
| 23724 | if (p->error_indicator) { |
| 23725 | D(p->level--); |
| 23726 | return NULL; |
| 23727 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23728 | D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); |
| 23729 | void *_tmp_166_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23730 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23731 | (_tmp_166_var = _tmp_166_rule(p)) // ',' star_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23732 | ) |
| 23733 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23734 | _res = _tmp_166_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23735 | if (_n == _children_capacity) { |
| 23736 | _children_capacity *= 2; |
| 23737 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23738 | if (!_new_children) { |
| 23739 | p->error_indicator = 1; |
| 23740 | PyErr_NoMemory(); |
| 23741 | D(p->level--); |
| 23742 | return NULL; |
| 23743 | } |
| 23744 | _children = _new_children; |
| 23745 | } |
| 23746 | _children[_n++] = _res; |
| 23747 | _mark = p->mark; |
| 23748 | } |
| 23749 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23750 | D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23751 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); |
| 23752 | } |
| 23753 | if (_n == 0 || p->error_indicator) { |
| 23754 | PyMem_Free(_children); |
| 23755 | D(p->level--); |
| 23756 | return NULL; |
| 23757 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23758 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23759 | if (!_seq) { |
| 23760 | PyMem_Free(_children); |
| 23761 | p->error_indicator = 1; |
| 23762 | PyErr_NoMemory(); |
| 23763 | D(p->level--); |
| 23764 | return NULL; |
| 23765 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23766 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23767 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23768 | _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23769 | D(p->level--); |
| 23770 | return _seq; |
| 23771 | } |
| 23772 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23773 | // _loop0_88: ',' star_named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23774 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23775 | _loop0_88_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23776 | { |
| 23777 | D(p->level++); |
| 23778 | if (p->error_indicator) { |
| 23779 | D(p->level--); |
| 23780 | return NULL; |
| 23781 | } |
| 23782 | void *_res = NULL; |
| 23783 | int _mark = p->mark; |
| 23784 | int _start_mark = p->mark; |
| 23785 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23786 | if (!_children) { |
| 23787 | p->error_indicator = 1; |
| 23788 | PyErr_NoMemory(); |
| 23789 | D(p->level--); |
| 23790 | return NULL; |
| 23791 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23792 | Py_ssize_t _children_capacity = 1; |
| 23793 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23794 | { // ',' star_named_expression |
| 23795 | if (p->error_indicator) { |
| 23796 | D(p->level--); |
| 23797 | return NULL; |
| 23798 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23799 | D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23800 | Token * _literal; |
| 23801 | expr_ty elem; |
| 23802 | while ( |
| 23803 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 23804 | && |
| 23805 | (elem = star_named_expression_rule(p)) // star_named_expression |
| 23806 | ) |
| 23807 | { |
| 23808 | _res = elem; |
| 23809 | if (_res == NULL && PyErr_Occurred()) { |
| 23810 | p->error_indicator = 1; |
| 23811 | PyMem_Free(_children); |
| 23812 | D(p->level--); |
| 23813 | return NULL; |
| 23814 | } |
| 23815 | if (_n == _children_capacity) { |
| 23816 | _children_capacity *= 2; |
| 23817 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23818 | if (!_new_children) { |
| 23819 | p->error_indicator = 1; |
| 23820 | PyErr_NoMemory(); |
| 23821 | D(p->level--); |
| 23822 | return NULL; |
| 23823 | } |
| 23824 | _children = _new_children; |
| 23825 | } |
| 23826 | _children[_n++] = _res; |
| 23827 | _mark = p->mark; |
| 23828 | } |
| 23829 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23830 | D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23831 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); |
| 23832 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23833 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23834 | if (!_seq) { |
| 23835 | PyMem_Free(_children); |
| 23836 | p->error_indicator = 1; |
| 23837 | PyErr_NoMemory(); |
| 23838 | D(p->level--); |
| 23839 | return NULL; |
| 23840 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23841 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23842 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23843 | _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23844 | D(p->level--); |
| 23845 | return _seq; |
| 23846 | } |
| 23847 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23848 | // _gather_87: star_named_expression _loop0_88 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23849 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23850 | _gather_87_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23851 | { |
| 23852 | D(p->level++); |
| 23853 | if (p->error_indicator) { |
| 23854 | D(p->level--); |
| 23855 | return NULL; |
| 23856 | } |
| 23857 | asdl_seq * _res = NULL; |
| 23858 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23859 | { // star_named_expression _loop0_88 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23860 | if (p->error_indicator) { |
| 23861 | D(p->level--); |
| 23862 | return NULL; |
| 23863 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23864 | D(fprintf(stderr, "%*c> _gather_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23865 | expr_ty elem; |
| 23866 | asdl_seq * seq; |
| 23867 | if ( |
| 23868 | (elem = star_named_expression_rule(p)) // star_named_expression |
| 23869 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23870 | (seq = _loop0_88_rule(p)) // _loop0_88 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23871 | ) |
| 23872 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23873 | D(fprintf(stderr, "%*c+ _gather_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23874 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 23875 | goto done; |
| 23876 | } |
| 23877 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23878 | D(fprintf(stderr, "%*c%s _gather_87[%d-%d]: %s failed!\n", p->level, ' ', |
| 23879 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_88")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23880 | } |
| 23881 | _res = NULL; |
| 23882 | done: |
| 23883 | D(p->level--); |
| 23884 | return _res; |
| 23885 | } |
| 23886 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23887 | // _loop1_89: (',' expression) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23888 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23889 | _loop1_89_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23890 | { |
| 23891 | D(p->level++); |
| 23892 | if (p->error_indicator) { |
| 23893 | D(p->level--); |
| 23894 | return NULL; |
| 23895 | } |
| 23896 | void *_res = NULL; |
| 23897 | int _mark = p->mark; |
| 23898 | int _start_mark = p->mark; |
| 23899 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23900 | if (!_children) { |
| 23901 | p->error_indicator = 1; |
| 23902 | PyErr_NoMemory(); |
| 23903 | D(p->level--); |
| 23904 | return NULL; |
| 23905 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23906 | Py_ssize_t _children_capacity = 1; |
| 23907 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23908 | { // (',' expression) |
| 23909 | if (p->error_indicator) { |
| 23910 | D(p->level--); |
| 23911 | return NULL; |
| 23912 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23913 | D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); |
| 23914 | void *_tmp_167_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23915 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23916 | (_tmp_167_var = _tmp_167_rule(p)) // ',' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23917 | ) |
| 23918 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23919 | _res = _tmp_167_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23920 | if (_n == _children_capacity) { |
| 23921 | _children_capacity *= 2; |
| 23922 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23923 | if (!_new_children) { |
| 23924 | p->error_indicator = 1; |
| 23925 | PyErr_NoMemory(); |
| 23926 | D(p->level--); |
| 23927 | return NULL; |
| 23928 | } |
| 23929 | _children = _new_children; |
| 23930 | } |
| 23931 | _children[_n++] = _res; |
| 23932 | _mark = p->mark; |
| 23933 | } |
| 23934 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23935 | D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23936 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); |
| 23937 | } |
| 23938 | if (_n == 0 || p->error_indicator) { |
| 23939 | PyMem_Free(_children); |
| 23940 | D(p->level--); |
| 23941 | return NULL; |
| 23942 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23943 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23944 | if (!_seq) { |
| 23945 | PyMem_Free(_children); |
| 23946 | p->error_indicator = 1; |
| 23947 | PyErr_NoMemory(); |
| 23948 | D(p->level--); |
| 23949 | return NULL; |
| 23950 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23951 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23952 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23953 | _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23954 | D(p->level--); |
| 23955 | return _seq; |
| 23956 | } |
| 23957 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23958 | // _loop0_90: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23959 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23960 | _loop0_90_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23961 | { |
| 23962 | D(p->level++); |
| 23963 | if (p->error_indicator) { |
| 23964 | D(p->level--); |
| 23965 | return NULL; |
| 23966 | } |
| 23967 | void *_res = NULL; |
| 23968 | int _mark = p->mark; |
| 23969 | int _start_mark = p->mark; |
| 23970 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23971 | if (!_children) { |
| 23972 | p->error_indicator = 1; |
| 23973 | PyErr_NoMemory(); |
| 23974 | D(p->level--); |
| 23975 | return NULL; |
| 23976 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23977 | Py_ssize_t _children_capacity = 1; |
| 23978 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23979 | { // lambda_param_no_default |
| 23980 | if (p->error_indicator) { |
| 23981 | D(p->level--); |
| 23982 | return NULL; |
| 23983 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23984 | D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23985 | arg_ty lambda_param_no_default_var; |
| 23986 | while ( |
| 23987 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 23988 | ) |
| 23989 | { |
| 23990 | _res = lambda_param_no_default_var; |
| 23991 | if (_n == _children_capacity) { |
| 23992 | _children_capacity *= 2; |
| 23993 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23994 | if (!_new_children) { |
| 23995 | p->error_indicator = 1; |
| 23996 | PyErr_NoMemory(); |
| 23997 | D(p->level--); |
| 23998 | return NULL; |
| 23999 | } |
| 24000 | _children = _new_children; |
| 24001 | } |
| 24002 | _children[_n++] = _res; |
| 24003 | _mark = p->mark; |
| 24004 | } |
| 24005 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24006 | D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24007 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24008 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24009 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24010 | if (!_seq) { |
| 24011 | PyMem_Free(_children); |
| 24012 | p->error_indicator = 1; |
| 24013 | PyErr_NoMemory(); |
| 24014 | D(p->level--); |
| 24015 | return NULL; |
| 24016 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24017 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24018 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24019 | _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24020 | D(p->level--); |
| 24021 | return _seq; |
| 24022 | } |
| 24023 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24024 | // _loop0_91: lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24025 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24026 | _loop0_91_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24027 | { |
| 24028 | D(p->level++); |
| 24029 | if (p->error_indicator) { |
| 24030 | D(p->level--); |
| 24031 | return NULL; |
| 24032 | } |
| 24033 | void *_res = NULL; |
| 24034 | int _mark = p->mark; |
| 24035 | int _start_mark = p->mark; |
| 24036 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24037 | if (!_children) { |
| 24038 | p->error_indicator = 1; |
| 24039 | PyErr_NoMemory(); |
| 24040 | D(p->level--); |
| 24041 | return NULL; |
| 24042 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24043 | Py_ssize_t _children_capacity = 1; |
| 24044 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24045 | { // lambda_param_with_default |
| 24046 | if (p->error_indicator) { |
| 24047 | D(p->level--); |
| 24048 | return NULL; |
| 24049 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24050 | D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24051 | NameDefaultPair* lambda_param_with_default_var; |
| 24052 | while ( |
| 24053 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 24054 | ) |
| 24055 | { |
| 24056 | _res = lambda_param_with_default_var; |
| 24057 | if (_n == _children_capacity) { |
| 24058 | _children_capacity *= 2; |
| 24059 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24060 | if (!_new_children) { |
| 24061 | p->error_indicator = 1; |
| 24062 | PyErr_NoMemory(); |
| 24063 | D(p->level--); |
| 24064 | return NULL; |
| 24065 | } |
| 24066 | _children = _new_children; |
| 24067 | } |
| 24068 | _children[_n++] = _res; |
| 24069 | _mark = p->mark; |
| 24070 | } |
| 24071 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24072 | D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24073 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 24074 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24075 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24076 | if (!_seq) { |
| 24077 | PyMem_Free(_children); |
| 24078 | p->error_indicator = 1; |
| 24079 | PyErr_NoMemory(); |
| 24080 | D(p->level--); |
| 24081 | return NULL; |
| 24082 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24083 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24084 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24085 | _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24086 | D(p->level--); |
| 24087 | return _seq; |
| 24088 | } |
| 24089 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24090 | // _loop0_92: lambda_param_with_default |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24091 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24092 | _loop0_92_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24093 | { |
| 24094 | D(p->level++); |
| 24095 | if (p->error_indicator) { |
| 24096 | D(p->level--); |
| 24097 | return NULL; |
| 24098 | } |
| 24099 | void *_res = NULL; |
| 24100 | int _mark = p->mark; |
| 24101 | int _start_mark = p->mark; |
| 24102 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24103 | if (!_children) { |
| 24104 | p->error_indicator = 1; |
| 24105 | PyErr_NoMemory(); |
| 24106 | D(p->level--); |
| 24107 | return NULL; |
| 24108 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24109 | Py_ssize_t _children_capacity = 1; |
| 24110 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24111 | { // lambda_param_with_default |
| 24112 | if (p->error_indicator) { |
| 24113 | D(p->level--); |
| 24114 | return NULL; |
| 24115 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24116 | D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24117 | NameDefaultPair* lambda_param_with_default_var; |
| 24118 | while ( |
| 24119 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 24120 | ) |
| 24121 | { |
| 24122 | _res = lambda_param_with_default_var; |
| 24123 | if (_n == _children_capacity) { |
| 24124 | _children_capacity *= 2; |
| 24125 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24126 | if (!_new_children) { |
| 24127 | p->error_indicator = 1; |
| 24128 | PyErr_NoMemory(); |
| 24129 | D(p->level--); |
| 24130 | return NULL; |
| 24131 | } |
| 24132 | _children = _new_children; |
| 24133 | } |
| 24134 | _children[_n++] = _res; |
| 24135 | _mark = p->mark; |
| 24136 | } |
| 24137 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24138 | D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24139 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 24140 | } |
| 24141 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 24142 | if (!_seq) { |
| 24143 | PyMem_Free(_children); |
| 24144 | p->error_indicator = 1; |
| 24145 | PyErr_NoMemory(); |
| 24146 | D(p->level--); |
| 24147 | return NULL; |
| 24148 | } |
| 24149 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 24150 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24151 | _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24152 | D(p->level--); |
| 24153 | return _seq; |
| 24154 | } |
| 24155 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24156 | // _loop1_93: lambda_param_no_default |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24157 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24158 | _loop1_93_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24159 | { |
| 24160 | D(p->level++); |
| 24161 | if (p->error_indicator) { |
| 24162 | D(p->level--); |
| 24163 | return NULL; |
| 24164 | } |
| 24165 | void *_res = NULL; |
| 24166 | int _mark = p->mark; |
| 24167 | int _start_mark = p->mark; |
| 24168 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24169 | if (!_children) { |
| 24170 | p->error_indicator = 1; |
| 24171 | PyErr_NoMemory(); |
| 24172 | D(p->level--); |
| 24173 | return NULL; |
| 24174 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24175 | Py_ssize_t _children_capacity = 1; |
| 24176 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24177 | { // lambda_param_no_default |
| 24178 | if (p->error_indicator) { |
| 24179 | D(p->level--); |
| 24180 | return NULL; |
| 24181 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24182 | D(fprintf(stderr, "%*c> _loop1_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24183 | arg_ty lambda_param_no_default_var; |
| 24184 | while ( |
| 24185 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 24186 | ) |
| 24187 | { |
| 24188 | _res = lambda_param_no_default_var; |
| 24189 | if (_n == _children_capacity) { |
| 24190 | _children_capacity *= 2; |
| 24191 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24192 | if (!_new_children) { |
| 24193 | p->error_indicator = 1; |
| 24194 | PyErr_NoMemory(); |
| 24195 | D(p->level--); |
| 24196 | return NULL; |
| 24197 | } |
| 24198 | _children = _new_children; |
| 24199 | } |
| 24200 | _children[_n++] = _res; |
| 24201 | _mark = p->mark; |
| 24202 | } |
| 24203 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24204 | D(fprintf(stderr, "%*c%s _loop1_93[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24205 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 24206 | } |
| 24207 | if (_n == 0 || p->error_indicator) { |
| 24208 | PyMem_Free(_children); |
| 24209 | D(p->level--); |
| 24210 | return NULL; |
| 24211 | } |
| 24212 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 24213 | if (!_seq) { |
| 24214 | PyMem_Free(_children); |
| 24215 | p->error_indicator = 1; |
| 24216 | PyErr_NoMemory(); |
| 24217 | D(p->level--); |
| 24218 | return NULL; |
| 24219 | } |
| 24220 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 24221 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24222 | _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24223 | D(p->level--); |
| 24224 | return _seq; |
| 24225 | } |
| 24226 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24227 | // _loop0_94: lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24228 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24229 | _loop0_94_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24230 | { |
| 24231 | D(p->level++); |
| 24232 | if (p->error_indicator) { |
| 24233 | D(p->level--); |
| 24234 | return NULL; |
| 24235 | } |
| 24236 | void *_res = NULL; |
| 24237 | int _mark = p->mark; |
| 24238 | int _start_mark = p->mark; |
| 24239 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24240 | if (!_children) { |
| 24241 | p->error_indicator = 1; |
| 24242 | PyErr_NoMemory(); |
| 24243 | D(p->level--); |
| 24244 | return NULL; |
| 24245 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24246 | Py_ssize_t _children_capacity = 1; |
| 24247 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24248 | { // lambda_param_with_default |
| 24249 | if (p->error_indicator) { |
| 24250 | D(p->level--); |
| 24251 | return NULL; |
| 24252 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24253 | D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24254 | NameDefaultPair* lambda_param_with_default_var; |
| 24255 | while ( |
| 24256 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 24257 | ) |
| 24258 | { |
| 24259 | _res = lambda_param_with_default_var; |
| 24260 | if (_n == _children_capacity) { |
| 24261 | _children_capacity *= 2; |
| 24262 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24263 | if (!_new_children) { |
| 24264 | p->error_indicator = 1; |
| 24265 | PyErr_NoMemory(); |
| 24266 | D(p->level--); |
| 24267 | return NULL; |
| 24268 | } |
| 24269 | _children = _new_children; |
| 24270 | } |
| 24271 | _children[_n++] = _res; |
| 24272 | _mark = p->mark; |
| 24273 | } |
| 24274 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24275 | D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24276 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 24277 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24278 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24279 | if (!_seq) { |
| 24280 | PyMem_Free(_children); |
| 24281 | p->error_indicator = 1; |
| 24282 | PyErr_NoMemory(); |
| 24283 | D(p->level--); |
| 24284 | return NULL; |
| 24285 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24286 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24287 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24288 | _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24289 | D(p->level--); |
| 24290 | return _seq; |
| 24291 | } |
| 24292 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24293 | // _loop1_95: lambda_param_with_default |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24294 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24295 | _loop1_95_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24296 | { |
| 24297 | D(p->level++); |
| 24298 | if (p->error_indicator) { |
| 24299 | D(p->level--); |
| 24300 | return NULL; |
| 24301 | } |
| 24302 | void *_res = NULL; |
| 24303 | int _mark = p->mark; |
| 24304 | int _start_mark = p->mark; |
| 24305 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24306 | if (!_children) { |
| 24307 | p->error_indicator = 1; |
| 24308 | PyErr_NoMemory(); |
| 24309 | D(p->level--); |
| 24310 | return NULL; |
| 24311 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24312 | Py_ssize_t _children_capacity = 1; |
| 24313 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24314 | { // lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24315 | if (p->error_indicator) { |
| 24316 | D(p->level--); |
| 24317 | return NULL; |
| 24318 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24319 | D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24320 | NameDefaultPair* lambda_param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24321 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24322 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24323 | ) |
| 24324 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24325 | _res = lambda_param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24326 | if (_n == _children_capacity) { |
| 24327 | _children_capacity *= 2; |
| 24328 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24329 | if (!_new_children) { |
| 24330 | p->error_indicator = 1; |
| 24331 | PyErr_NoMemory(); |
| 24332 | D(p->level--); |
| 24333 | return NULL; |
| 24334 | } |
| 24335 | _children = _new_children; |
| 24336 | } |
| 24337 | _children[_n++] = _res; |
| 24338 | _mark = p->mark; |
| 24339 | } |
| 24340 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24341 | D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24342 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24343 | } |
| 24344 | if (_n == 0 || p->error_indicator) { |
| 24345 | PyMem_Free(_children); |
| 24346 | D(p->level--); |
| 24347 | return NULL; |
| 24348 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24349 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24350 | if (!_seq) { |
| 24351 | PyMem_Free(_children); |
| 24352 | p->error_indicator = 1; |
| 24353 | PyErr_NoMemory(); |
| 24354 | D(p->level--); |
| 24355 | return NULL; |
| 24356 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24357 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24358 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24359 | _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24360 | D(p->level--); |
| 24361 | return _seq; |
| 24362 | } |
| 24363 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24364 | // _loop1_96: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24365 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24366 | _loop1_96_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24367 | { |
| 24368 | D(p->level++); |
| 24369 | if (p->error_indicator) { |
| 24370 | D(p->level--); |
| 24371 | return NULL; |
| 24372 | } |
| 24373 | void *_res = NULL; |
| 24374 | int _mark = p->mark; |
| 24375 | int _start_mark = p->mark; |
| 24376 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24377 | if (!_children) { |
| 24378 | p->error_indicator = 1; |
| 24379 | PyErr_NoMemory(); |
| 24380 | D(p->level--); |
| 24381 | return NULL; |
| 24382 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24383 | Py_ssize_t _children_capacity = 1; |
| 24384 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24385 | { // lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24386 | if (p->error_indicator) { |
| 24387 | D(p->level--); |
| 24388 | return NULL; |
| 24389 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24390 | D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24391 | arg_ty lambda_param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24392 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24393 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24394 | ) |
| 24395 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24396 | _res = lambda_param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24397 | if (_n == _children_capacity) { |
| 24398 | _children_capacity *= 2; |
| 24399 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24400 | if (!_new_children) { |
| 24401 | p->error_indicator = 1; |
| 24402 | PyErr_NoMemory(); |
| 24403 | D(p->level--); |
| 24404 | return NULL; |
| 24405 | } |
| 24406 | _children = _new_children; |
| 24407 | } |
| 24408 | _children[_n++] = _res; |
| 24409 | _mark = p->mark; |
| 24410 | } |
| 24411 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24412 | D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24413 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 24414 | } |
| 24415 | if (_n == 0 || p->error_indicator) { |
| 24416 | PyMem_Free(_children); |
| 24417 | D(p->level--); |
| 24418 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24419 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24420 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24421 | if (!_seq) { |
| 24422 | PyMem_Free(_children); |
| 24423 | p->error_indicator = 1; |
| 24424 | PyErr_NoMemory(); |
| 24425 | D(p->level--); |
| 24426 | return NULL; |
| 24427 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24428 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24429 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24430 | _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24431 | D(p->level--); |
| 24432 | return _seq; |
| 24433 | } |
| 24434 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24435 | // _loop1_97: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24436 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24437 | _loop1_97_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24438 | { |
| 24439 | D(p->level++); |
| 24440 | if (p->error_indicator) { |
| 24441 | D(p->level--); |
| 24442 | return NULL; |
| 24443 | } |
| 24444 | void *_res = NULL; |
| 24445 | int _mark = p->mark; |
| 24446 | int _start_mark = p->mark; |
| 24447 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24448 | if (!_children) { |
| 24449 | p->error_indicator = 1; |
| 24450 | PyErr_NoMemory(); |
| 24451 | D(p->level--); |
| 24452 | return NULL; |
| 24453 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24454 | Py_ssize_t _children_capacity = 1; |
| 24455 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24456 | { // lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24457 | if (p->error_indicator) { |
| 24458 | D(p->level--); |
| 24459 | return NULL; |
| 24460 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24461 | D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24462 | arg_ty lambda_param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24463 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24464 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24465 | ) |
| 24466 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24467 | _res = lambda_param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24468 | if (_n == _children_capacity) { |
| 24469 | _children_capacity *= 2; |
| 24470 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24471 | if (!_new_children) { |
| 24472 | p->error_indicator = 1; |
| 24473 | PyErr_NoMemory(); |
| 24474 | D(p->level--); |
| 24475 | return NULL; |
| 24476 | } |
| 24477 | _children = _new_children; |
| 24478 | } |
| 24479 | _children[_n++] = _res; |
| 24480 | _mark = p->mark; |
| 24481 | } |
| 24482 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24483 | D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24484 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24485 | } |
| 24486 | if (_n == 0 || p->error_indicator) { |
| 24487 | PyMem_Free(_children); |
| 24488 | D(p->level--); |
| 24489 | return NULL; |
| 24490 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24491 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24492 | if (!_seq) { |
| 24493 | PyMem_Free(_children); |
| 24494 | p->error_indicator = 1; |
| 24495 | PyErr_NoMemory(); |
| 24496 | D(p->level--); |
| 24497 | return NULL; |
| 24498 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24499 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24500 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24501 | _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24502 | D(p->level--); |
| 24503 | return _seq; |
| 24504 | } |
| 24505 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24506 | // _loop0_98: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24507 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24508 | _loop0_98_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24509 | { |
| 24510 | D(p->level++); |
| 24511 | if (p->error_indicator) { |
| 24512 | D(p->level--); |
| 24513 | return NULL; |
| 24514 | } |
| 24515 | void *_res = NULL; |
| 24516 | int _mark = p->mark; |
| 24517 | int _start_mark = p->mark; |
| 24518 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24519 | if (!_children) { |
| 24520 | p->error_indicator = 1; |
| 24521 | PyErr_NoMemory(); |
| 24522 | D(p->level--); |
| 24523 | return NULL; |
| 24524 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24525 | Py_ssize_t _children_capacity = 1; |
| 24526 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24527 | { // lambda_param_no_default |
| 24528 | if (p->error_indicator) { |
| 24529 | D(p->level--); |
| 24530 | return NULL; |
| 24531 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24532 | D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24533 | arg_ty lambda_param_no_default_var; |
| 24534 | while ( |
| 24535 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 24536 | ) |
| 24537 | { |
| 24538 | _res = lambda_param_no_default_var; |
| 24539 | if (_n == _children_capacity) { |
| 24540 | _children_capacity *= 2; |
| 24541 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24542 | if (!_new_children) { |
| 24543 | p->error_indicator = 1; |
| 24544 | PyErr_NoMemory(); |
| 24545 | D(p->level--); |
| 24546 | return NULL; |
| 24547 | } |
| 24548 | _children = _new_children; |
| 24549 | } |
| 24550 | _children[_n++] = _res; |
| 24551 | _mark = p->mark; |
| 24552 | } |
| 24553 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24554 | D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24555 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 24556 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24557 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24558 | if (!_seq) { |
| 24559 | PyMem_Free(_children); |
| 24560 | p->error_indicator = 1; |
| 24561 | PyErr_NoMemory(); |
| 24562 | D(p->level--); |
| 24563 | return NULL; |
| 24564 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24565 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24566 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24567 | _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24568 | D(p->level--); |
| 24569 | return _seq; |
| 24570 | } |
| 24571 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24572 | // _loop1_99: lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24573 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24574 | _loop1_99_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24575 | { |
| 24576 | D(p->level++); |
| 24577 | if (p->error_indicator) { |
| 24578 | D(p->level--); |
| 24579 | return NULL; |
| 24580 | } |
| 24581 | void *_res = NULL; |
| 24582 | int _mark = p->mark; |
| 24583 | int _start_mark = p->mark; |
| 24584 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24585 | if (!_children) { |
| 24586 | p->error_indicator = 1; |
| 24587 | PyErr_NoMemory(); |
| 24588 | D(p->level--); |
| 24589 | return NULL; |
| 24590 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24591 | Py_ssize_t _children_capacity = 1; |
| 24592 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24593 | { // lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24594 | if (p->error_indicator) { |
| 24595 | D(p->level--); |
| 24596 | return NULL; |
| 24597 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24598 | D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24599 | NameDefaultPair* lambda_param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24600 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24601 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24602 | ) |
| 24603 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24604 | _res = lambda_param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24605 | if (_n == _children_capacity) { |
| 24606 | _children_capacity *= 2; |
| 24607 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24608 | if (!_new_children) { |
| 24609 | p->error_indicator = 1; |
| 24610 | PyErr_NoMemory(); |
| 24611 | D(p->level--); |
| 24612 | return NULL; |
| 24613 | } |
| 24614 | _children = _new_children; |
| 24615 | } |
| 24616 | _children[_n++] = _res; |
| 24617 | _mark = p->mark; |
| 24618 | } |
| 24619 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24620 | D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24621 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24622 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24623 | if (_n == 0 || p->error_indicator) { |
| 24624 | PyMem_Free(_children); |
| 24625 | D(p->level--); |
| 24626 | return NULL; |
| 24627 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24628 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24629 | if (!_seq) { |
| 24630 | PyMem_Free(_children); |
| 24631 | p->error_indicator = 1; |
| 24632 | PyErr_NoMemory(); |
| 24633 | D(p->level--); |
| 24634 | return NULL; |
| 24635 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24636 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24637 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24638 | _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24639 | D(p->level--); |
| 24640 | return _seq; |
| 24641 | } |
| 24642 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24643 | // _loop0_100: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24644 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24645 | _loop0_100_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24646 | { |
| 24647 | D(p->level++); |
| 24648 | if (p->error_indicator) { |
| 24649 | D(p->level--); |
| 24650 | return NULL; |
| 24651 | } |
| 24652 | void *_res = NULL; |
| 24653 | int _mark = p->mark; |
| 24654 | int _start_mark = p->mark; |
| 24655 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24656 | if (!_children) { |
| 24657 | p->error_indicator = 1; |
| 24658 | PyErr_NoMemory(); |
| 24659 | D(p->level--); |
| 24660 | return NULL; |
| 24661 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24662 | Py_ssize_t _children_capacity = 1; |
| 24663 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24664 | { // lambda_param_no_default |
| 24665 | if (p->error_indicator) { |
| 24666 | D(p->level--); |
| 24667 | return NULL; |
| 24668 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24669 | D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24670 | arg_ty lambda_param_no_default_var; |
| 24671 | while ( |
| 24672 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 24673 | ) |
| 24674 | { |
| 24675 | _res = lambda_param_no_default_var; |
| 24676 | if (_n == _children_capacity) { |
| 24677 | _children_capacity *= 2; |
| 24678 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24679 | if (!_new_children) { |
| 24680 | p->error_indicator = 1; |
| 24681 | PyErr_NoMemory(); |
| 24682 | D(p->level--); |
| 24683 | return NULL; |
| 24684 | } |
| 24685 | _children = _new_children; |
| 24686 | } |
| 24687 | _children[_n++] = _res; |
| 24688 | _mark = p->mark; |
| 24689 | } |
| 24690 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24691 | D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24692 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 24693 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24694 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24695 | if (!_seq) { |
| 24696 | PyMem_Free(_children); |
| 24697 | p->error_indicator = 1; |
| 24698 | PyErr_NoMemory(); |
| 24699 | D(p->level--); |
| 24700 | return NULL; |
| 24701 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24702 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24703 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24704 | _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24705 | D(p->level--); |
| 24706 | return _seq; |
| 24707 | } |
| 24708 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24709 | // _loop1_101: lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24710 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24711 | _loop1_101_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24712 | { |
| 24713 | D(p->level++); |
| 24714 | if (p->error_indicator) { |
| 24715 | D(p->level--); |
| 24716 | return NULL; |
| 24717 | } |
| 24718 | void *_res = NULL; |
| 24719 | int _mark = p->mark; |
| 24720 | int _start_mark = p->mark; |
| 24721 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24722 | if (!_children) { |
| 24723 | p->error_indicator = 1; |
| 24724 | PyErr_NoMemory(); |
| 24725 | D(p->level--); |
| 24726 | return NULL; |
| 24727 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24728 | Py_ssize_t _children_capacity = 1; |
| 24729 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24730 | { // lambda_param_with_default |
| 24731 | if (p->error_indicator) { |
| 24732 | D(p->level--); |
| 24733 | return NULL; |
| 24734 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24735 | D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24736 | NameDefaultPair* lambda_param_with_default_var; |
| 24737 | while ( |
| 24738 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 24739 | ) |
| 24740 | { |
| 24741 | _res = lambda_param_with_default_var; |
| 24742 | if (_n == _children_capacity) { |
| 24743 | _children_capacity *= 2; |
| 24744 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24745 | if (!_new_children) { |
| 24746 | p->error_indicator = 1; |
| 24747 | PyErr_NoMemory(); |
| 24748 | D(p->level--); |
| 24749 | return NULL; |
| 24750 | } |
| 24751 | _children = _new_children; |
| 24752 | } |
| 24753 | _children[_n++] = _res; |
| 24754 | _mark = p->mark; |
| 24755 | } |
| 24756 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24757 | D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24758 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 24759 | } |
| 24760 | if (_n == 0 || p->error_indicator) { |
| 24761 | PyMem_Free(_children); |
| 24762 | D(p->level--); |
| 24763 | return NULL; |
| 24764 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24765 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24766 | if (!_seq) { |
| 24767 | PyMem_Free(_children); |
| 24768 | p->error_indicator = 1; |
| 24769 | PyErr_NoMemory(); |
| 24770 | D(p->level--); |
| 24771 | return NULL; |
| 24772 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24773 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24774 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24775 | _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24776 | D(p->level--); |
| 24777 | return _seq; |
| 24778 | } |
| 24779 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24780 | // _loop0_102: lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24781 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24782 | _loop0_102_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24783 | { |
| 24784 | D(p->level++); |
| 24785 | if (p->error_indicator) { |
| 24786 | D(p->level--); |
| 24787 | return NULL; |
| 24788 | } |
| 24789 | void *_res = NULL; |
| 24790 | int _mark = p->mark; |
| 24791 | int _start_mark = p->mark; |
| 24792 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24793 | if (!_children) { |
| 24794 | p->error_indicator = 1; |
| 24795 | PyErr_NoMemory(); |
| 24796 | D(p->level--); |
| 24797 | return NULL; |
| 24798 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24799 | Py_ssize_t _children_capacity = 1; |
| 24800 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24801 | { // lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24802 | if (p->error_indicator) { |
| 24803 | D(p->level--); |
| 24804 | return NULL; |
| 24805 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24806 | D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24807 | NameDefaultPair* lambda_param_maybe_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24808 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24809 | (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24810 | ) |
| 24811 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24812 | _res = lambda_param_maybe_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24813 | if (_n == _children_capacity) { |
| 24814 | _children_capacity *= 2; |
| 24815 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24816 | if (!_new_children) { |
| 24817 | p->error_indicator = 1; |
| 24818 | PyErr_NoMemory(); |
| 24819 | D(p->level--); |
| 24820 | return NULL; |
| 24821 | } |
| 24822 | _children = _new_children; |
| 24823 | } |
| 24824 | _children[_n++] = _res; |
| 24825 | _mark = p->mark; |
| 24826 | } |
| 24827 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24828 | D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24829 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24830 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24831 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24832 | if (!_seq) { |
| 24833 | PyMem_Free(_children); |
| 24834 | p->error_indicator = 1; |
| 24835 | PyErr_NoMemory(); |
| 24836 | D(p->level--); |
| 24837 | return NULL; |
| 24838 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24839 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24840 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24841 | _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24842 | D(p->level--); |
| 24843 | return _seq; |
| 24844 | } |
| 24845 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24846 | // _loop1_103: lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24847 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24848 | _loop1_103_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24849 | { |
| 24850 | D(p->level++); |
| 24851 | if (p->error_indicator) { |
| 24852 | D(p->level--); |
| 24853 | return NULL; |
| 24854 | } |
| 24855 | void *_res = NULL; |
| 24856 | int _mark = p->mark; |
| 24857 | int _start_mark = p->mark; |
| 24858 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24859 | if (!_children) { |
| 24860 | p->error_indicator = 1; |
| 24861 | PyErr_NoMemory(); |
| 24862 | D(p->level--); |
| 24863 | return NULL; |
| 24864 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24865 | Py_ssize_t _children_capacity = 1; |
| 24866 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24867 | { // lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24868 | if (p->error_indicator) { |
| 24869 | D(p->level--); |
| 24870 | return NULL; |
| 24871 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24872 | D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24873 | NameDefaultPair* lambda_param_maybe_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24874 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24875 | (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24876 | ) |
| 24877 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24878 | _res = lambda_param_maybe_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24879 | if (_n == _children_capacity) { |
| 24880 | _children_capacity *= 2; |
| 24881 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24882 | if (!_new_children) { |
| 24883 | p->error_indicator = 1; |
| 24884 | PyErr_NoMemory(); |
| 24885 | D(p->level--); |
| 24886 | return NULL; |
| 24887 | } |
| 24888 | _children = _new_children; |
| 24889 | } |
| 24890 | _children[_n++] = _res; |
| 24891 | _mark = p->mark; |
| 24892 | } |
| 24893 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24894 | D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24895 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24896 | } |
| 24897 | if (_n == 0 || p->error_indicator) { |
| 24898 | PyMem_Free(_children); |
| 24899 | D(p->level--); |
| 24900 | return NULL; |
| 24901 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24902 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24903 | if (!_seq) { |
| 24904 | PyMem_Free(_children); |
| 24905 | p->error_indicator = 1; |
| 24906 | PyErr_NoMemory(); |
| 24907 | D(p->level--); |
| 24908 | return NULL; |
| 24909 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24910 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24911 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24912 | _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24913 | D(p->level--); |
| 24914 | return _seq; |
| 24915 | } |
| 24916 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24917 | // _loop1_104: ('or' conjunction) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24918 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24919 | _loop1_104_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24920 | { |
| 24921 | D(p->level++); |
| 24922 | if (p->error_indicator) { |
| 24923 | D(p->level--); |
| 24924 | return NULL; |
| 24925 | } |
| 24926 | void *_res = NULL; |
| 24927 | int _mark = p->mark; |
| 24928 | int _start_mark = p->mark; |
| 24929 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24930 | if (!_children) { |
| 24931 | p->error_indicator = 1; |
| 24932 | PyErr_NoMemory(); |
| 24933 | D(p->level--); |
| 24934 | return NULL; |
| 24935 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24936 | Py_ssize_t _children_capacity = 1; |
| 24937 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24938 | { // ('or' conjunction) |
| 24939 | if (p->error_indicator) { |
| 24940 | D(p->level--); |
| 24941 | return NULL; |
| 24942 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24943 | D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); |
| 24944 | void *_tmp_168_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24945 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24946 | (_tmp_168_var = _tmp_168_rule(p)) // 'or' conjunction |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24947 | ) |
| 24948 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24949 | _res = _tmp_168_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24950 | if (_n == _children_capacity) { |
| 24951 | _children_capacity *= 2; |
| 24952 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24953 | if (!_new_children) { |
| 24954 | p->error_indicator = 1; |
| 24955 | PyErr_NoMemory(); |
| 24956 | D(p->level--); |
| 24957 | return NULL; |
| 24958 | } |
| 24959 | _children = _new_children; |
| 24960 | } |
| 24961 | _children[_n++] = _res; |
| 24962 | _mark = p->mark; |
| 24963 | } |
| 24964 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24965 | D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24966 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); |
| 24967 | } |
| 24968 | if (_n == 0 || p->error_indicator) { |
| 24969 | PyMem_Free(_children); |
| 24970 | D(p->level--); |
| 24971 | return NULL; |
| 24972 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24973 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24974 | if (!_seq) { |
| 24975 | PyMem_Free(_children); |
| 24976 | p->error_indicator = 1; |
| 24977 | PyErr_NoMemory(); |
| 24978 | D(p->level--); |
| 24979 | return NULL; |
| 24980 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24981 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24982 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24983 | _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24984 | D(p->level--); |
| 24985 | return _seq; |
| 24986 | } |
| 24987 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24988 | // _loop1_105: ('and' inversion) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24989 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24990 | _loop1_105_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24991 | { |
| 24992 | D(p->level++); |
| 24993 | if (p->error_indicator) { |
| 24994 | D(p->level--); |
| 24995 | return NULL; |
| 24996 | } |
| 24997 | void *_res = NULL; |
| 24998 | int _mark = p->mark; |
| 24999 | int _start_mark = p->mark; |
| 25000 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25001 | if (!_children) { |
| 25002 | p->error_indicator = 1; |
| 25003 | PyErr_NoMemory(); |
| 25004 | D(p->level--); |
| 25005 | return NULL; |
| 25006 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25007 | Py_ssize_t _children_capacity = 1; |
| 25008 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25009 | { // ('and' inversion) |
| 25010 | if (p->error_indicator) { |
| 25011 | D(p->level--); |
| 25012 | return NULL; |
| 25013 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25014 | D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); |
| 25015 | void *_tmp_169_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25016 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25017 | (_tmp_169_var = _tmp_169_rule(p)) // 'and' inversion |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25018 | ) |
| 25019 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25020 | _res = _tmp_169_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25021 | if (_n == _children_capacity) { |
| 25022 | _children_capacity *= 2; |
| 25023 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25024 | if (!_new_children) { |
| 25025 | p->error_indicator = 1; |
| 25026 | PyErr_NoMemory(); |
| 25027 | D(p->level--); |
| 25028 | return NULL; |
| 25029 | } |
| 25030 | _children = _new_children; |
| 25031 | } |
| 25032 | _children[_n++] = _res; |
| 25033 | _mark = p->mark; |
| 25034 | } |
| 25035 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25036 | D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25037 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); |
| 25038 | } |
| 25039 | if (_n == 0 || p->error_indicator) { |
| 25040 | PyMem_Free(_children); |
| 25041 | D(p->level--); |
| 25042 | return NULL; |
| 25043 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25044 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25045 | if (!_seq) { |
| 25046 | PyMem_Free(_children); |
| 25047 | p->error_indicator = 1; |
| 25048 | PyErr_NoMemory(); |
| 25049 | D(p->level--); |
| 25050 | return NULL; |
| 25051 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25052 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25053 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25054 | _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25055 | D(p->level--); |
| 25056 | return _seq; |
| 25057 | } |
| 25058 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25059 | // _loop1_106: compare_op_bitwise_or_pair |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25060 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25061 | _loop1_106_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25062 | { |
| 25063 | D(p->level++); |
| 25064 | if (p->error_indicator) { |
| 25065 | D(p->level--); |
| 25066 | return NULL; |
| 25067 | } |
| 25068 | void *_res = NULL; |
| 25069 | int _mark = p->mark; |
| 25070 | int _start_mark = p->mark; |
| 25071 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25072 | if (!_children) { |
| 25073 | p->error_indicator = 1; |
| 25074 | PyErr_NoMemory(); |
| 25075 | D(p->level--); |
| 25076 | return NULL; |
| 25077 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25078 | Py_ssize_t _children_capacity = 1; |
| 25079 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25080 | { // compare_op_bitwise_or_pair |
| 25081 | if (p->error_indicator) { |
| 25082 | D(p->level--); |
| 25083 | return NULL; |
| 25084 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25085 | D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25086 | CmpopExprPair* compare_op_bitwise_or_pair_var; |
| 25087 | while ( |
| 25088 | (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair |
| 25089 | ) |
| 25090 | { |
| 25091 | _res = compare_op_bitwise_or_pair_var; |
| 25092 | if (_n == _children_capacity) { |
| 25093 | _children_capacity *= 2; |
| 25094 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25095 | if (!_new_children) { |
| 25096 | p->error_indicator = 1; |
| 25097 | PyErr_NoMemory(); |
| 25098 | D(p->level--); |
| 25099 | return NULL; |
| 25100 | } |
| 25101 | _children = _new_children; |
| 25102 | } |
| 25103 | _children[_n++] = _res; |
| 25104 | _mark = p->mark; |
| 25105 | } |
| 25106 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25107 | D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25108 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); |
| 25109 | } |
| 25110 | if (_n == 0 || p->error_indicator) { |
| 25111 | PyMem_Free(_children); |
| 25112 | D(p->level--); |
| 25113 | return NULL; |
| 25114 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25115 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25116 | if (!_seq) { |
| 25117 | PyMem_Free(_children); |
| 25118 | p->error_indicator = 1; |
| 25119 | PyErr_NoMemory(); |
| 25120 | D(p->level--); |
| 25121 | return NULL; |
| 25122 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25123 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25124 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25125 | _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25126 | D(p->level--); |
| 25127 | return _seq; |
| 25128 | } |
| 25129 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25130 | // _tmp_107: '!=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25131 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25132 | _tmp_107_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25133 | { |
| 25134 | D(p->level++); |
| 25135 | if (p->error_indicator) { |
| 25136 | D(p->level--); |
| 25137 | return NULL; |
| 25138 | } |
| 25139 | void * _res = NULL; |
| 25140 | int _mark = p->mark; |
| 25141 | { // '!=' |
| 25142 | if (p->error_indicator) { |
| 25143 | D(p->level--); |
| 25144 | return NULL; |
| 25145 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25146 | D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25147 | Token * tok; |
| 25148 | if ( |
| 25149 | (tok = _PyPegen_expect_token(p, 28)) // token='!=' |
| 25150 | ) |
| 25151 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25152 | D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); |
Pablo Galindo | 06f8c33 | 2020-10-30 23:48:42 +0000 | [diff] [blame] | 25153 | _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25154 | if (_res == NULL && PyErr_Occurred()) { |
| 25155 | p->error_indicator = 1; |
| 25156 | D(p->level--); |
| 25157 | return NULL; |
| 25158 | } |
| 25159 | goto done; |
| 25160 | } |
| 25161 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25162 | D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25163 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); |
| 25164 | } |
| 25165 | _res = NULL; |
| 25166 | done: |
| 25167 | D(p->level--); |
| 25168 | return _res; |
| 25169 | } |
| 25170 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25171 | // _loop0_109: ',' slice |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25172 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25173 | _loop0_109_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25174 | { |
| 25175 | D(p->level++); |
| 25176 | if (p->error_indicator) { |
| 25177 | D(p->level--); |
| 25178 | return NULL; |
| 25179 | } |
| 25180 | void *_res = NULL; |
| 25181 | int _mark = p->mark; |
| 25182 | int _start_mark = p->mark; |
| 25183 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25184 | if (!_children) { |
| 25185 | p->error_indicator = 1; |
| 25186 | PyErr_NoMemory(); |
| 25187 | D(p->level--); |
| 25188 | return NULL; |
| 25189 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25190 | Py_ssize_t _children_capacity = 1; |
| 25191 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25192 | { // ',' slice |
| 25193 | if (p->error_indicator) { |
| 25194 | D(p->level--); |
| 25195 | return NULL; |
| 25196 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25197 | D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25198 | Token * _literal; |
| 25199 | expr_ty elem; |
| 25200 | while ( |
| 25201 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 25202 | && |
| 25203 | (elem = slice_rule(p)) // slice |
| 25204 | ) |
| 25205 | { |
| 25206 | _res = elem; |
| 25207 | if (_res == NULL && PyErr_Occurred()) { |
| 25208 | p->error_indicator = 1; |
| 25209 | PyMem_Free(_children); |
| 25210 | D(p->level--); |
| 25211 | return NULL; |
| 25212 | } |
| 25213 | if (_n == _children_capacity) { |
| 25214 | _children_capacity *= 2; |
| 25215 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25216 | if (!_new_children) { |
| 25217 | p->error_indicator = 1; |
| 25218 | PyErr_NoMemory(); |
| 25219 | D(p->level--); |
| 25220 | return NULL; |
| 25221 | } |
| 25222 | _children = _new_children; |
| 25223 | } |
| 25224 | _children[_n++] = _res; |
| 25225 | _mark = p->mark; |
| 25226 | } |
| 25227 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25228 | D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25229 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); |
| 25230 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25231 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25232 | if (!_seq) { |
| 25233 | PyMem_Free(_children); |
| 25234 | p->error_indicator = 1; |
| 25235 | PyErr_NoMemory(); |
| 25236 | D(p->level--); |
| 25237 | return NULL; |
| 25238 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25239 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25240 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25241 | _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25242 | D(p->level--); |
| 25243 | return _seq; |
| 25244 | } |
| 25245 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25246 | // _gather_108: slice _loop0_109 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25247 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25248 | _gather_108_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25249 | { |
| 25250 | D(p->level++); |
| 25251 | if (p->error_indicator) { |
| 25252 | D(p->level--); |
| 25253 | return NULL; |
| 25254 | } |
| 25255 | asdl_seq * _res = NULL; |
| 25256 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25257 | { // slice _loop0_109 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25258 | if (p->error_indicator) { |
| 25259 | D(p->level--); |
| 25260 | return NULL; |
| 25261 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25262 | D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_109")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25263 | expr_ty elem; |
| 25264 | asdl_seq * seq; |
| 25265 | if ( |
| 25266 | (elem = slice_rule(p)) // slice |
| 25267 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25268 | (seq = _loop0_109_rule(p)) // _loop0_109 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25269 | ) |
| 25270 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25271 | D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_109")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25272 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 25273 | goto done; |
| 25274 | } |
| 25275 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25276 | D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ', |
| 25277 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_109")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25278 | } |
| 25279 | _res = NULL; |
| 25280 | done: |
| 25281 | D(p->level--); |
| 25282 | return _res; |
| 25283 | } |
| 25284 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25285 | // _tmp_110: ':' expression? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25286 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25287 | _tmp_110_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25288 | { |
| 25289 | D(p->level++); |
| 25290 | if (p->error_indicator) { |
| 25291 | D(p->level--); |
| 25292 | return NULL; |
| 25293 | } |
| 25294 | void * _res = NULL; |
| 25295 | int _mark = p->mark; |
| 25296 | { // ':' expression? |
| 25297 | if (p->error_indicator) { |
| 25298 | D(p->level--); |
| 25299 | return NULL; |
| 25300 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25301 | D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25302 | Token * _literal; |
| 25303 | void *d; |
| 25304 | if ( |
| 25305 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 25306 | && |
| 25307 | (d = expression_rule(p), 1) // expression? |
| 25308 | ) |
| 25309 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25310 | D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25311 | _res = d; |
| 25312 | if (_res == NULL && PyErr_Occurred()) { |
| 25313 | p->error_indicator = 1; |
| 25314 | D(p->level--); |
| 25315 | return NULL; |
| 25316 | } |
| 25317 | goto done; |
| 25318 | } |
| 25319 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25320 | D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25321 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); |
| 25322 | } |
| 25323 | _res = NULL; |
| 25324 | done: |
| 25325 | D(p->level--); |
| 25326 | return _res; |
| 25327 | } |
| 25328 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25329 | // _tmp_111: tuple | group | genexp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25330 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25331 | _tmp_111_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25332 | { |
| 25333 | D(p->level++); |
| 25334 | if (p->error_indicator) { |
| 25335 | D(p->level--); |
| 25336 | return NULL; |
| 25337 | } |
| 25338 | void * _res = NULL; |
| 25339 | int _mark = p->mark; |
| 25340 | { // tuple |
| 25341 | if (p->error_indicator) { |
| 25342 | D(p->level--); |
| 25343 | return NULL; |
| 25344 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25345 | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25346 | expr_ty tuple_var; |
| 25347 | if ( |
| 25348 | (tuple_var = tuple_rule(p)) // tuple |
| 25349 | ) |
| 25350 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25351 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25352 | _res = tuple_var; |
| 25353 | goto done; |
| 25354 | } |
| 25355 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25356 | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25357 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
| 25358 | } |
| 25359 | { // group |
| 25360 | if (p->error_indicator) { |
| 25361 | D(p->level--); |
| 25362 | return NULL; |
| 25363 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25364 | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25365 | expr_ty group_var; |
| 25366 | if ( |
| 25367 | (group_var = group_rule(p)) // group |
| 25368 | ) |
| 25369 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25370 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25371 | _res = group_var; |
| 25372 | goto done; |
| 25373 | } |
| 25374 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25375 | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25376 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); |
| 25377 | } |
| 25378 | { // genexp |
| 25379 | if (p->error_indicator) { |
| 25380 | D(p->level--); |
| 25381 | return NULL; |
| 25382 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25383 | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25384 | expr_ty genexp_var; |
| 25385 | if ( |
| 25386 | (genexp_var = genexp_rule(p)) // genexp |
| 25387 | ) |
| 25388 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25389 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25390 | _res = genexp_var; |
| 25391 | goto done; |
| 25392 | } |
| 25393 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25394 | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25395 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); |
| 25396 | } |
| 25397 | _res = NULL; |
| 25398 | done: |
| 25399 | D(p->level--); |
| 25400 | return _res; |
| 25401 | } |
| 25402 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25403 | // _tmp_112: list | listcomp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25404 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25405 | _tmp_112_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25406 | { |
| 25407 | D(p->level++); |
| 25408 | if (p->error_indicator) { |
| 25409 | D(p->level--); |
| 25410 | return NULL; |
| 25411 | } |
| 25412 | void * _res = NULL; |
| 25413 | int _mark = p->mark; |
| 25414 | { // list |
| 25415 | if (p->error_indicator) { |
| 25416 | D(p->level--); |
| 25417 | return NULL; |
| 25418 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25419 | D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25420 | expr_ty list_var; |
| 25421 | if ( |
| 25422 | (list_var = list_rule(p)) // list |
| 25423 | ) |
| 25424 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25425 | D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25426 | _res = list_var; |
| 25427 | goto done; |
| 25428 | } |
| 25429 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25430 | D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25431 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
| 25432 | } |
| 25433 | { // listcomp |
| 25434 | if (p->error_indicator) { |
| 25435 | D(p->level--); |
| 25436 | return NULL; |
| 25437 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25438 | D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25439 | expr_ty listcomp_var; |
| 25440 | if ( |
| 25441 | (listcomp_var = listcomp_rule(p)) // listcomp |
| 25442 | ) |
| 25443 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25444 | D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25445 | _res = listcomp_var; |
| 25446 | goto done; |
| 25447 | } |
| 25448 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25449 | D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25450 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); |
| 25451 | } |
| 25452 | _res = NULL; |
| 25453 | done: |
| 25454 | D(p->level--); |
| 25455 | return _res; |
| 25456 | } |
| 25457 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25458 | // _tmp_113: dict | set | dictcomp | setcomp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25459 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25460 | _tmp_113_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25461 | { |
| 25462 | D(p->level++); |
| 25463 | if (p->error_indicator) { |
| 25464 | D(p->level--); |
| 25465 | return NULL; |
| 25466 | } |
| 25467 | void * _res = NULL; |
| 25468 | int _mark = p->mark; |
| 25469 | { // dict |
| 25470 | if (p->error_indicator) { |
| 25471 | D(p->level--); |
| 25472 | return NULL; |
| 25473 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25474 | D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25475 | expr_ty dict_var; |
| 25476 | if ( |
| 25477 | (dict_var = dict_rule(p)) // dict |
| 25478 | ) |
| 25479 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25480 | D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25481 | _res = dict_var; |
| 25482 | goto done; |
| 25483 | } |
| 25484 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25485 | D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25486 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); |
| 25487 | } |
| 25488 | { // set |
| 25489 | if (p->error_indicator) { |
| 25490 | D(p->level--); |
| 25491 | return NULL; |
| 25492 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25493 | D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25494 | expr_ty set_var; |
| 25495 | if ( |
| 25496 | (set_var = set_rule(p)) // set |
| 25497 | ) |
| 25498 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25499 | D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25500 | _res = set_var; |
| 25501 | goto done; |
| 25502 | } |
| 25503 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25504 | D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25505 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); |
| 25506 | } |
| 25507 | { // dictcomp |
| 25508 | if (p->error_indicator) { |
| 25509 | D(p->level--); |
| 25510 | return NULL; |
| 25511 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25512 | D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25513 | expr_ty dictcomp_var; |
| 25514 | if ( |
| 25515 | (dictcomp_var = dictcomp_rule(p)) // dictcomp |
| 25516 | ) |
| 25517 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25518 | D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25519 | _res = dictcomp_var; |
| 25520 | goto done; |
| 25521 | } |
| 25522 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25523 | D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25524 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); |
| 25525 | } |
| 25526 | { // setcomp |
| 25527 | if (p->error_indicator) { |
| 25528 | D(p->level--); |
| 25529 | return NULL; |
| 25530 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25531 | D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25532 | expr_ty setcomp_var; |
| 25533 | if ( |
| 25534 | (setcomp_var = setcomp_rule(p)) // setcomp |
| 25535 | ) |
| 25536 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25537 | D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25538 | _res = setcomp_var; |
| 25539 | goto done; |
| 25540 | } |
| 25541 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25542 | D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25543 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); |
| 25544 | } |
| 25545 | _res = NULL; |
| 25546 | done: |
| 25547 | D(p->level--); |
| 25548 | return _res; |
| 25549 | } |
| 25550 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25551 | // _loop1_114: STRING |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25552 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25553 | _loop1_114_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25554 | { |
| 25555 | D(p->level++); |
| 25556 | if (p->error_indicator) { |
| 25557 | D(p->level--); |
| 25558 | return NULL; |
| 25559 | } |
| 25560 | void *_res = NULL; |
| 25561 | int _mark = p->mark; |
| 25562 | int _start_mark = p->mark; |
| 25563 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25564 | if (!_children) { |
| 25565 | p->error_indicator = 1; |
| 25566 | PyErr_NoMemory(); |
| 25567 | D(p->level--); |
| 25568 | return NULL; |
| 25569 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25570 | Py_ssize_t _children_capacity = 1; |
| 25571 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25572 | { // STRING |
| 25573 | if (p->error_indicator) { |
| 25574 | D(p->level--); |
| 25575 | return NULL; |
| 25576 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25577 | D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25578 | expr_ty string_var; |
| 25579 | while ( |
| 25580 | (string_var = _PyPegen_string_token(p)) // STRING |
| 25581 | ) |
| 25582 | { |
| 25583 | _res = string_var; |
| 25584 | if (_n == _children_capacity) { |
| 25585 | _children_capacity *= 2; |
| 25586 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25587 | if (!_new_children) { |
| 25588 | p->error_indicator = 1; |
| 25589 | PyErr_NoMemory(); |
| 25590 | D(p->level--); |
| 25591 | return NULL; |
| 25592 | } |
| 25593 | _children = _new_children; |
| 25594 | } |
| 25595 | _children[_n++] = _res; |
| 25596 | _mark = p->mark; |
| 25597 | } |
| 25598 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25599 | D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25600 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); |
| 25601 | } |
| 25602 | if (_n == 0 || p->error_indicator) { |
| 25603 | PyMem_Free(_children); |
| 25604 | D(p->level--); |
| 25605 | return NULL; |
| 25606 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25607 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25608 | if (!_seq) { |
| 25609 | PyMem_Free(_children); |
| 25610 | p->error_indicator = 1; |
| 25611 | PyErr_NoMemory(); |
| 25612 | D(p->level--); |
| 25613 | return NULL; |
| 25614 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25615 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25616 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25617 | _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25618 | D(p->level--); |
| 25619 | return _seq; |
| 25620 | } |
| 25621 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25622 | // _tmp_115: star_named_expression ',' star_named_expressions? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25623 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25624 | _tmp_115_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25625 | { |
| 25626 | D(p->level++); |
| 25627 | if (p->error_indicator) { |
| 25628 | D(p->level--); |
| 25629 | return NULL; |
| 25630 | } |
| 25631 | void * _res = NULL; |
| 25632 | int _mark = p->mark; |
| 25633 | { // star_named_expression ',' star_named_expressions? |
| 25634 | if (p->error_indicator) { |
| 25635 | D(p->level--); |
| 25636 | return NULL; |
| 25637 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25638 | D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25639 | Token * _literal; |
| 25640 | expr_ty y; |
| 25641 | void *z; |
| 25642 | if ( |
| 25643 | (y = star_named_expression_rule(p)) // star_named_expression |
| 25644 | && |
| 25645 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 25646 | && |
| 25647 | (z = star_named_expressions_rule(p), 1) // star_named_expressions? |
| 25648 | ) |
| 25649 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25650 | D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25651 | _res = _PyPegen_seq_insert_in_front ( p , y , z ); |
| 25652 | if (_res == NULL && PyErr_Occurred()) { |
| 25653 | p->error_indicator = 1; |
| 25654 | D(p->level--); |
| 25655 | return NULL; |
| 25656 | } |
| 25657 | goto done; |
| 25658 | } |
| 25659 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25660 | D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25661 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
| 25662 | } |
| 25663 | _res = NULL; |
| 25664 | done: |
| 25665 | D(p->level--); |
| 25666 | return _res; |
| 25667 | } |
| 25668 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25669 | // _tmp_116: yield_expr | named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25670 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25671 | _tmp_116_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25672 | { |
| 25673 | D(p->level++); |
| 25674 | if (p->error_indicator) { |
| 25675 | D(p->level--); |
| 25676 | return NULL; |
| 25677 | } |
| 25678 | void * _res = NULL; |
| 25679 | int _mark = p->mark; |
| 25680 | { // yield_expr |
| 25681 | if (p->error_indicator) { |
| 25682 | D(p->level--); |
| 25683 | return NULL; |
| 25684 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25685 | D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25686 | expr_ty yield_expr_var; |
| 25687 | if ( |
| 25688 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 25689 | ) |
| 25690 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25691 | D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25692 | _res = yield_expr_var; |
| 25693 | goto done; |
| 25694 | } |
| 25695 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25696 | D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25697 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 25698 | } |
| 25699 | { // named_expression |
| 25700 | if (p->error_indicator) { |
| 25701 | D(p->level--); |
| 25702 | return NULL; |
| 25703 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25704 | D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25705 | expr_ty named_expression_var; |
| 25706 | if ( |
| 25707 | (named_expression_var = named_expression_rule(p)) // named_expression |
| 25708 | ) |
| 25709 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25710 | D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25711 | _res = named_expression_var; |
| 25712 | goto done; |
| 25713 | } |
| 25714 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25715 | D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25716 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
| 25717 | } |
| 25718 | _res = NULL; |
| 25719 | done: |
| 25720 | D(p->level--); |
| 25721 | return _res; |
| 25722 | } |
| 25723 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25724 | // _loop0_118: ',' double_starred_kvpair |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25725 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25726 | _loop0_118_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25727 | { |
| 25728 | D(p->level++); |
| 25729 | if (p->error_indicator) { |
| 25730 | D(p->level--); |
| 25731 | return NULL; |
| 25732 | } |
| 25733 | void *_res = NULL; |
| 25734 | int _mark = p->mark; |
| 25735 | int _start_mark = p->mark; |
| 25736 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25737 | if (!_children) { |
| 25738 | p->error_indicator = 1; |
| 25739 | PyErr_NoMemory(); |
| 25740 | D(p->level--); |
| 25741 | return NULL; |
| 25742 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25743 | Py_ssize_t _children_capacity = 1; |
| 25744 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25745 | { // ',' double_starred_kvpair |
| 25746 | if (p->error_indicator) { |
| 25747 | D(p->level--); |
| 25748 | return NULL; |
| 25749 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25750 | D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25751 | Token * _literal; |
| 25752 | KeyValuePair* elem; |
| 25753 | while ( |
| 25754 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 25755 | && |
| 25756 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
| 25757 | ) |
| 25758 | { |
| 25759 | _res = elem; |
| 25760 | if (_res == NULL && PyErr_Occurred()) { |
| 25761 | p->error_indicator = 1; |
| 25762 | PyMem_Free(_children); |
| 25763 | D(p->level--); |
| 25764 | return NULL; |
| 25765 | } |
| 25766 | if (_n == _children_capacity) { |
| 25767 | _children_capacity *= 2; |
| 25768 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25769 | if (!_new_children) { |
| 25770 | p->error_indicator = 1; |
| 25771 | PyErr_NoMemory(); |
| 25772 | D(p->level--); |
| 25773 | return NULL; |
| 25774 | } |
| 25775 | _children = _new_children; |
| 25776 | } |
| 25777 | _children[_n++] = _res; |
| 25778 | _mark = p->mark; |
| 25779 | } |
| 25780 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25781 | D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25782 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); |
| 25783 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25784 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25785 | if (!_seq) { |
| 25786 | PyMem_Free(_children); |
| 25787 | p->error_indicator = 1; |
| 25788 | PyErr_NoMemory(); |
| 25789 | D(p->level--); |
| 25790 | return NULL; |
| 25791 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25792 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25793 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25794 | _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25795 | D(p->level--); |
| 25796 | return _seq; |
| 25797 | } |
| 25798 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25799 | // _gather_117: double_starred_kvpair _loop0_118 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25800 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25801 | _gather_117_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25802 | { |
| 25803 | D(p->level++); |
| 25804 | if (p->error_indicator) { |
| 25805 | D(p->level--); |
| 25806 | return NULL; |
| 25807 | } |
| 25808 | asdl_seq * _res = NULL; |
| 25809 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25810 | { // double_starred_kvpair _loop0_118 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25811 | if (p->error_indicator) { |
| 25812 | D(p->level--); |
| 25813 | return NULL; |
| 25814 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25815 | D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_118")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25816 | KeyValuePair* elem; |
| 25817 | asdl_seq * seq; |
| 25818 | if ( |
| 25819 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
| 25820 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25821 | (seq = _loop0_118_rule(p)) // _loop0_118 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25822 | ) |
| 25823 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25824 | D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_118")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25825 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 25826 | goto done; |
| 25827 | } |
| 25828 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25829 | D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ', |
| 25830 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_118")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25831 | } |
| 25832 | _res = NULL; |
| 25833 | done: |
| 25834 | D(p->level--); |
| 25835 | return _res; |
| 25836 | } |
| 25837 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25838 | // _loop1_119: for_if_clause |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25839 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25840 | _loop1_119_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25841 | { |
| 25842 | D(p->level++); |
| 25843 | if (p->error_indicator) { |
| 25844 | D(p->level--); |
| 25845 | return NULL; |
| 25846 | } |
| 25847 | void *_res = NULL; |
| 25848 | int _mark = p->mark; |
| 25849 | int _start_mark = p->mark; |
| 25850 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25851 | if (!_children) { |
| 25852 | p->error_indicator = 1; |
| 25853 | PyErr_NoMemory(); |
| 25854 | D(p->level--); |
| 25855 | return NULL; |
| 25856 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25857 | Py_ssize_t _children_capacity = 1; |
| 25858 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25859 | { // for_if_clause |
| 25860 | if (p->error_indicator) { |
| 25861 | D(p->level--); |
| 25862 | return NULL; |
| 25863 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25864 | D(fprintf(stderr, "%*c> _loop1_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25865 | comprehension_ty for_if_clause_var; |
| 25866 | while ( |
| 25867 | (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause |
| 25868 | ) |
| 25869 | { |
| 25870 | _res = for_if_clause_var; |
| 25871 | if (_n == _children_capacity) { |
| 25872 | _children_capacity *= 2; |
| 25873 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25874 | if (!_new_children) { |
| 25875 | p->error_indicator = 1; |
| 25876 | PyErr_NoMemory(); |
| 25877 | D(p->level--); |
| 25878 | return NULL; |
| 25879 | } |
| 25880 | _children = _new_children; |
| 25881 | } |
| 25882 | _children[_n++] = _res; |
| 25883 | _mark = p->mark; |
| 25884 | } |
| 25885 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25886 | D(fprintf(stderr, "%*c%s _loop1_119[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25887 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); |
| 25888 | } |
| 25889 | if (_n == 0 || p->error_indicator) { |
| 25890 | PyMem_Free(_children); |
| 25891 | D(p->level--); |
| 25892 | return NULL; |
| 25893 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25894 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25895 | if (!_seq) { |
| 25896 | PyMem_Free(_children); |
| 25897 | p->error_indicator = 1; |
| 25898 | PyErr_NoMemory(); |
| 25899 | D(p->level--); |
| 25900 | return NULL; |
| 25901 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25902 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25903 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25904 | _PyPegen_insert_memo(p, _start_mark, _loop1_119_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25905 | D(p->level--); |
| 25906 | return _seq; |
| 25907 | } |
| 25908 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25909 | // _loop0_120: ('if' disjunction) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25910 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25911 | _loop0_120_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25912 | { |
| 25913 | D(p->level++); |
| 25914 | if (p->error_indicator) { |
| 25915 | D(p->level--); |
| 25916 | return NULL; |
| 25917 | } |
| 25918 | void *_res = NULL; |
| 25919 | int _mark = p->mark; |
| 25920 | int _start_mark = p->mark; |
| 25921 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25922 | if (!_children) { |
| 25923 | p->error_indicator = 1; |
| 25924 | PyErr_NoMemory(); |
| 25925 | D(p->level--); |
| 25926 | return NULL; |
| 25927 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25928 | Py_ssize_t _children_capacity = 1; |
| 25929 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25930 | { // ('if' disjunction) |
| 25931 | if (p->error_indicator) { |
| 25932 | D(p->level--); |
| 25933 | return NULL; |
| 25934 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25935 | D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
| 25936 | void *_tmp_170_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25937 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25938 | (_tmp_170_var = _tmp_170_rule(p)) // 'if' disjunction |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25939 | ) |
| 25940 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25941 | _res = _tmp_170_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25942 | if (_n == _children_capacity) { |
| 25943 | _children_capacity *= 2; |
| 25944 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25945 | if (!_new_children) { |
| 25946 | p->error_indicator = 1; |
| 25947 | PyErr_NoMemory(); |
| 25948 | D(p->level--); |
| 25949 | return NULL; |
| 25950 | } |
| 25951 | _children = _new_children; |
| 25952 | } |
| 25953 | _children[_n++] = _res; |
| 25954 | _mark = p->mark; |
| 25955 | } |
| 25956 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25957 | D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25958 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
| 25959 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25960 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25961 | if (!_seq) { |
| 25962 | PyMem_Free(_children); |
| 25963 | p->error_indicator = 1; |
| 25964 | PyErr_NoMemory(); |
| 25965 | D(p->level--); |
| 25966 | return NULL; |
| 25967 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25968 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25969 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25970 | _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25971 | D(p->level--); |
| 25972 | return _seq; |
| 25973 | } |
| 25974 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25975 | // _loop0_121: ('if' disjunction) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 25976 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25977 | _loop0_121_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 25978 | { |
| 25979 | D(p->level++); |
| 25980 | if (p->error_indicator) { |
| 25981 | D(p->level--); |
| 25982 | return NULL; |
| 25983 | } |
| 25984 | void *_res = NULL; |
| 25985 | int _mark = p->mark; |
| 25986 | int _start_mark = p->mark; |
| 25987 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25988 | if (!_children) { |
| 25989 | p->error_indicator = 1; |
| 25990 | PyErr_NoMemory(); |
| 25991 | D(p->level--); |
| 25992 | return NULL; |
| 25993 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25994 | Py_ssize_t _children_capacity = 1; |
| 25995 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 25996 | { // ('if' disjunction) |
| 25997 | if (p->error_indicator) { |
| 25998 | D(p->level--); |
| 25999 | return NULL; |
| 26000 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26001 | D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
| 26002 | void *_tmp_171_var; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26003 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26004 | (_tmp_171_var = _tmp_171_rule(p)) // 'if' disjunction |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26005 | ) |
| 26006 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26007 | _res = _tmp_171_var; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26008 | if (_n == _children_capacity) { |
| 26009 | _children_capacity *= 2; |
| 26010 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26011 | if (!_new_children) { |
| 26012 | p->error_indicator = 1; |
| 26013 | PyErr_NoMemory(); |
| 26014 | D(p->level--); |
| 26015 | return NULL; |
| 26016 | } |
| 26017 | _children = _new_children; |
| 26018 | } |
| 26019 | _children[_n++] = _res; |
| 26020 | _mark = p->mark; |
| 26021 | } |
| 26022 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26023 | D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26024 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
| 26025 | } |
| 26026 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26027 | if (!_seq) { |
| 26028 | PyMem_Free(_children); |
| 26029 | p->error_indicator = 1; |
| 26030 | PyErr_NoMemory(); |
| 26031 | D(p->level--); |
| 26032 | return NULL; |
| 26033 | } |
| 26034 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26035 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26036 | _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26037 | D(p->level--); |
| 26038 | return _seq; |
| 26039 | } |
| 26040 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26041 | // _loop0_123: ',' (starred_expression | named_expression !'=') |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 26042 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26043 | _loop0_123_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26044 | { |
| 26045 | D(p->level++); |
| 26046 | if (p->error_indicator) { |
| 26047 | D(p->level--); |
| 26048 | return NULL; |
| 26049 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 26050 | void *_res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26051 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 26052 | int _start_mark = p->mark; |
| 26053 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26054 | if (!_children) { |
| 26055 | p->error_indicator = 1; |
| 26056 | PyErr_NoMemory(); |
| 26057 | D(p->level--); |
| 26058 | return NULL; |
| 26059 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26060 | Py_ssize_t _children_capacity = 1; |
| 26061 | Py_ssize_t _n = 0; |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 26062 | { // ',' (starred_expression | named_expression !'=') |
| 26063 | if (p->error_indicator) { |
| 26064 | D(p->level--); |
| 26065 | return NULL; |
| 26066 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26067 | D(fprintf(stderr, "%*c> _loop0_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')")); |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 26068 | Token * _literal; |
| 26069 | void *elem; |
| 26070 | while ( |
| 26071 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26072 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26073 | (elem = _tmp_172_rule(p)) // starred_expression | named_expression !'=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26074 | ) |
| 26075 | { |
| 26076 | _res = elem; |
| 26077 | if (_res == NULL && PyErr_Occurred()) { |
| 26078 | p->error_indicator = 1; |
| 26079 | PyMem_Free(_children); |
| 26080 | D(p->level--); |
| 26081 | return NULL; |
| 26082 | } |
| 26083 | if (_n == _children_capacity) { |
| 26084 | _children_capacity *= 2; |
| 26085 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26086 | if (!_new_children) { |
| 26087 | p->error_indicator = 1; |
| 26088 | PyErr_NoMemory(); |
| 26089 | D(p->level--); |
| 26090 | return NULL; |
| 26091 | } |
| 26092 | _children = _new_children; |
| 26093 | } |
| 26094 | _children[_n++] = _res; |
| 26095 | _mark = p->mark; |
| 26096 | } |
| 26097 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26098 | D(fprintf(stderr, "%*c%s _loop0_123[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26099 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26100 | } |
| 26101 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26102 | if (!_seq) { |
| 26103 | PyMem_Free(_children); |
| 26104 | p->error_indicator = 1; |
| 26105 | PyErr_NoMemory(); |
| 26106 | D(p->level--); |
| 26107 | return NULL; |
| 26108 | } |
| 26109 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26110 | PyMem_Free(_children); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26111 | _PyPegen_insert_memo(p, _start_mark, _loop0_123_type, _seq); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26112 | D(p->level--); |
| 26113 | return _seq; |
| 26114 | } |
| 26115 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26116 | // _gather_122: (starred_expression | named_expression !'=') _loop0_123 |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26117 | static asdl_seq * |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26118 | _gather_122_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26119 | { |
| 26120 | D(p->level++); |
| 26121 | if (p->error_indicator) { |
| 26122 | D(p->level--); |
| 26123 | return NULL; |
| 26124 | } |
| 26125 | asdl_seq * _res = NULL; |
| 26126 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26127 | { // (starred_expression | named_expression !'=') _loop0_123 |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26128 | if (p->error_indicator) { |
| 26129 | D(p->level--); |
| 26130 | return NULL; |
| 26131 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26132 | D(fprintf(stderr, "%*c> _gather_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_123")); |
| 26133 | void *elem; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26134 | asdl_seq * seq; |
| 26135 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26136 | (elem = _tmp_172_rule(p)) // starred_expression | named_expression !'=' |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26137 | && |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26138 | (seq = _loop0_123_rule(p)) // _loop0_123 |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26139 | ) |
| 26140 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26141 | D(fprintf(stderr, "%*c+ _gather_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_123")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26142 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 26143 | goto done; |
| 26144 | } |
| 26145 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26146 | D(fprintf(stderr, "%*c%s _gather_122[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26147 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_123")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26148 | } |
| 26149 | _res = NULL; |
| 26150 | done: |
| 26151 | D(p->level--); |
| 26152 | return _res; |
| 26153 | } |
| 26154 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26155 | // _tmp_124: ',' kwargs |
| 26156 | static void * |
| 26157 | _tmp_124_rule(Parser *p) |
| 26158 | { |
| 26159 | D(p->level++); |
| 26160 | if (p->error_indicator) { |
| 26161 | D(p->level--); |
| 26162 | return NULL; |
| 26163 | } |
| 26164 | void * _res = NULL; |
| 26165 | int _mark = p->mark; |
| 26166 | { // ',' kwargs |
| 26167 | if (p->error_indicator) { |
| 26168 | D(p->level--); |
| 26169 | return NULL; |
| 26170 | } |
| 26171 | D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); |
| 26172 | Token * _literal; |
| 26173 | asdl_seq* k; |
| 26174 | if ( |
| 26175 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26176 | && |
| 26177 | (k = kwargs_rule(p)) // kwargs |
| 26178 | ) |
| 26179 | { |
| 26180 | D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); |
| 26181 | _res = k; |
| 26182 | if (_res == NULL && PyErr_Occurred()) { |
| 26183 | p->error_indicator = 1; |
| 26184 | D(p->level--); |
| 26185 | return NULL; |
| 26186 | } |
| 26187 | goto done; |
| 26188 | } |
| 26189 | p->mark = _mark; |
| 26190 | D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', |
| 26191 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs")); |
| 26192 | } |
| 26193 | _res = NULL; |
| 26194 | done: |
| 26195 | D(p->level--); |
| 26196 | return _res; |
| 26197 | } |
| 26198 | |
| 26199 | // _loop0_126: ',' kwarg_or_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26200 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26201 | _loop0_126_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26202 | { |
| 26203 | D(p->level++); |
| 26204 | if (p->error_indicator) { |
| 26205 | D(p->level--); |
| 26206 | return NULL; |
| 26207 | } |
| 26208 | void *_res = NULL; |
| 26209 | int _mark = p->mark; |
| 26210 | int _start_mark = p->mark; |
| 26211 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26212 | if (!_children) { |
| 26213 | p->error_indicator = 1; |
| 26214 | PyErr_NoMemory(); |
| 26215 | D(p->level--); |
| 26216 | return NULL; |
| 26217 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26218 | Py_ssize_t _children_capacity = 1; |
| 26219 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26220 | { // ',' kwarg_or_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26221 | if (p->error_indicator) { |
| 26222 | D(p->level--); |
| 26223 | return NULL; |
| 26224 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26225 | D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26226 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26227 | KeywordOrStarred* elem; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26228 | while ( |
| 26229 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26230 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26231 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26232 | ) |
| 26233 | { |
| 26234 | _res = elem; |
| 26235 | if (_res == NULL && PyErr_Occurred()) { |
| 26236 | p->error_indicator = 1; |
| 26237 | PyMem_Free(_children); |
| 26238 | D(p->level--); |
| 26239 | return NULL; |
| 26240 | } |
| 26241 | if (_n == _children_capacity) { |
| 26242 | _children_capacity *= 2; |
| 26243 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26244 | if (!_new_children) { |
| 26245 | p->error_indicator = 1; |
| 26246 | PyErr_NoMemory(); |
| 26247 | D(p->level--); |
| 26248 | return NULL; |
| 26249 | } |
| 26250 | _children = _new_children; |
| 26251 | } |
| 26252 | _children[_n++] = _res; |
| 26253 | _mark = p->mark; |
| 26254 | } |
| 26255 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26256 | D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', |
| 26257 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26258 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26259 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26260 | if (!_seq) { |
| 26261 | PyMem_Free(_children); |
| 26262 | p->error_indicator = 1; |
| 26263 | PyErr_NoMemory(); |
| 26264 | D(p->level--); |
| 26265 | return NULL; |
| 26266 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26267 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26268 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26269 | _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26270 | D(p->level--); |
| 26271 | return _seq; |
| 26272 | } |
| 26273 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26274 | // _gather_125: kwarg_or_starred _loop0_126 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26275 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26276 | _gather_125_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26277 | { |
| 26278 | D(p->level++); |
| 26279 | if (p->error_indicator) { |
| 26280 | D(p->level--); |
| 26281 | return NULL; |
| 26282 | } |
| 26283 | asdl_seq * _res = NULL; |
| 26284 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26285 | { // kwarg_or_starred _loop0_126 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26286 | if (p->error_indicator) { |
| 26287 | D(p->level--); |
| 26288 | return NULL; |
| 26289 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26290 | D(fprintf(stderr, "%*c> _gather_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); |
| 26291 | KeywordOrStarred* elem; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26292 | asdl_seq * seq; |
| 26293 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26294 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26295 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26296 | (seq = _loop0_126_rule(p)) // _loop0_126 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26297 | ) |
| 26298 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26299 | D(fprintf(stderr, "%*c+ _gather_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26300 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 26301 | goto done; |
| 26302 | } |
| 26303 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26304 | D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ', |
| 26305 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_126")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26306 | } |
| 26307 | _res = NULL; |
| 26308 | done: |
| 26309 | D(p->level--); |
| 26310 | return _res; |
| 26311 | } |
| 26312 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26313 | // _loop0_128: ',' kwarg_or_double_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26314 | static asdl_seq * |
| 26315 | _loop0_128_rule(Parser *p) |
| 26316 | { |
| 26317 | D(p->level++); |
| 26318 | if (p->error_indicator) { |
| 26319 | D(p->level--); |
| 26320 | return NULL; |
| 26321 | } |
| 26322 | void *_res = NULL; |
| 26323 | int _mark = p->mark; |
| 26324 | int _start_mark = p->mark; |
| 26325 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26326 | if (!_children) { |
| 26327 | p->error_indicator = 1; |
| 26328 | PyErr_NoMemory(); |
| 26329 | D(p->level--); |
| 26330 | return NULL; |
| 26331 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26332 | Py_ssize_t _children_capacity = 1; |
| 26333 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26334 | { // ',' kwarg_or_double_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26335 | if (p->error_indicator) { |
| 26336 | D(p->level--); |
| 26337 | return NULL; |
| 26338 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26339 | D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); |
| 26340 | Token * _literal; |
| 26341 | KeywordOrStarred* elem; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26342 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26343 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26344 | && |
| 26345 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26346 | ) |
| 26347 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26348 | _res = elem; |
| 26349 | if (_res == NULL && PyErr_Occurred()) { |
| 26350 | p->error_indicator = 1; |
| 26351 | PyMem_Free(_children); |
| 26352 | D(p->level--); |
| 26353 | return NULL; |
| 26354 | } |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26355 | if (_n == _children_capacity) { |
| 26356 | _children_capacity *= 2; |
| 26357 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26358 | if (!_new_children) { |
| 26359 | p->error_indicator = 1; |
| 26360 | PyErr_NoMemory(); |
| 26361 | D(p->level--); |
| 26362 | return NULL; |
| 26363 | } |
| 26364 | _children = _new_children; |
| 26365 | } |
| 26366 | _children[_n++] = _res; |
| 26367 | _mark = p->mark; |
| 26368 | } |
| 26369 | p->mark = _mark; |
| 26370 | D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26371 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26372 | } |
| 26373 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26374 | if (!_seq) { |
| 26375 | PyMem_Free(_children); |
| 26376 | p->error_indicator = 1; |
| 26377 | PyErr_NoMemory(); |
| 26378 | D(p->level--); |
| 26379 | return NULL; |
| 26380 | } |
| 26381 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26382 | PyMem_Free(_children); |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 26383 | _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26384 | D(p->level--); |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 26385 | return _seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26386 | } |
| 26387 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26388 | // _gather_127: kwarg_or_double_starred _loop0_128 |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26389 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26390 | _gather_127_rule(Parser *p) |
| 26391 | { |
| 26392 | D(p->level++); |
| 26393 | if (p->error_indicator) { |
| 26394 | D(p->level--); |
| 26395 | return NULL; |
| 26396 | } |
| 26397 | asdl_seq * _res = NULL; |
| 26398 | int _mark = p->mark; |
| 26399 | { // kwarg_or_double_starred _loop0_128 |
| 26400 | if (p->error_indicator) { |
| 26401 | D(p->level--); |
| 26402 | return NULL; |
| 26403 | } |
| 26404 | D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); |
| 26405 | KeywordOrStarred* elem; |
| 26406 | asdl_seq * seq; |
| 26407 | if ( |
| 26408 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
| 26409 | && |
| 26410 | (seq = _loop0_128_rule(p)) // _loop0_128 |
| 26411 | ) |
| 26412 | { |
| 26413 | D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); |
| 26414 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 26415 | goto done; |
| 26416 | } |
| 26417 | p->mark = _mark; |
| 26418 | D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', |
| 26419 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_128")); |
| 26420 | } |
| 26421 | _res = NULL; |
| 26422 | done: |
| 26423 | D(p->level--); |
| 26424 | return _res; |
| 26425 | } |
| 26426 | |
| 26427 | // _loop0_130: ',' kwarg_or_starred |
| 26428 | static asdl_seq * |
| 26429 | _loop0_130_rule(Parser *p) |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26430 | { |
| 26431 | D(p->level++); |
| 26432 | if (p->error_indicator) { |
| 26433 | D(p->level--); |
| 26434 | return NULL; |
| 26435 | } |
| 26436 | void *_res = NULL; |
| 26437 | int _mark = p->mark; |
| 26438 | int _start_mark = p->mark; |
| 26439 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26440 | if (!_children) { |
| 26441 | p->error_indicator = 1; |
| 26442 | PyErr_NoMemory(); |
| 26443 | D(p->level--); |
| 26444 | return NULL; |
| 26445 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26446 | Py_ssize_t _children_capacity = 1; |
| 26447 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26448 | { // ',' kwarg_or_starred |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26449 | if (p->error_indicator) { |
| 26450 | D(p->level--); |
| 26451 | return NULL; |
| 26452 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26453 | D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); |
| 26454 | Token * _literal; |
| 26455 | KeywordOrStarred* elem; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26456 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26457 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26458 | && |
| 26459 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26460 | ) |
| 26461 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26462 | _res = elem; |
| 26463 | if (_res == NULL && PyErr_Occurred()) { |
| 26464 | p->error_indicator = 1; |
| 26465 | PyMem_Free(_children); |
| 26466 | D(p->level--); |
| 26467 | return NULL; |
| 26468 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26469 | if (_n == _children_capacity) { |
| 26470 | _children_capacity *= 2; |
| 26471 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26472 | if (!_new_children) { |
| 26473 | p->error_indicator = 1; |
| 26474 | PyErr_NoMemory(); |
| 26475 | D(p->level--); |
| 26476 | return NULL; |
| 26477 | } |
| 26478 | _children = _new_children; |
| 26479 | } |
| 26480 | _children[_n++] = _res; |
| 26481 | _mark = p->mark; |
| 26482 | } |
| 26483 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26484 | D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', |
| 26485 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26486 | } |
| 26487 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26488 | if (!_seq) { |
| 26489 | PyMem_Free(_children); |
| 26490 | p->error_indicator = 1; |
| 26491 | PyErr_NoMemory(); |
| 26492 | D(p->level--); |
| 26493 | return NULL; |
| 26494 | } |
| 26495 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26496 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26497 | _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26498 | D(p->level--); |
| 26499 | return _seq; |
| 26500 | } |
| 26501 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26502 | // _gather_129: kwarg_or_starred _loop0_130 |
| 26503 | static asdl_seq * |
| 26504 | _gather_129_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26505 | { |
| 26506 | D(p->level++); |
| 26507 | if (p->error_indicator) { |
| 26508 | D(p->level--); |
| 26509 | return NULL; |
| 26510 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26511 | asdl_seq * _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26512 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26513 | { // kwarg_or_starred _loop0_130 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26514 | if (p->error_indicator) { |
| 26515 | D(p->level--); |
| 26516 | return NULL; |
| 26517 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26518 | D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); |
| 26519 | KeywordOrStarred* elem; |
| 26520 | asdl_seq * seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26521 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26522 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
| 26523 | && |
| 26524 | (seq = _loop0_130_rule(p)) // _loop0_130 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26525 | ) |
| 26526 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26527 | D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); |
| 26528 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26529 | goto done; |
| 26530 | } |
| 26531 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26532 | D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', |
| 26533 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_130")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26534 | } |
| 26535 | _res = NULL; |
| 26536 | done: |
| 26537 | D(p->level--); |
| 26538 | return _res; |
| 26539 | } |
| 26540 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26541 | // _loop0_132: ',' kwarg_or_double_starred |
| 26542 | static asdl_seq * |
| 26543 | _loop0_132_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26544 | { |
| 26545 | D(p->level++); |
| 26546 | if (p->error_indicator) { |
| 26547 | D(p->level--); |
| 26548 | return NULL; |
| 26549 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26550 | void *_res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26551 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26552 | int _start_mark = p->mark; |
| 26553 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26554 | if (!_children) { |
| 26555 | p->error_indicator = 1; |
| 26556 | PyErr_NoMemory(); |
| 26557 | D(p->level--); |
| 26558 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26559 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26560 | Py_ssize_t _children_capacity = 1; |
| 26561 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26562 | { // ',' kwarg_or_double_starred |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26563 | if (p->error_indicator) { |
| 26564 | D(p->level--); |
| 26565 | return NULL; |
| 26566 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26567 | D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26568 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26569 | KeywordOrStarred* elem; |
| 26570 | while ( |
| 26571 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26572 | && |
| 26573 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26574 | ) |
| 26575 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26576 | _res = elem; |
| 26577 | if (_res == NULL && PyErr_Occurred()) { |
| 26578 | p->error_indicator = 1; |
| 26579 | PyMem_Free(_children); |
| 26580 | D(p->level--); |
| 26581 | return NULL; |
| 26582 | } |
| 26583 | if (_n == _children_capacity) { |
| 26584 | _children_capacity *= 2; |
| 26585 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26586 | if (!_new_children) { |
| 26587 | p->error_indicator = 1; |
| 26588 | PyErr_NoMemory(); |
| 26589 | D(p->level--); |
| 26590 | return NULL; |
| 26591 | } |
| 26592 | _children = _new_children; |
| 26593 | } |
| 26594 | _children[_n++] = _res; |
| 26595 | _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26596 | } |
| 26597 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26598 | D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', |
| 26599 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26600 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26601 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26602 | if (!_seq) { |
| 26603 | PyMem_Free(_children); |
| 26604 | p->error_indicator = 1; |
| 26605 | PyErr_NoMemory(); |
| 26606 | D(p->level--); |
| 26607 | return NULL; |
| 26608 | } |
| 26609 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26610 | PyMem_Free(_children); |
| 26611 | _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); |
| 26612 | D(p->level--); |
| 26613 | return _seq; |
| 26614 | } |
| 26615 | |
| 26616 | // _gather_131: kwarg_or_double_starred _loop0_132 |
| 26617 | static asdl_seq * |
| 26618 | _gather_131_rule(Parser *p) |
| 26619 | { |
| 26620 | D(p->level++); |
| 26621 | if (p->error_indicator) { |
| 26622 | D(p->level--); |
| 26623 | return NULL; |
| 26624 | } |
| 26625 | asdl_seq * _res = NULL; |
| 26626 | int _mark = p->mark; |
| 26627 | { // kwarg_or_double_starred _loop0_132 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26628 | if (p->error_indicator) { |
| 26629 | D(p->level--); |
| 26630 | return NULL; |
| 26631 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26632 | D(fprintf(stderr, "%*c> _gather_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); |
| 26633 | KeywordOrStarred* elem; |
| 26634 | asdl_seq * seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26635 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26636 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
| 26637 | && |
| 26638 | (seq = _loop0_132_rule(p)) // _loop0_132 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26639 | ) |
| 26640 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26641 | D(fprintf(stderr, "%*c+ _gather_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); |
| 26642 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26643 | goto done; |
| 26644 | } |
| 26645 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26646 | D(fprintf(stderr, "%*c%s _gather_131[%d-%d]: %s failed!\n", p->level, ' ', |
| 26647 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_132")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26648 | } |
| 26649 | _res = NULL; |
| 26650 | done: |
| 26651 | D(p->level--); |
| 26652 | return _res; |
| 26653 | } |
| 26654 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26655 | // _loop0_133: (',' star_target) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26656 | static asdl_seq * |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26657 | _loop0_133_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26658 | { |
| 26659 | D(p->level++); |
| 26660 | if (p->error_indicator) { |
| 26661 | D(p->level--); |
| 26662 | return NULL; |
| 26663 | } |
| 26664 | void *_res = NULL; |
| 26665 | int _mark = p->mark; |
| 26666 | int _start_mark = p->mark; |
| 26667 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26668 | if (!_children) { |
| 26669 | p->error_indicator = 1; |
| 26670 | PyErr_NoMemory(); |
| 26671 | D(p->level--); |
| 26672 | return NULL; |
| 26673 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26674 | Py_ssize_t _children_capacity = 1; |
| 26675 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26676 | { // (',' star_target) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26677 | if (p->error_indicator) { |
| 26678 | D(p->level--); |
| 26679 | return NULL; |
| 26680 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26681 | D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); |
| 26682 | void *_tmp_173_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26683 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26684 | (_tmp_173_var = _tmp_173_rule(p)) // ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26685 | ) |
| 26686 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26687 | _res = _tmp_173_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26688 | if (_n == _children_capacity) { |
| 26689 | _children_capacity *= 2; |
| 26690 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26691 | if (!_new_children) { |
| 26692 | p->error_indicator = 1; |
| 26693 | PyErr_NoMemory(); |
| 26694 | D(p->level--); |
| 26695 | return NULL; |
| 26696 | } |
| 26697 | _children = _new_children; |
| 26698 | } |
| 26699 | _children[_n++] = _res; |
| 26700 | _mark = p->mark; |
| 26701 | } |
| 26702 | p->mark = _mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26703 | D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26704 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26705 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26706 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26707 | if (!_seq) { |
| 26708 | PyMem_Free(_children); |
| 26709 | p->error_indicator = 1; |
| 26710 | PyErr_NoMemory(); |
| 26711 | D(p->level--); |
| 26712 | return NULL; |
| 26713 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26714 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26715 | PyMem_Free(_children); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26716 | _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26717 | D(p->level--); |
| 26718 | return _seq; |
| 26719 | } |
| 26720 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26721 | // _loop0_135: ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26722 | static asdl_seq * |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26723 | _loop0_135_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26724 | { |
| 26725 | D(p->level++); |
| 26726 | if (p->error_indicator) { |
| 26727 | D(p->level--); |
| 26728 | return NULL; |
| 26729 | } |
| 26730 | void *_res = NULL; |
| 26731 | int _mark = p->mark; |
| 26732 | int _start_mark = p->mark; |
| 26733 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26734 | if (!_children) { |
| 26735 | p->error_indicator = 1; |
| 26736 | PyErr_NoMemory(); |
| 26737 | D(p->level--); |
| 26738 | return NULL; |
| 26739 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26740 | Py_ssize_t _children_capacity = 1; |
| 26741 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26742 | { // ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26743 | if (p->error_indicator) { |
| 26744 | D(p->level--); |
| 26745 | return NULL; |
| 26746 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26747 | D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
| 26748 | Token * _literal; |
| 26749 | expr_ty elem; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26750 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26751 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26752 | && |
| 26753 | (elem = star_target_rule(p)) // star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26754 | ) |
| 26755 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26756 | _res = elem; |
| 26757 | if (_res == NULL && PyErr_Occurred()) { |
| 26758 | p->error_indicator = 1; |
| 26759 | PyMem_Free(_children); |
| 26760 | D(p->level--); |
| 26761 | return NULL; |
| 26762 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26763 | if (_n == _children_capacity) { |
| 26764 | _children_capacity *= 2; |
| 26765 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26766 | if (!_new_children) { |
| 26767 | p->error_indicator = 1; |
| 26768 | PyErr_NoMemory(); |
| 26769 | D(p->level--); |
| 26770 | return NULL; |
| 26771 | } |
| 26772 | _children = _new_children; |
| 26773 | } |
| 26774 | _children[_n++] = _res; |
| 26775 | _mark = p->mark; |
| 26776 | } |
| 26777 | p->mark = _mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26778 | D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26779 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26780 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26781 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26782 | if (!_seq) { |
| 26783 | PyMem_Free(_children); |
| 26784 | p->error_indicator = 1; |
| 26785 | PyErr_NoMemory(); |
| 26786 | D(p->level--); |
| 26787 | return NULL; |
| 26788 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26789 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26790 | PyMem_Free(_children); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26791 | _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26792 | D(p->level--); |
| 26793 | return _seq; |
| 26794 | } |
| 26795 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26796 | // _gather_134: star_target _loop0_135 |
| 26797 | static asdl_seq * |
| 26798 | _gather_134_rule(Parser *p) |
| 26799 | { |
| 26800 | D(p->level++); |
| 26801 | if (p->error_indicator) { |
| 26802 | D(p->level--); |
| 26803 | return NULL; |
| 26804 | } |
| 26805 | asdl_seq * _res = NULL; |
| 26806 | int _mark = p->mark; |
| 26807 | { // star_target _loop0_135 |
| 26808 | if (p->error_indicator) { |
| 26809 | D(p->level--); |
| 26810 | return NULL; |
| 26811 | } |
| 26812 | D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); |
| 26813 | expr_ty elem; |
| 26814 | asdl_seq * seq; |
| 26815 | if ( |
| 26816 | (elem = star_target_rule(p)) // star_target |
| 26817 | && |
| 26818 | (seq = _loop0_135_rule(p)) // _loop0_135 |
| 26819 | ) |
| 26820 | { |
| 26821 | D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); |
| 26822 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 26823 | goto done; |
| 26824 | } |
| 26825 | p->mark = _mark; |
| 26826 | D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', |
| 26827 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_135")); |
| 26828 | } |
| 26829 | _res = NULL; |
| 26830 | done: |
| 26831 | D(p->level--); |
| 26832 | return _res; |
| 26833 | } |
| 26834 | |
| 26835 | // _loop1_136: (',' star_target) |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26836 | static asdl_seq * |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26837 | _loop1_136_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26838 | { |
| 26839 | D(p->level++); |
| 26840 | if (p->error_indicator) { |
| 26841 | D(p->level--); |
| 26842 | return NULL; |
| 26843 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26844 | void *_res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26845 | int _mark = p->mark; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26846 | int _start_mark = p->mark; |
| 26847 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26848 | if (!_children) { |
| 26849 | p->error_indicator = 1; |
| 26850 | PyErr_NoMemory(); |
| 26851 | D(p->level--); |
| 26852 | return NULL; |
| 26853 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26854 | Py_ssize_t _children_capacity = 1; |
| 26855 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26856 | { // (',' star_target) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26857 | if (p->error_indicator) { |
| 26858 | D(p->level--); |
| 26859 | return NULL; |
| 26860 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26861 | D(fprintf(stderr, "%*c> _loop1_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); |
| 26862 | void *_tmp_174_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26863 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26864 | (_tmp_174_var = _tmp_174_rule(p)) // ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26865 | ) |
| 26866 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26867 | _res = _tmp_174_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26868 | if (_n == _children_capacity) { |
| 26869 | _children_capacity *= 2; |
| 26870 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26871 | if (!_new_children) { |
| 26872 | p->error_indicator = 1; |
| 26873 | PyErr_NoMemory(); |
| 26874 | D(p->level--); |
| 26875 | return NULL; |
| 26876 | } |
| 26877 | _children = _new_children; |
| 26878 | } |
| 26879 | _children[_n++] = _res; |
| 26880 | _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26881 | } |
| 26882 | p->mark = _mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26883 | D(fprintf(stderr, "%*c%s _loop1_136[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26884 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26885 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26886 | if (_n == 0 || p->error_indicator) { |
| 26887 | PyMem_Free(_children); |
| 26888 | D(p->level--); |
| 26889 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26890 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26891 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26892 | if (!_seq) { |
| 26893 | PyMem_Free(_children); |
| 26894 | p->error_indicator = 1; |
| 26895 | PyErr_NoMemory(); |
| 26896 | D(p->level--); |
| 26897 | return NULL; |
| 26898 | } |
| 26899 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26900 | PyMem_Free(_children); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26901 | _PyPegen_insert_memo(p, _start_mark, _loop1_136_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26902 | D(p->level--); |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26903 | return _seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26904 | } |
| 26905 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26906 | // _tmp_137: !'*' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26907 | static void * |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26908 | _tmp_137_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26909 | { |
| 26910 | D(p->level++); |
| 26911 | if (p->error_indicator) { |
| 26912 | D(p->level--); |
| 26913 | return NULL; |
| 26914 | } |
| 26915 | void * _res = NULL; |
| 26916 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26917 | { // !'*' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26918 | if (p->error_indicator) { |
| 26919 | D(p->level--); |
| 26920 | return NULL; |
| 26921 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26922 | D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); |
| 26923 | expr_ty star_target_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26924 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26925 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26926 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26927 | (star_target_var = star_target_rule(p)) // star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26928 | ) |
| 26929 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26930 | D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); |
| 26931 | _res = star_target_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26932 | goto done; |
| 26933 | } |
| 26934 | p->mark = _mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26935 | D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26936 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26937 | } |
| 26938 | _res = NULL; |
| 26939 | done: |
| 26940 | D(p->level--); |
| 26941 | return _res; |
| 26942 | } |
| 26943 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26944 | // _loop0_139: ',' del_target |
| 26945 | static asdl_seq * |
| 26946 | _loop0_139_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26947 | { |
| 26948 | D(p->level++); |
| 26949 | if (p->error_indicator) { |
| 26950 | D(p->level--); |
| 26951 | return NULL; |
| 26952 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26953 | void *_res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26954 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26955 | int _start_mark = p->mark; |
| 26956 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26957 | if (!_children) { |
| 26958 | p->error_indicator = 1; |
| 26959 | PyErr_NoMemory(); |
| 26960 | D(p->level--); |
| 26961 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26962 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26963 | Py_ssize_t _children_capacity = 1; |
| 26964 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26965 | { // ',' del_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26966 | if (p->error_indicator) { |
| 26967 | D(p->level--); |
| 26968 | return NULL; |
| 26969 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26970 | D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26971 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26972 | expr_ty elem; |
| 26973 | while ( |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26974 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26975 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26976 | (elem = del_target_rule(p)) // del_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26977 | ) |
| 26978 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26979 | _res = elem; |
| 26980 | if (_res == NULL && PyErr_Occurred()) { |
| 26981 | p->error_indicator = 1; |
| 26982 | PyMem_Free(_children); |
| 26983 | D(p->level--); |
| 26984 | return NULL; |
| 26985 | } |
| 26986 | if (_n == _children_capacity) { |
| 26987 | _children_capacity *= 2; |
| 26988 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26989 | if (!_new_children) { |
| 26990 | p->error_indicator = 1; |
| 26991 | PyErr_NoMemory(); |
| 26992 | D(p->level--); |
| 26993 | return NULL; |
| 26994 | } |
| 26995 | _children = _new_children; |
| 26996 | } |
| 26997 | _children[_n++] = _res; |
| 26998 | _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26999 | } |
| 27000 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27001 | D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', |
| 27002 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27003 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27004 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27005 | if (!_seq) { |
| 27006 | PyMem_Free(_children); |
| 27007 | p->error_indicator = 1; |
| 27008 | PyErr_NoMemory(); |
| 27009 | D(p->level--); |
| 27010 | return NULL; |
| 27011 | } |
| 27012 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27013 | PyMem_Free(_children); |
| 27014 | _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27015 | D(p->level--); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27016 | return _seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27017 | } |
| 27018 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27019 | // _gather_138: del_target _loop0_139 |
| 27020 | static asdl_seq * |
| 27021 | _gather_138_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27022 | { |
| 27023 | D(p->level++); |
| 27024 | if (p->error_indicator) { |
| 27025 | D(p->level--); |
| 27026 | return NULL; |
| 27027 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27028 | asdl_seq * _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27029 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27030 | { // del_target _loop0_139 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27031 | if (p->error_indicator) { |
| 27032 | D(p->level--); |
| 27033 | return NULL; |
| 27034 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27035 | D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_139")); |
| 27036 | expr_ty elem; |
| 27037 | asdl_seq * seq; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27038 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27039 | (elem = del_target_rule(p)) // del_target |
| 27040 | && |
| 27041 | (seq = _loop0_139_rule(p)) // _loop0_139 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27042 | ) |
| 27043 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27044 | D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_139")); |
| 27045 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27046 | goto done; |
| 27047 | } |
| 27048 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27049 | D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', |
| 27050 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_139")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27051 | } |
| 27052 | _res = NULL; |
| 27053 | done: |
| 27054 | D(p->level--); |
| 27055 | return _res; |
| 27056 | } |
| 27057 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27058 | // _loop0_141: ',' target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27059 | static asdl_seq * |
| 27060 | _loop0_141_rule(Parser *p) |
| 27061 | { |
| 27062 | D(p->level++); |
| 27063 | if (p->error_indicator) { |
| 27064 | D(p->level--); |
| 27065 | return NULL; |
| 27066 | } |
| 27067 | void *_res = NULL; |
| 27068 | int _mark = p->mark; |
| 27069 | int _start_mark = p->mark; |
| 27070 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27071 | if (!_children) { |
| 27072 | p->error_indicator = 1; |
| 27073 | PyErr_NoMemory(); |
| 27074 | D(p->level--); |
| 27075 | return NULL; |
| 27076 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27077 | Py_ssize_t _children_capacity = 1; |
| 27078 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27079 | { // ',' target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27080 | if (p->error_indicator) { |
| 27081 | D(p->level--); |
| 27082 | return NULL; |
| 27083 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27084 | D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27085 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27086 | expr_ty elem; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27087 | while ( |
| 27088 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 27089 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27090 | (elem = target_rule(p)) // target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27091 | ) |
| 27092 | { |
| 27093 | _res = elem; |
| 27094 | if (_res == NULL && PyErr_Occurred()) { |
| 27095 | p->error_indicator = 1; |
| 27096 | PyMem_Free(_children); |
| 27097 | D(p->level--); |
| 27098 | return NULL; |
| 27099 | } |
| 27100 | if (_n == _children_capacity) { |
| 27101 | _children_capacity *= 2; |
| 27102 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27103 | if (!_new_children) { |
| 27104 | p->error_indicator = 1; |
| 27105 | PyErr_NoMemory(); |
| 27106 | D(p->level--); |
| 27107 | return NULL; |
| 27108 | } |
| 27109 | _children = _new_children; |
| 27110 | } |
| 27111 | _children[_n++] = _res; |
| 27112 | _mark = p->mark; |
| 27113 | } |
| 27114 | p->mark = _mark; |
| 27115 | D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27116 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27117 | } |
| 27118 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27119 | if (!_seq) { |
| 27120 | PyMem_Free(_children); |
| 27121 | p->error_indicator = 1; |
| 27122 | PyErr_NoMemory(); |
| 27123 | D(p->level--); |
| 27124 | return NULL; |
| 27125 | } |
| 27126 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27127 | PyMem_Free(_children); |
| 27128 | _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); |
| 27129 | D(p->level--); |
| 27130 | return _seq; |
| 27131 | } |
| 27132 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27133 | // _gather_140: target _loop0_141 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27134 | static asdl_seq * |
| 27135 | _gather_140_rule(Parser *p) |
| 27136 | { |
| 27137 | D(p->level++); |
| 27138 | if (p->error_indicator) { |
| 27139 | D(p->level--); |
| 27140 | return NULL; |
| 27141 | } |
| 27142 | asdl_seq * _res = NULL; |
| 27143 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27144 | { // target _loop0_141 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27145 | if (p->error_indicator) { |
| 27146 | D(p->level--); |
| 27147 | return NULL; |
| 27148 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27149 | D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_141")); |
| 27150 | expr_ty elem; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27151 | asdl_seq * seq; |
| 27152 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27153 | (elem = target_rule(p)) // target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27154 | && |
| 27155 | (seq = _loop0_141_rule(p)) // _loop0_141 |
| 27156 | ) |
| 27157 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27158 | D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_141")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27159 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 27160 | goto done; |
| 27161 | } |
| 27162 | p->mark = _mark; |
| 27163 | D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27164 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_141")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27165 | } |
| 27166 | _res = NULL; |
| 27167 | done: |
| 27168 | D(p->level--); |
| 27169 | return _res; |
| 27170 | } |
| 27171 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27172 | // _tmp_142: args | expression for_if_clauses |
| 27173 | static void * |
| 27174 | _tmp_142_rule(Parser *p) |
| 27175 | { |
| 27176 | D(p->level++); |
| 27177 | if (p->error_indicator) { |
| 27178 | D(p->level--); |
| 27179 | return NULL; |
| 27180 | } |
| 27181 | void * _res = NULL; |
| 27182 | int _mark = p->mark; |
| 27183 | { // args |
| 27184 | if (p->error_indicator) { |
| 27185 | D(p->level--); |
| 27186 | return NULL; |
| 27187 | } |
| 27188 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); |
| 27189 | expr_ty args_var; |
| 27190 | if ( |
| 27191 | (args_var = args_rule(p)) // args |
| 27192 | ) |
| 27193 | { |
| 27194 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); |
| 27195 | _res = args_var; |
| 27196 | goto done; |
| 27197 | } |
| 27198 | p->mark = _mark; |
| 27199 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', |
| 27200 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); |
| 27201 | } |
| 27202 | { // expression for_if_clauses |
| 27203 | if (p->error_indicator) { |
| 27204 | D(p->level--); |
| 27205 | return NULL; |
| 27206 | } |
| 27207 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); |
| 27208 | expr_ty expression_var; |
| 27209 | asdl_comprehension_seq* for_if_clauses_var; |
| 27210 | if ( |
| 27211 | (expression_var = expression_rule(p)) // expression |
| 27212 | && |
| 27213 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 27214 | ) |
| 27215 | { |
| 27216 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); |
| 27217 | _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); |
| 27218 | goto done; |
| 27219 | } |
| 27220 | p->mark = _mark; |
| 27221 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', |
| 27222 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); |
| 27223 | } |
| 27224 | _res = NULL; |
| 27225 | done: |
| 27226 | D(p->level--); |
| 27227 | return _res; |
| 27228 | } |
| 27229 | |
| 27230 | // _loop0_143: star_named_expressions |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27231 | static asdl_seq * |
| 27232 | _loop0_143_rule(Parser *p) |
| 27233 | { |
| 27234 | D(p->level++); |
| 27235 | if (p->error_indicator) { |
| 27236 | D(p->level--); |
| 27237 | return NULL; |
| 27238 | } |
| 27239 | void *_res = NULL; |
| 27240 | int _mark = p->mark; |
| 27241 | int _start_mark = p->mark; |
| 27242 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27243 | if (!_children) { |
| 27244 | p->error_indicator = 1; |
| 27245 | PyErr_NoMemory(); |
| 27246 | D(p->level--); |
| 27247 | return NULL; |
| 27248 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27249 | Py_ssize_t _children_capacity = 1; |
| 27250 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27251 | { // star_named_expressions |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27252 | if (p->error_indicator) { |
| 27253 | D(p->level--); |
| 27254 | return NULL; |
| 27255 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27256 | D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); |
| 27257 | asdl_expr_seq* star_named_expressions_var; |
| 27258 | while ( |
| 27259 | (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions |
| 27260 | ) |
| 27261 | { |
| 27262 | _res = star_named_expressions_var; |
| 27263 | if (_n == _children_capacity) { |
| 27264 | _children_capacity *= 2; |
| 27265 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27266 | if (!_new_children) { |
| 27267 | p->error_indicator = 1; |
| 27268 | PyErr_NoMemory(); |
| 27269 | D(p->level--); |
| 27270 | return NULL; |
| 27271 | } |
| 27272 | _children = _new_children; |
| 27273 | } |
| 27274 | _children[_n++] = _res; |
| 27275 | _mark = p->mark; |
| 27276 | } |
| 27277 | p->mark = _mark; |
| 27278 | D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', |
| 27279 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); |
| 27280 | } |
| 27281 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27282 | if (!_seq) { |
| 27283 | PyMem_Free(_children); |
| 27284 | p->error_indicator = 1; |
| 27285 | PyErr_NoMemory(); |
| 27286 | D(p->level--); |
| 27287 | return NULL; |
| 27288 | } |
| 27289 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27290 | PyMem_Free(_children); |
| 27291 | _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); |
| 27292 | D(p->level--); |
| 27293 | return _seq; |
| 27294 | } |
| 27295 | |
| 27296 | // _loop0_144: (star_targets '=') |
| 27297 | static asdl_seq * |
| 27298 | _loop0_144_rule(Parser *p) |
| 27299 | { |
| 27300 | D(p->level++); |
| 27301 | if (p->error_indicator) { |
| 27302 | D(p->level--); |
| 27303 | return NULL; |
| 27304 | } |
| 27305 | void *_res = NULL; |
| 27306 | int _mark = p->mark; |
| 27307 | int _start_mark = p->mark; |
| 27308 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27309 | if (!_children) { |
| 27310 | p->error_indicator = 1; |
| 27311 | PyErr_NoMemory(); |
| 27312 | D(p->level--); |
| 27313 | return NULL; |
| 27314 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27315 | Py_ssize_t _children_capacity = 1; |
| 27316 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27317 | { // (star_targets '=') |
| 27318 | if (p->error_indicator) { |
| 27319 | D(p->level--); |
| 27320 | return NULL; |
| 27321 | } |
| 27322 | D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
| 27323 | void *_tmp_175_var; |
| 27324 | while ( |
| 27325 | (_tmp_175_var = _tmp_175_rule(p)) // star_targets '=' |
| 27326 | ) |
| 27327 | { |
| 27328 | _res = _tmp_175_var; |
| 27329 | if (_n == _children_capacity) { |
| 27330 | _children_capacity *= 2; |
| 27331 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27332 | if (!_new_children) { |
| 27333 | p->error_indicator = 1; |
| 27334 | PyErr_NoMemory(); |
| 27335 | D(p->level--); |
| 27336 | return NULL; |
| 27337 | } |
| 27338 | _children = _new_children; |
| 27339 | } |
| 27340 | _children[_n++] = _res; |
| 27341 | _mark = p->mark; |
| 27342 | } |
| 27343 | p->mark = _mark; |
| 27344 | D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', |
| 27345 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
| 27346 | } |
| 27347 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27348 | if (!_seq) { |
| 27349 | PyMem_Free(_children); |
| 27350 | p->error_indicator = 1; |
| 27351 | PyErr_NoMemory(); |
| 27352 | D(p->level--); |
| 27353 | return NULL; |
| 27354 | } |
| 27355 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27356 | PyMem_Free(_children); |
| 27357 | _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); |
| 27358 | D(p->level--); |
| 27359 | return _seq; |
| 27360 | } |
| 27361 | |
| 27362 | // _loop0_145: (star_targets '=') |
| 27363 | static asdl_seq * |
| 27364 | _loop0_145_rule(Parser *p) |
| 27365 | { |
| 27366 | D(p->level++); |
| 27367 | if (p->error_indicator) { |
| 27368 | D(p->level--); |
| 27369 | return NULL; |
| 27370 | } |
| 27371 | void *_res = NULL; |
| 27372 | int _mark = p->mark; |
| 27373 | int _start_mark = p->mark; |
| 27374 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27375 | if (!_children) { |
| 27376 | p->error_indicator = 1; |
| 27377 | PyErr_NoMemory(); |
| 27378 | D(p->level--); |
| 27379 | return NULL; |
| 27380 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27381 | Py_ssize_t _children_capacity = 1; |
| 27382 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27383 | { // (star_targets '=') |
| 27384 | if (p->error_indicator) { |
| 27385 | D(p->level--); |
| 27386 | return NULL; |
| 27387 | } |
| 27388 | D(fprintf(stderr, "%*c> _loop0_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
| 27389 | void *_tmp_176_var; |
| 27390 | while ( |
| 27391 | (_tmp_176_var = _tmp_176_rule(p)) // star_targets '=' |
| 27392 | ) |
| 27393 | { |
| 27394 | _res = _tmp_176_var; |
| 27395 | if (_n == _children_capacity) { |
| 27396 | _children_capacity *= 2; |
| 27397 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27398 | if (!_new_children) { |
| 27399 | p->error_indicator = 1; |
| 27400 | PyErr_NoMemory(); |
| 27401 | D(p->level--); |
| 27402 | return NULL; |
| 27403 | } |
| 27404 | _children = _new_children; |
| 27405 | } |
| 27406 | _children[_n++] = _res; |
| 27407 | _mark = p->mark; |
| 27408 | } |
| 27409 | p->mark = _mark; |
| 27410 | D(fprintf(stderr, "%*c%s _loop0_145[%d-%d]: %s failed!\n", p->level, ' ', |
| 27411 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
| 27412 | } |
| 27413 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27414 | if (!_seq) { |
| 27415 | PyMem_Free(_children); |
| 27416 | p->error_indicator = 1; |
| 27417 | PyErr_NoMemory(); |
| 27418 | D(p->level--); |
| 27419 | return NULL; |
| 27420 | } |
| 27421 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27422 | PyMem_Free(_children); |
| 27423 | _PyPegen_insert_memo(p, _start_mark, _loop0_145_type, _seq); |
| 27424 | D(p->level--); |
| 27425 | return _seq; |
| 27426 | } |
| 27427 | |
| 27428 | // _tmp_146: yield_expr | star_expressions |
| 27429 | static void * |
| 27430 | _tmp_146_rule(Parser *p) |
| 27431 | { |
| 27432 | D(p->level++); |
| 27433 | if (p->error_indicator) { |
| 27434 | D(p->level--); |
| 27435 | return NULL; |
| 27436 | } |
| 27437 | void * _res = NULL; |
| 27438 | int _mark = p->mark; |
| 27439 | { // yield_expr |
| 27440 | if (p->error_indicator) { |
| 27441 | D(p->level--); |
| 27442 | return NULL; |
| 27443 | } |
| 27444 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 27445 | expr_ty yield_expr_var; |
| 27446 | if ( |
| 27447 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 27448 | ) |
| 27449 | { |
| 27450 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 27451 | _res = yield_expr_var; |
| 27452 | goto done; |
| 27453 | } |
| 27454 | p->mark = _mark; |
| 27455 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', |
| 27456 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 27457 | } |
| 27458 | { // star_expressions |
| 27459 | if (p->error_indicator) { |
| 27460 | D(p->level--); |
| 27461 | return NULL; |
| 27462 | } |
| 27463 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 27464 | expr_ty star_expressions_var; |
| 27465 | if ( |
| 27466 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 27467 | ) |
| 27468 | { |
| 27469 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 27470 | _res = star_expressions_var; |
| 27471 | goto done; |
| 27472 | } |
| 27473 | p->mark = _mark; |
| 27474 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', |
| 27475 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 27476 | } |
| 27477 | _res = NULL; |
| 27478 | done: |
| 27479 | D(p->level--); |
| 27480 | return _res; |
| 27481 | } |
| 27482 | |
| 27483 | // _tmp_147: '[' | '(' | '{' |
| 27484 | static void * |
| 27485 | _tmp_147_rule(Parser *p) |
| 27486 | { |
| 27487 | D(p->level++); |
| 27488 | if (p->error_indicator) { |
| 27489 | D(p->level--); |
| 27490 | return NULL; |
| 27491 | } |
| 27492 | void * _res = NULL; |
| 27493 | int _mark = p->mark; |
| 27494 | { // '[' |
| 27495 | if (p->error_indicator) { |
| 27496 | D(p->level--); |
| 27497 | return NULL; |
| 27498 | } |
| 27499 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
| 27500 | Token * _literal; |
| 27501 | if ( |
| 27502 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 27503 | ) |
| 27504 | { |
| 27505 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
| 27506 | _res = _literal; |
| 27507 | goto done; |
| 27508 | } |
| 27509 | p->mark = _mark; |
| 27510 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 27511 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
| 27512 | } |
| 27513 | { // '(' |
| 27514 | if (p->error_indicator) { |
| 27515 | D(p->level--); |
| 27516 | return NULL; |
| 27517 | } |
| 27518 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
| 27519 | Token * _literal; |
| 27520 | if ( |
| 27521 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 27522 | ) |
| 27523 | { |
| 27524 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
| 27525 | _res = _literal; |
| 27526 | goto done; |
| 27527 | } |
| 27528 | p->mark = _mark; |
| 27529 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 27530 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
| 27531 | } |
| 27532 | { // '{' |
| 27533 | if (p->error_indicator) { |
| 27534 | D(p->level--); |
| 27535 | return NULL; |
| 27536 | } |
| 27537 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); |
| 27538 | Token * _literal; |
| 27539 | if ( |
| 27540 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 27541 | ) |
| 27542 | { |
| 27543 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); |
| 27544 | _res = _literal; |
| 27545 | goto done; |
| 27546 | } |
| 27547 | p->mark = _mark; |
| 27548 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 27549 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); |
| 27550 | } |
| 27551 | _res = NULL; |
| 27552 | done: |
| 27553 | D(p->level--); |
| 27554 | return _res; |
| 27555 | } |
| 27556 | |
| 27557 | // _tmp_148: '[' | '{' |
| 27558 | static void * |
| 27559 | _tmp_148_rule(Parser *p) |
| 27560 | { |
| 27561 | D(p->level++); |
| 27562 | if (p->error_indicator) { |
| 27563 | D(p->level--); |
| 27564 | return NULL; |
| 27565 | } |
| 27566 | void * _res = NULL; |
| 27567 | int _mark = p->mark; |
| 27568 | { // '[' |
| 27569 | if (p->error_indicator) { |
| 27570 | D(p->level--); |
| 27571 | return NULL; |
| 27572 | } |
| 27573 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
| 27574 | Token * _literal; |
| 27575 | if ( |
| 27576 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 27577 | ) |
| 27578 | { |
| 27579 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
| 27580 | _res = _literal; |
| 27581 | goto done; |
| 27582 | } |
| 27583 | p->mark = _mark; |
| 27584 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', |
| 27585 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
| 27586 | } |
| 27587 | { // '{' |
| 27588 | if (p->error_indicator) { |
| 27589 | D(p->level--); |
| 27590 | return NULL; |
| 27591 | } |
| 27592 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); |
| 27593 | Token * _literal; |
| 27594 | if ( |
| 27595 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 27596 | ) |
| 27597 | { |
| 27598 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); |
| 27599 | _res = _literal; |
| 27600 | goto done; |
| 27601 | } |
| 27602 | p->mark = _mark; |
| 27603 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', |
| 27604 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); |
| 27605 | } |
| 27606 | _res = NULL; |
| 27607 | done: |
| 27608 | D(p->level--); |
| 27609 | return _res; |
| 27610 | } |
| 27611 | |
| 27612 | // _loop0_149: param_no_default |
| 27613 | static asdl_seq * |
| 27614 | _loop0_149_rule(Parser *p) |
| 27615 | { |
| 27616 | D(p->level++); |
| 27617 | if (p->error_indicator) { |
| 27618 | D(p->level--); |
| 27619 | return NULL; |
| 27620 | } |
| 27621 | void *_res = NULL; |
| 27622 | int _mark = p->mark; |
| 27623 | int _start_mark = p->mark; |
| 27624 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27625 | if (!_children) { |
| 27626 | p->error_indicator = 1; |
| 27627 | PyErr_NoMemory(); |
| 27628 | D(p->level--); |
| 27629 | return NULL; |
| 27630 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27631 | Py_ssize_t _children_capacity = 1; |
| 27632 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27633 | { // param_no_default |
| 27634 | if (p->error_indicator) { |
| 27635 | D(p->level--); |
| 27636 | return NULL; |
| 27637 | } |
| 27638 | D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
| 27639 | arg_ty param_no_default_var; |
| 27640 | while ( |
| 27641 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 27642 | ) |
| 27643 | { |
| 27644 | _res = param_no_default_var; |
| 27645 | if (_n == _children_capacity) { |
| 27646 | _children_capacity *= 2; |
| 27647 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27648 | if (!_new_children) { |
| 27649 | p->error_indicator = 1; |
| 27650 | PyErr_NoMemory(); |
| 27651 | D(p->level--); |
| 27652 | return NULL; |
| 27653 | } |
| 27654 | _children = _new_children; |
| 27655 | } |
| 27656 | _children[_n++] = _res; |
| 27657 | _mark = p->mark; |
| 27658 | } |
| 27659 | p->mark = _mark; |
| 27660 | D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', |
| 27661 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 27662 | } |
| 27663 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27664 | if (!_seq) { |
| 27665 | PyMem_Free(_children); |
| 27666 | p->error_indicator = 1; |
| 27667 | PyErr_NoMemory(); |
| 27668 | D(p->level--); |
| 27669 | return NULL; |
| 27670 | } |
| 27671 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27672 | PyMem_Free(_children); |
| 27673 | _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); |
| 27674 | D(p->level--); |
| 27675 | return _seq; |
| 27676 | } |
| 27677 | |
| 27678 | // _loop1_150: param_with_default |
| 27679 | static asdl_seq * |
| 27680 | _loop1_150_rule(Parser *p) |
| 27681 | { |
| 27682 | D(p->level++); |
| 27683 | if (p->error_indicator) { |
| 27684 | D(p->level--); |
| 27685 | return NULL; |
| 27686 | } |
| 27687 | void *_res = NULL; |
| 27688 | int _mark = p->mark; |
| 27689 | int _start_mark = p->mark; |
| 27690 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27691 | if (!_children) { |
| 27692 | p->error_indicator = 1; |
| 27693 | PyErr_NoMemory(); |
| 27694 | D(p->level--); |
| 27695 | return NULL; |
| 27696 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27697 | Py_ssize_t _children_capacity = 1; |
| 27698 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27699 | { // param_with_default |
| 27700 | if (p->error_indicator) { |
| 27701 | D(p->level--); |
| 27702 | return NULL; |
| 27703 | } |
| 27704 | D(fprintf(stderr, "%*c> _loop1_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
| 27705 | NameDefaultPair* param_with_default_var; |
| 27706 | while ( |
| 27707 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 27708 | ) |
| 27709 | { |
| 27710 | _res = param_with_default_var; |
| 27711 | if (_n == _children_capacity) { |
| 27712 | _children_capacity *= 2; |
| 27713 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27714 | if (!_new_children) { |
| 27715 | p->error_indicator = 1; |
| 27716 | PyErr_NoMemory(); |
| 27717 | D(p->level--); |
| 27718 | return NULL; |
| 27719 | } |
| 27720 | _children = _new_children; |
| 27721 | } |
| 27722 | _children[_n++] = _res; |
| 27723 | _mark = p->mark; |
| 27724 | } |
| 27725 | p->mark = _mark; |
| 27726 | D(fprintf(stderr, "%*c%s _loop1_150[%d-%d]: %s failed!\n", p->level, ' ', |
| 27727 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 27728 | } |
| 27729 | if (_n == 0 || p->error_indicator) { |
| 27730 | PyMem_Free(_children); |
| 27731 | D(p->level--); |
| 27732 | return NULL; |
| 27733 | } |
| 27734 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27735 | if (!_seq) { |
| 27736 | PyMem_Free(_children); |
| 27737 | p->error_indicator = 1; |
| 27738 | PyErr_NoMemory(); |
| 27739 | D(p->level--); |
| 27740 | return NULL; |
| 27741 | } |
| 27742 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27743 | PyMem_Free(_children); |
| 27744 | _PyPegen_insert_memo(p, _start_mark, _loop1_150_type, _seq); |
| 27745 | D(p->level--); |
| 27746 | return _seq; |
| 27747 | } |
| 27748 | |
| 27749 | // _loop0_151: lambda_param_no_default |
| 27750 | static asdl_seq * |
| 27751 | _loop0_151_rule(Parser *p) |
| 27752 | { |
| 27753 | D(p->level++); |
| 27754 | if (p->error_indicator) { |
| 27755 | D(p->level--); |
| 27756 | return NULL; |
| 27757 | } |
| 27758 | void *_res = NULL; |
| 27759 | int _mark = p->mark; |
| 27760 | int _start_mark = p->mark; |
| 27761 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27762 | if (!_children) { |
| 27763 | p->error_indicator = 1; |
| 27764 | PyErr_NoMemory(); |
| 27765 | D(p->level--); |
| 27766 | return NULL; |
| 27767 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27768 | Py_ssize_t _children_capacity = 1; |
| 27769 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27770 | { // lambda_param_no_default |
| 27771 | if (p->error_indicator) { |
| 27772 | D(p->level--); |
| 27773 | return NULL; |
| 27774 | } |
| 27775 | D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
| 27776 | arg_ty lambda_param_no_default_var; |
| 27777 | while ( |
| 27778 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 27779 | ) |
| 27780 | { |
| 27781 | _res = lambda_param_no_default_var; |
| 27782 | if (_n == _children_capacity) { |
| 27783 | _children_capacity *= 2; |
| 27784 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27785 | if (!_new_children) { |
| 27786 | p->error_indicator = 1; |
| 27787 | PyErr_NoMemory(); |
| 27788 | D(p->level--); |
| 27789 | return NULL; |
| 27790 | } |
| 27791 | _children = _new_children; |
| 27792 | } |
| 27793 | _children[_n++] = _res; |
| 27794 | _mark = p->mark; |
| 27795 | } |
| 27796 | p->mark = _mark; |
| 27797 | D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', |
| 27798 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 27799 | } |
| 27800 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27801 | if (!_seq) { |
| 27802 | PyMem_Free(_children); |
| 27803 | p->error_indicator = 1; |
| 27804 | PyErr_NoMemory(); |
| 27805 | D(p->level--); |
| 27806 | return NULL; |
| 27807 | } |
| 27808 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27809 | PyMem_Free(_children); |
| 27810 | _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); |
| 27811 | D(p->level--); |
| 27812 | return _seq; |
| 27813 | } |
| 27814 | |
| 27815 | // _loop1_152: lambda_param_with_default |
| 27816 | static asdl_seq * |
| 27817 | _loop1_152_rule(Parser *p) |
| 27818 | { |
| 27819 | D(p->level++); |
| 27820 | if (p->error_indicator) { |
| 27821 | D(p->level--); |
| 27822 | return NULL; |
| 27823 | } |
| 27824 | void *_res = NULL; |
| 27825 | int _mark = p->mark; |
| 27826 | int _start_mark = p->mark; |
| 27827 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27828 | if (!_children) { |
| 27829 | p->error_indicator = 1; |
| 27830 | PyErr_NoMemory(); |
| 27831 | D(p->level--); |
| 27832 | return NULL; |
| 27833 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27834 | Py_ssize_t _children_capacity = 1; |
| 27835 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27836 | { // lambda_param_with_default |
| 27837 | if (p->error_indicator) { |
| 27838 | D(p->level--); |
| 27839 | return NULL; |
| 27840 | } |
| 27841 | D(fprintf(stderr, "%*c> _loop1_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
| 27842 | NameDefaultPair* lambda_param_with_default_var; |
| 27843 | while ( |
| 27844 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 27845 | ) |
| 27846 | { |
| 27847 | _res = lambda_param_with_default_var; |
| 27848 | if (_n == _children_capacity) { |
| 27849 | _children_capacity *= 2; |
| 27850 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27851 | if (!_new_children) { |
| 27852 | p->error_indicator = 1; |
| 27853 | PyErr_NoMemory(); |
| 27854 | D(p->level--); |
| 27855 | return NULL; |
| 27856 | } |
| 27857 | _children = _new_children; |
| 27858 | } |
| 27859 | _children[_n++] = _res; |
| 27860 | _mark = p->mark; |
| 27861 | } |
| 27862 | p->mark = _mark; |
| 27863 | D(fprintf(stderr, "%*c%s _loop1_152[%d-%d]: %s failed!\n", p->level, ' ', |
| 27864 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 27865 | } |
| 27866 | if (_n == 0 || p->error_indicator) { |
| 27867 | PyMem_Free(_children); |
| 27868 | D(p->level--); |
| 27869 | return NULL; |
| 27870 | } |
| 27871 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27872 | if (!_seq) { |
| 27873 | PyMem_Free(_children); |
| 27874 | p->error_indicator = 1; |
| 27875 | PyErr_NoMemory(); |
| 27876 | D(p->level--); |
| 27877 | return NULL; |
| 27878 | } |
| 27879 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27880 | PyMem_Free(_children); |
| 27881 | _PyPegen_insert_memo(p, _start_mark, _loop1_152_type, _seq); |
| 27882 | D(p->level--); |
| 27883 | return _seq; |
| 27884 | } |
| 27885 | |
| 27886 | // _tmp_153: ')' | ',' (')' | '**') |
| 27887 | static void * |
| 27888 | _tmp_153_rule(Parser *p) |
| 27889 | { |
| 27890 | D(p->level++); |
| 27891 | if (p->error_indicator) { |
| 27892 | D(p->level--); |
| 27893 | return NULL; |
| 27894 | } |
| 27895 | void * _res = NULL; |
| 27896 | int _mark = p->mark; |
| 27897 | { // ')' |
| 27898 | if (p->error_indicator) { |
| 27899 | D(p->level--); |
| 27900 | return NULL; |
| 27901 | } |
| 27902 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
| 27903 | Token * _literal; |
| 27904 | if ( |
| 27905 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 27906 | ) |
| 27907 | { |
| 27908 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
| 27909 | _res = _literal; |
| 27910 | goto done; |
| 27911 | } |
| 27912 | p->mark = _mark; |
| 27913 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', |
| 27914 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
| 27915 | } |
| 27916 | { // ',' (')' | '**') |
| 27917 | if (p->error_indicator) { |
| 27918 | D(p->level--); |
| 27919 | return NULL; |
| 27920 | } |
| 27921 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
| 27922 | Token * _literal; |
| 27923 | void *_tmp_177_var; |
| 27924 | if ( |
| 27925 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 27926 | && |
| 27927 | (_tmp_177_var = _tmp_177_rule(p)) // ')' | '**' |
| 27928 | ) |
| 27929 | { |
| 27930 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
| 27931 | _res = _PyPegen_dummy_name(p, _literal, _tmp_177_var); |
| 27932 | goto done; |
| 27933 | } |
| 27934 | p->mark = _mark; |
| 27935 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', |
| 27936 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); |
| 27937 | } |
| 27938 | _res = NULL; |
| 27939 | done: |
| 27940 | D(p->level--); |
| 27941 | return _res; |
| 27942 | } |
| 27943 | |
| 27944 | // _tmp_154: ':' | ',' (':' | '**') |
| 27945 | static void * |
| 27946 | _tmp_154_rule(Parser *p) |
| 27947 | { |
| 27948 | D(p->level++); |
| 27949 | if (p->error_indicator) { |
| 27950 | D(p->level--); |
| 27951 | return NULL; |
| 27952 | } |
| 27953 | void * _res = NULL; |
| 27954 | int _mark = p->mark; |
| 27955 | { // ':' |
| 27956 | if (p->error_indicator) { |
| 27957 | D(p->level--); |
| 27958 | return NULL; |
| 27959 | } |
| 27960 | D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
| 27961 | Token * _literal; |
| 27962 | if ( |
| 27963 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 27964 | ) |
| 27965 | { |
| 27966 | D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
| 27967 | _res = _literal; |
| 27968 | goto done; |
| 27969 | } |
| 27970 | p->mark = _mark; |
| 27971 | D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', |
| 27972 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
| 27973 | } |
| 27974 | { // ',' (':' | '**') |
| 27975 | if (p->error_indicator) { |
| 27976 | D(p->level--); |
| 27977 | return NULL; |
| 27978 | } |
| 27979 | D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
| 27980 | Token * _literal; |
| 27981 | void *_tmp_178_var; |
| 27982 | if ( |
| 27983 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 27984 | && |
| 27985 | (_tmp_178_var = _tmp_178_rule(p)) // ':' | '**' |
| 27986 | ) |
| 27987 | { |
| 27988 | D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
| 27989 | _res = _PyPegen_dummy_name(p, _literal, _tmp_178_var); |
| 27990 | goto done; |
| 27991 | } |
| 27992 | p->mark = _mark; |
| 27993 | D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', |
| 27994 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); |
| 27995 | } |
| 27996 | _res = NULL; |
| 27997 | done: |
| 27998 | D(p->level--); |
| 27999 | return _res; |
| 28000 | } |
| 28001 | |
| 28002 | // _tmp_155: ',' | ')' | ':' |
| 28003 | static void * |
| 28004 | _tmp_155_rule(Parser *p) |
| 28005 | { |
| 28006 | D(p->level++); |
| 28007 | if (p->error_indicator) { |
| 28008 | D(p->level--); |
| 28009 | return NULL; |
| 28010 | } |
| 28011 | void * _res = NULL; |
| 28012 | int _mark = p->mark; |
| 28013 | { // ',' |
| 28014 | if (p->error_indicator) { |
| 28015 | D(p->level--); |
| 28016 | return NULL; |
| 28017 | } |
| 28018 | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
| 28019 | Token * _literal; |
| 28020 | if ( |
| 28021 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28022 | ) |
| 28023 | { |
| 28024 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
| 28025 | _res = _literal; |
| 28026 | goto done; |
| 28027 | } |
| 28028 | p->mark = _mark; |
| 28029 | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
| 28030 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
| 28031 | } |
| 28032 | { // ')' |
| 28033 | if (p->error_indicator) { |
| 28034 | D(p->level--); |
| 28035 | return NULL; |
| 28036 | } |
| 28037 | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
| 28038 | Token * _literal; |
| 28039 | if ( |
| 28040 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 28041 | ) |
| 28042 | { |
| 28043 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
| 28044 | _res = _literal; |
| 28045 | goto done; |
| 28046 | } |
| 28047 | p->mark = _mark; |
| 28048 | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
| 28049 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
| 28050 | } |
| 28051 | { // ':' |
| 28052 | if (p->error_indicator) { |
| 28053 | D(p->level--); |
| 28054 | return NULL; |
| 28055 | } |
| 28056 | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
| 28057 | Token * _literal; |
| 28058 | if ( |
| 28059 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 28060 | ) |
| 28061 | { |
| 28062 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
| 28063 | _res = _literal; |
| 28064 | goto done; |
| 28065 | } |
| 28066 | p->mark = _mark; |
| 28067 | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
| 28068 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
| 28069 | } |
| 28070 | _res = NULL; |
| 28071 | done: |
| 28072 | D(p->level--); |
| 28073 | return _res; |
| 28074 | } |
| 28075 | |
| 28076 | // _loop0_157: ',' (expression ['as' star_target]) |
| 28077 | static asdl_seq * |
| 28078 | _loop0_157_rule(Parser *p) |
| 28079 | { |
| 28080 | D(p->level++); |
| 28081 | if (p->error_indicator) { |
| 28082 | D(p->level--); |
| 28083 | return NULL; |
| 28084 | } |
| 28085 | void *_res = NULL; |
| 28086 | int _mark = p->mark; |
| 28087 | int _start_mark = p->mark; |
| 28088 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 28089 | if (!_children) { |
| 28090 | p->error_indicator = 1; |
| 28091 | PyErr_NoMemory(); |
| 28092 | D(p->level--); |
| 28093 | return NULL; |
| 28094 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 28095 | Py_ssize_t _children_capacity = 1; |
| 28096 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28097 | { // ',' (expression ['as' star_target]) |
| 28098 | if (p->error_indicator) { |
| 28099 | D(p->level--); |
| 28100 | return NULL; |
| 28101 | } |
| 28102 | D(fprintf(stderr, "%*c> _loop0_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28103 | Token * _literal; |
| 28104 | void *elem; |
| 28105 | while ( |
| 28106 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28107 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28108 | (elem = _tmp_179_rule(p)) // expression ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28109 | ) |
| 28110 | { |
| 28111 | _res = elem; |
| 28112 | if (_res == NULL && PyErr_Occurred()) { |
| 28113 | p->error_indicator = 1; |
| 28114 | PyMem_Free(_children); |
| 28115 | D(p->level--); |
| 28116 | return NULL; |
| 28117 | } |
| 28118 | if (_n == _children_capacity) { |
| 28119 | _children_capacity *= 2; |
| 28120 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 28121 | if (!_new_children) { |
| 28122 | p->error_indicator = 1; |
| 28123 | PyErr_NoMemory(); |
| 28124 | D(p->level--); |
| 28125 | return NULL; |
| 28126 | } |
| 28127 | _children = _new_children; |
| 28128 | } |
| 28129 | _children[_n++] = _res; |
| 28130 | _mark = p->mark; |
| 28131 | } |
| 28132 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28133 | D(fprintf(stderr, "%*c%s _loop0_157[%d-%d]: %s failed!\n", p->level, ' ', |
| 28134 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])")); |
| 28135 | } |
| 28136 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 28137 | if (!_seq) { |
| 28138 | PyMem_Free(_children); |
| 28139 | p->error_indicator = 1; |
| 28140 | PyErr_NoMemory(); |
| 28141 | D(p->level--); |
| 28142 | return NULL; |
| 28143 | } |
| 28144 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 28145 | PyMem_Free(_children); |
| 28146 | _PyPegen_insert_memo(p, _start_mark, _loop0_157_type, _seq); |
| 28147 | D(p->level--); |
| 28148 | return _seq; |
| 28149 | } |
| 28150 | |
| 28151 | // _gather_156: (expression ['as' star_target]) _loop0_157 |
| 28152 | static asdl_seq * |
| 28153 | _gather_156_rule(Parser *p) |
| 28154 | { |
| 28155 | D(p->level++); |
| 28156 | if (p->error_indicator) { |
| 28157 | D(p->level--); |
| 28158 | return NULL; |
| 28159 | } |
| 28160 | asdl_seq * _res = NULL; |
| 28161 | int _mark = p->mark; |
| 28162 | { // (expression ['as' star_target]) _loop0_157 |
| 28163 | if (p->error_indicator) { |
| 28164 | D(p->level--); |
| 28165 | return NULL; |
| 28166 | } |
| 28167 | D(fprintf(stderr, "%*c> _gather_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_157")); |
| 28168 | void *elem; |
| 28169 | asdl_seq * seq; |
| 28170 | if ( |
| 28171 | (elem = _tmp_179_rule(p)) // expression ['as' star_target] |
| 28172 | && |
| 28173 | (seq = _loop0_157_rule(p)) // _loop0_157 |
| 28174 | ) |
| 28175 | { |
| 28176 | D(fprintf(stderr, "%*c+ _gather_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_157")); |
| 28177 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 28178 | goto done; |
| 28179 | } |
| 28180 | p->mark = _mark; |
| 28181 | D(fprintf(stderr, "%*c%s _gather_156[%d-%d]: %s failed!\n", p->level, ' ', |
| 28182 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_157")); |
| 28183 | } |
| 28184 | _res = NULL; |
| 28185 | done: |
| 28186 | D(p->level--); |
| 28187 | return _res; |
| 28188 | } |
| 28189 | |
| 28190 | // _loop0_159: ',' (expressions ['as' star_target]) |
| 28191 | static asdl_seq * |
| 28192 | _loop0_159_rule(Parser *p) |
| 28193 | { |
| 28194 | D(p->level++); |
| 28195 | if (p->error_indicator) { |
| 28196 | D(p->level--); |
| 28197 | return NULL; |
| 28198 | } |
| 28199 | void *_res = NULL; |
| 28200 | int _mark = p->mark; |
| 28201 | int _start_mark = p->mark; |
| 28202 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 28203 | if (!_children) { |
| 28204 | p->error_indicator = 1; |
| 28205 | PyErr_NoMemory(); |
| 28206 | D(p->level--); |
| 28207 | return NULL; |
| 28208 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 28209 | Py_ssize_t _children_capacity = 1; |
| 28210 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28211 | { // ',' (expressions ['as' star_target]) |
| 28212 | if (p->error_indicator) { |
| 28213 | D(p->level--); |
| 28214 | return NULL; |
| 28215 | } |
| 28216 | D(fprintf(stderr, "%*c> _loop0_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); |
| 28217 | Token * _literal; |
| 28218 | void *elem; |
| 28219 | while ( |
| 28220 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28221 | && |
| 28222 | (elem = _tmp_180_rule(p)) // expressions ['as' star_target] |
| 28223 | ) |
| 28224 | { |
| 28225 | _res = elem; |
| 28226 | if (_res == NULL && PyErr_Occurred()) { |
| 28227 | p->error_indicator = 1; |
| 28228 | PyMem_Free(_children); |
| 28229 | D(p->level--); |
| 28230 | return NULL; |
| 28231 | } |
| 28232 | if (_n == _children_capacity) { |
| 28233 | _children_capacity *= 2; |
| 28234 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 28235 | if (!_new_children) { |
| 28236 | p->error_indicator = 1; |
| 28237 | PyErr_NoMemory(); |
| 28238 | D(p->level--); |
| 28239 | return NULL; |
| 28240 | } |
| 28241 | _children = _new_children; |
| 28242 | } |
| 28243 | _children[_n++] = _res; |
| 28244 | _mark = p->mark; |
| 28245 | } |
| 28246 | p->mark = _mark; |
| 28247 | D(fprintf(stderr, "%*c%s _loop0_159[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28248 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])")); |
| 28249 | } |
| 28250 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 28251 | if (!_seq) { |
| 28252 | PyMem_Free(_children); |
| 28253 | p->error_indicator = 1; |
| 28254 | PyErr_NoMemory(); |
| 28255 | D(p->level--); |
| 28256 | return NULL; |
| 28257 | } |
| 28258 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 28259 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28260 | _PyPegen_insert_memo(p, _start_mark, _loop0_159_type, _seq); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28261 | D(p->level--); |
| 28262 | return _seq; |
| 28263 | } |
| 28264 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28265 | // _gather_158: (expressions ['as' star_target]) _loop0_159 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28266 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28267 | _gather_158_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28268 | { |
| 28269 | D(p->level++); |
| 28270 | if (p->error_indicator) { |
| 28271 | D(p->level--); |
| 28272 | return NULL; |
| 28273 | } |
| 28274 | asdl_seq * _res = NULL; |
| 28275 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28276 | { // (expressions ['as' star_target]) _loop0_159 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28277 | if (p->error_indicator) { |
| 28278 | D(p->level--); |
| 28279 | return NULL; |
| 28280 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28281 | D(fprintf(stderr, "%*c> _gather_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_159")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28282 | void *elem; |
| 28283 | asdl_seq * seq; |
| 28284 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28285 | (elem = _tmp_180_rule(p)) // expressions ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28286 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28287 | (seq = _loop0_159_rule(p)) // _loop0_159 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28288 | ) |
| 28289 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28290 | D(fprintf(stderr, "%*c+ _gather_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_159")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28291 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 28292 | goto done; |
| 28293 | } |
| 28294 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28295 | D(fprintf(stderr, "%*c%s _gather_158[%d-%d]: %s failed!\n", p->level, ' ', |
| 28296 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_159")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28297 | } |
| 28298 | _res = NULL; |
| 28299 | done: |
| 28300 | D(p->level--); |
| 28301 | return _res; |
| 28302 | } |
| 28303 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28304 | // _tmp_160: 'as' NAME |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28305 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28306 | _tmp_160_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28307 | { |
| 28308 | D(p->level++); |
| 28309 | if (p->error_indicator) { |
| 28310 | D(p->level--); |
| 28311 | return NULL; |
| 28312 | } |
| 28313 | void * _res = NULL; |
| 28314 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28315 | { // 'as' NAME |
| 28316 | if (p->error_indicator) { |
| 28317 | D(p->level--); |
| 28318 | return NULL; |
| 28319 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28320 | D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28321 | Token * _keyword; |
| 28322 | expr_ty name_var; |
| 28323 | if ( |
| 28324 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 28325 | && |
| 28326 | (name_var = _PyPegen_name_token(p)) // NAME |
| 28327 | ) |
| 28328 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28329 | D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28330 | _res = _PyPegen_dummy_name(p, _keyword, name_var); |
| 28331 | goto done; |
| 28332 | } |
| 28333 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28334 | D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28335 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 28336 | } |
| 28337 | _res = NULL; |
| 28338 | done: |
| 28339 | D(p->level--); |
| 28340 | return _res; |
| 28341 | } |
| 28342 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28343 | // _tmp_161: 'as' NAME |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28344 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28345 | _tmp_161_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28346 | { |
| 28347 | D(p->level++); |
| 28348 | if (p->error_indicator) { |
| 28349 | D(p->level--); |
| 28350 | return NULL; |
| 28351 | } |
| 28352 | void * _res = NULL; |
| 28353 | int _mark = p->mark; |
| 28354 | { // 'as' NAME |
| 28355 | if (p->error_indicator) { |
| 28356 | D(p->level--); |
| 28357 | return NULL; |
| 28358 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28359 | D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28360 | Token * _keyword; |
| 28361 | expr_ty name_var; |
| 28362 | if ( |
| 28363 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 28364 | && |
| 28365 | (name_var = _PyPegen_name_token(p)) // NAME |
| 28366 | ) |
| 28367 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28368 | D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28369 | _res = _PyPegen_dummy_name(p, _keyword, name_var); |
| 28370 | goto done; |
| 28371 | } |
| 28372 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28373 | D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28374 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 28375 | } |
| 28376 | _res = NULL; |
| 28377 | done: |
| 28378 | D(p->level--); |
| 28379 | return _res; |
| 28380 | } |
| 28381 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28382 | // _tmp_162: star_targets '=' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28383 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28384 | _tmp_162_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28385 | { |
| 28386 | D(p->level++); |
| 28387 | if (p->error_indicator) { |
| 28388 | D(p->level--); |
| 28389 | return NULL; |
| 28390 | } |
| 28391 | void * _res = NULL; |
| 28392 | int _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28393 | { // star_targets '=' |
| 28394 | if (p->error_indicator) { |
| 28395 | D(p->level--); |
| 28396 | return NULL; |
| 28397 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28398 | D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28399 | Token * _literal; |
| 28400 | expr_ty z; |
| 28401 | if ( |
| 28402 | (z = star_targets_rule(p)) // star_targets |
| 28403 | && |
| 28404 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 28405 | ) |
| 28406 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28407 | D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28408 | _res = z; |
| 28409 | if (_res == NULL && PyErr_Occurred()) { |
| 28410 | p->error_indicator = 1; |
| 28411 | D(p->level--); |
| 28412 | return NULL; |
| 28413 | } |
| 28414 | goto done; |
| 28415 | } |
| 28416 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28417 | D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28418 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
| 28419 | } |
| 28420 | _res = NULL; |
| 28421 | done: |
| 28422 | D(p->level--); |
| 28423 | return _res; |
| 28424 | } |
| 28425 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28426 | // _tmp_163: '.' | '...' |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28427 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28428 | _tmp_163_rule(Parser *p) |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28429 | { |
| 28430 | D(p->level++); |
| 28431 | if (p->error_indicator) { |
| 28432 | D(p->level--); |
| 28433 | return NULL; |
| 28434 | } |
| 28435 | void * _res = NULL; |
| 28436 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28437 | { // '.' |
| 28438 | if (p->error_indicator) { |
| 28439 | D(p->level--); |
| 28440 | return NULL; |
| 28441 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28442 | D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28443 | Token * _literal; |
| 28444 | if ( |
| 28445 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 28446 | ) |
| 28447 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28448 | D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28449 | _res = _literal; |
| 28450 | goto done; |
| 28451 | } |
| 28452 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28453 | D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28454 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 28455 | } |
| 28456 | { // '...' |
| 28457 | if (p->error_indicator) { |
| 28458 | D(p->level--); |
| 28459 | return NULL; |
| 28460 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28461 | D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28462 | Token * _literal; |
| 28463 | if ( |
| 28464 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 28465 | ) |
| 28466 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28467 | D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28468 | _res = _literal; |
| 28469 | goto done; |
| 28470 | } |
| 28471 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28472 | D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28473 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
| 28474 | } |
| 28475 | _res = NULL; |
| 28476 | done: |
| 28477 | D(p->level--); |
| 28478 | return _res; |
| 28479 | } |
| 28480 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28481 | // _tmp_164: '.' | '...' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28482 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28483 | _tmp_164_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28484 | { |
| 28485 | D(p->level++); |
| 28486 | if (p->error_indicator) { |
| 28487 | D(p->level--); |
| 28488 | return NULL; |
| 28489 | } |
| 28490 | void * _res = NULL; |
| 28491 | int _mark = p->mark; |
| 28492 | { // '.' |
| 28493 | if (p->error_indicator) { |
| 28494 | D(p->level--); |
| 28495 | return NULL; |
| 28496 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28497 | D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28498 | Token * _literal; |
| 28499 | if ( |
| 28500 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 28501 | ) |
| 28502 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28503 | D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28504 | _res = _literal; |
| 28505 | goto done; |
| 28506 | } |
| 28507 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28508 | D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28509 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 28510 | } |
| 28511 | { // '...' |
| 28512 | if (p->error_indicator) { |
| 28513 | D(p->level--); |
| 28514 | return NULL; |
| 28515 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28516 | D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28517 | Token * _literal; |
| 28518 | if ( |
| 28519 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 28520 | ) |
| 28521 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28522 | D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28523 | _res = _literal; |
| 28524 | goto done; |
| 28525 | } |
| 28526 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28527 | D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28528 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
| 28529 | } |
| 28530 | _res = NULL; |
| 28531 | done: |
| 28532 | D(p->level--); |
| 28533 | return _res; |
| 28534 | } |
| 28535 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28536 | // _tmp_165: '@' named_expression NEWLINE |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28537 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28538 | _tmp_165_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28539 | { |
| 28540 | D(p->level++); |
| 28541 | if (p->error_indicator) { |
| 28542 | D(p->level--); |
| 28543 | return NULL; |
| 28544 | } |
| 28545 | void * _res = NULL; |
| 28546 | int _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28547 | { // '@' named_expression NEWLINE |
| 28548 | if (p->error_indicator) { |
| 28549 | D(p->level--); |
| 28550 | return NULL; |
| 28551 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28552 | D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28553 | Token * _literal; |
| 28554 | expr_ty f; |
| 28555 | Token * newline_var; |
| 28556 | if ( |
| 28557 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
| 28558 | && |
| 28559 | (f = named_expression_rule(p)) // named_expression |
| 28560 | && |
| 28561 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 28562 | ) |
| 28563 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28564 | D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28565 | _res = f; |
| 28566 | if (_res == NULL && PyErr_Occurred()) { |
| 28567 | p->error_indicator = 1; |
| 28568 | D(p->level--); |
| 28569 | return NULL; |
| 28570 | } |
| 28571 | goto done; |
| 28572 | } |
| 28573 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28574 | D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28575 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); |
| 28576 | } |
| 28577 | _res = NULL; |
| 28578 | done: |
| 28579 | D(p->level--); |
| 28580 | return _res; |
| 28581 | } |
| 28582 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28583 | // _tmp_166: ',' star_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28584 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28585 | _tmp_166_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28586 | { |
| 28587 | D(p->level++); |
| 28588 | if (p->error_indicator) { |
| 28589 | D(p->level--); |
| 28590 | return NULL; |
| 28591 | } |
| 28592 | void * _res = NULL; |
| 28593 | int _mark = p->mark; |
| 28594 | { // ',' star_expression |
| 28595 | if (p->error_indicator) { |
| 28596 | D(p->level--); |
| 28597 | return NULL; |
| 28598 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28599 | D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28600 | Token * _literal; |
| 28601 | expr_ty c; |
| 28602 | if ( |
| 28603 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28604 | && |
| 28605 | (c = star_expression_rule(p)) // star_expression |
| 28606 | ) |
| 28607 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28608 | D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28609 | _res = c; |
| 28610 | if (_res == NULL && PyErr_Occurred()) { |
| 28611 | p->error_indicator = 1; |
| 28612 | D(p->level--); |
| 28613 | return NULL; |
| 28614 | } |
| 28615 | goto done; |
| 28616 | } |
| 28617 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28618 | D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28619 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); |
| 28620 | } |
| 28621 | _res = NULL; |
| 28622 | done: |
| 28623 | D(p->level--); |
| 28624 | return _res; |
| 28625 | } |
| 28626 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28627 | // _tmp_167: ',' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28628 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28629 | _tmp_167_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28630 | { |
| 28631 | D(p->level++); |
| 28632 | if (p->error_indicator) { |
| 28633 | D(p->level--); |
| 28634 | return NULL; |
| 28635 | } |
| 28636 | void * _res = NULL; |
| 28637 | int _mark = p->mark; |
| 28638 | { // ',' expression |
| 28639 | if (p->error_indicator) { |
| 28640 | D(p->level--); |
| 28641 | return NULL; |
| 28642 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28643 | D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28644 | Token * _literal; |
| 28645 | expr_ty c; |
| 28646 | if ( |
| 28647 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28648 | && |
| 28649 | (c = expression_rule(p)) // expression |
| 28650 | ) |
| 28651 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28652 | D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28653 | _res = c; |
| 28654 | if (_res == NULL && PyErr_Occurred()) { |
| 28655 | p->error_indicator = 1; |
| 28656 | D(p->level--); |
| 28657 | return NULL; |
| 28658 | } |
| 28659 | goto done; |
| 28660 | } |
| 28661 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28662 | D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28663 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 28664 | } |
| 28665 | _res = NULL; |
| 28666 | done: |
| 28667 | D(p->level--); |
| 28668 | return _res; |
| 28669 | } |
| 28670 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28671 | // _tmp_168: 'or' conjunction |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28672 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28673 | _tmp_168_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28674 | { |
| 28675 | D(p->level++); |
| 28676 | if (p->error_indicator) { |
| 28677 | D(p->level--); |
| 28678 | return NULL; |
| 28679 | } |
| 28680 | void * _res = NULL; |
| 28681 | int _mark = p->mark; |
| 28682 | { // 'or' conjunction |
| 28683 | if (p->error_indicator) { |
| 28684 | D(p->level--); |
| 28685 | return NULL; |
| 28686 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28687 | D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28688 | Token * _keyword; |
| 28689 | expr_ty c; |
| 28690 | if ( |
| 28691 | (_keyword = _PyPegen_expect_token(p, 531)) // token='or' |
| 28692 | && |
| 28693 | (c = conjunction_rule(p)) // conjunction |
| 28694 | ) |
| 28695 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28696 | D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28697 | _res = c; |
| 28698 | if (_res == NULL && PyErr_Occurred()) { |
| 28699 | p->error_indicator = 1; |
| 28700 | D(p->level--); |
| 28701 | return NULL; |
| 28702 | } |
| 28703 | goto done; |
| 28704 | } |
| 28705 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28706 | D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28707 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); |
| 28708 | } |
| 28709 | _res = NULL; |
| 28710 | done: |
| 28711 | D(p->level--); |
| 28712 | return _res; |
| 28713 | } |
| 28714 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28715 | // _tmp_169: 'and' inversion |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28716 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28717 | _tmp_169_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28718 | { |
| 28719 | D(p->level++); |
| 28720 | if (p->error_indicator) { |
| 28721 | D(p->level--); |
| 28722 | return NULL; |
| 28723 | } |
| 28724 | void * _res = NULL; |
| 28725 | int _mark = p->mark; |
| 28726 | { // 'and' inversion |
| 28727 | if (p->error_indicator) { |
| 28728 | D(p->level--); |
| 28729 | return NULL; |
| 28730 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28731 | D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28732 | Token * _keyword; |
| 28733 | expr_ty c; |
| 28734 | if ( |
| 28735 | (_keyword = _PyPegen_expect_token(p, 532)) // token='and' |
| 28736 | && |
| 28737 | (c = inversion_rule(p)) // inversion |
| 28738 | ) |
| 28739 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28740 | D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28741 | _res = c; |
| 28742 | if (_res == NULL && PyErr_Occurred()) { |
| 28743 | p->error_indicator = 1; |
| 28744 | D(p->level--); |
| 28745 | return NULL; |
| 28746 | } |
| 28747 | goto done; |
| 28748 | } |
| 28749 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28750 | D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28751 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 28752 | } |
| 28753 | _res = NULL; |
| 28754 | done: |
| 28755 | D(p->level--); |
| 28756 | return _res; |
| 28757 | } |
| 28758 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28759 | // _tmp_170: 'if' disjunction |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28760 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28761 | _tmp_170_rule(Parser *p) |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28762 | { |
| 28763 | D(p->level++); |
| 28764 | if (p->error_indicator) { |
| 28765 | D(p->level--); |
| 28766 | return NULL; |
| 28767 | } |
| 28768 | void * _res = NULL; |
| 28769 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28770 | { // 'if' disjunction |
| 28771 | if (p->error_indicator) { |
| 28772 | D(p->level--); |
| 28773 | return NULL; |
| 28774 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28775 | D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28776 | Token * _keyword; |
| 28777 | expr_ty z; |
| 28778 | if ( |
| 28779 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 28780 | && |
| 28781 | (z = disjunction_rule(p)) // disjunction |
| 28782 | ) |
| 28783 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28784 | D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28785 | _res = z; |
| 28786 | if (_res == NULL && PyErr_Occurred()) { |
| 28787 | p->error_indicator = 1; |
| 28788 | D(p->level--); |
| 28789 | return NULL; |
| 28790 | } |
| 28791 | goto done; |
| 28792 | } |
| 28793 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28794 | D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28795 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
| 28796 | } |
| 28797 | _res = NULL; |
| 28798 | done: |
| 28799 | D(p->level--); |
| 28800 | return _res; |
| 28801 | } |
| 28802 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28803 | // _tmp_171: 'if' disjunction |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28804 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28805 | _tmp_171_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28806 | { |
| 28807 | D(p->level++); |
| 28808 | if (p->error_indicator) { |
| 28809 | D(p->level--); |
| 28810 | return NULL; |
| 28811 | } |
| 28812 | void * _res = NULL; |
| 28813 | int _mark = p->mark; |
| 28814 | { // 'if' disjunction |
| 28815 | if (p->error_indicator) { |
| 28816 | D(p->level--); |
| 28817 | return NULL; |
| 28818 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28819 | D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28820 | Token * _keyword; |
| 28821 | expr_ty z; |
| 28822 | if ( |
| 28823 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 28824 | && |
| 28825 | (z = disjunction_rule(p)) // disjunction |
| 28826 | ) |
| 28827 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28828 | D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28829 | _res = z; |
| 28830 | if (_res == NULL && PyErr_Occurred()) { |
| 28831 | p->error_indicator = 1; |
| 28832 | D(p->level--); |
| 28833 | return NULL; |
| 28834 | } |
| 28835 | goto done; |
| 28836 | } |
| 28837 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28838 | D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28839 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
| 28840 | } |
| 28841 | _res = NULL; |
| 28842 | done: |
| 28843 | D(p->level--); |
| 28844 | return _res; |
| 28845 | } |
| 28846 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28847 | // _tmp_172: starred_expression | named_expression !'=' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28848 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28849 | _tmp_172_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28850 | { |
| 28851 | D(p->level++); |
| 28852 | if (p->error_indicator) { |
| 28853 | D(p->level--); |
| 28854 | return NULL; |
| 28855 | } |
| 28856 | void * _res = NULL; |
| 28857 | int _mark = p->mark; |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 28858 | { // starred_expression |
| 28859 | if (p->error_indicator) { |
| 28860 | D(p->level--); |
| 28861 | return NULL; |
| 28862 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28863 | D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 28864 | expr_ty starred_expression_var; |
| 28865 | if ( |
| 28866 | (starred_expression_var = starred_expression_rule(p)) // starred_expression |
| 28867 | ) |
| 28868 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28869 | D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 28870 | _res = starred_expression_var; |
| 28871 | goto done; |
| 28872 | } |
| 28873 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28874 | D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 28875 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
| 28876 | } |
| 28877 | { // named_expression !'=' |
| 28878 | if (p->error_indicator) { |
| 28879 | D(p->level--); |
| 28880 | return NULL; |
| 28881 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28882 | D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 28883 | expr_ty named_expression_var; |
| 28884 | if ( |
| 28885 | (named_expression_var = named_expression_rule(p)) // named_expression |
| 28886 | && |
| 28887 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
| 28888 | ) |
| 28889 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28890 | D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 28891 | _res = named_expression_var; |
| 28892 | goto done; |
| 28893 | } |
| 28894 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28895 | D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28896 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28897 | } |
| 28898 | _res = NULL; |
| 28899 | done: |
| 28900 | D(p->level--); |
| 28901 | return _res; |
| 28902 | } |
| 28903 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28904 | // _tmp_173: ',' star_target |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28905 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28906 | _tmp_173_rule(Parser *p) |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28907 | { |
| 28908 | D(p->level++); |
| 28909 | if (p->error_indicator) { |
| 28910 | D(p->level--); |
| 28911 | return NULL; |
| 28912 | } |
| 28913 | void * _res = NULL; |
| 28914 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28915 | { // ',' star_target |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28916 | if (p->error_indicator) { |
| 28917 | D(p->level--); |
| 28918 | return NULL; |
| 28919 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28920 | D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28921 | Token * _literal; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28922 | expr_ty c; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28923 | if ( |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28924 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28925 | && |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28926 | (c = star_target_rule(p)) // star_target |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28927 | ) |
| 28928 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28929 | D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28930 | _res = c; |
| 28931 | if (_res == NULL && PyErr_Occurred()) { |
| 28932 | p->error_indicator = 1; |
| 28933 | D(p->level--); |
| 28934 | return NULL; |
| 28935 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28936 | goto done; |
| 28937 | } |
| 28938 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28939 | D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28940 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28941 | } |
| 28942 | _res = NULL; |
| 28943 | done: |
| 28944 | D(p->level--); |
| 28945 | return _res; |
| 28946 | } |
| 28947 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28948 | // _tmp_174: ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28949 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28950 | _tmp_174_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28951 | { |
| 28952 | D(p->level++); |
| 28953 | if (p->error_indicator) { |
| 28954 | D(p->level--); |
| 28955 | return NULL; |
| 28956 | } |
| 28957 | void * _res = NULL; |
| 28958 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28959 | { // ',' star_target |
| 28960 | if (p->error_indicator) { |
| 28961 | D(p->level--); |
| 28962 | return NULL; |
| 28963 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28964 | D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28965 | Token * _literal; |
| 28966 | expr_ty c; |
| 28967 | if ( |
| 28968 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28969 | && |
| 28970 | (c = star_target_rule(p)) // star_target |
| 28971 | ) |
| 28972 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28973 | D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28974 | _res = c; |
| 28975 | if (_res == NULL && PyErr_Occurred()) { |
| 28976 | p->error_indicator = 1; |
| 28977 | D(p->level--); |
| 28978 | return NULL; |
| 28979 | } |
| 28980 | goto done; |
| 28981 | } |
| 28982 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28983 | D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28984 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
| 28985 | } |
| 28986 | _res = NULL; |
| 28987 | done: |
| 28988 | D(p->level--); |
| 28989 | return _res; |
| 28990 | } |
| 28991 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28992 | // _tmp_175: star_targets '=' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28993 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28994 | _tmp_175_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28995 | { |
| 28996 | D(p->level++); |
| 28997 | if (p->error_indicator) { |
| 28998 | D(p->level--); |
| 28999 | return NULL; |
| 29000 | } |
| 29001 | void * _res = NULL; |
| 29002 | int _mark = p->mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29003 | { // star_targets '=' |
| 29004 | if (p->error_indicator) { |
| 29005 | D(p->level--); |
| 29006 | return NULL; |
| 29007 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29008 | D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29009 | Token * _literal; |
| 29010 | expr_ty star_targets_var; |
| 29011 | if ( |
| 29012 | (star_targets_var = star_targets_rule(p)) // star_targets |
| 29013 | && |
| 29014 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 29015 | ) |
| 29016 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29017 | D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29018 | _res = _PyPegen_dummy_name(p, star_targets_var, _literal); |
| 29019 | goto done; |
| 29020 | } |
| 29021 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29022 | D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29023 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
| 29024 | } |
| 29025 | _res = NULL; |
| 29026 | done: |
| 29027 | D(p->level--); |
| 29028 | return _res; |
| 29029 | } |
| 29030 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29031 | // _tmp_176: star_targets '=' |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29032 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29033 | _tmp_176_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 29034 | { |
| 29035 | D(p->level++); |
| 29036 | if (p->error_indicator) { |
| 29037 | D(p->level--); |
| 29038 | return NULL; |
| 29039 | } |
| 29040 | void * _res = NULL; |
| 29041 | int _mark = p->mark; |
| 29042 | { // star_targets '=' |
| 29043 | if (p->error_indicator) { |
| 29044 | D(p->level--); |
| 29045 | return NULL; |
| 29046 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29047 | D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 29048 | Token * _literal; |
| 29049 | expr_ty star_targets_var; |
| 29050 | if ( |
| 29051 | (star_targets_var = star_targets_rule(p)) // star_targets |
| 29052 | && |
| 29053 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 29054 | ) |
| 29055 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29056 | D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 29057 | _res = _PyPegen_dummy_name(p, star_targets_var, _literal); |
| 29058 | goto done; |
| 29059 | } |
| 29060 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29061 | D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 29062 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
| 29063 | } |
| 29064 | _res = NULL; |
| 29065 | done: |
| 29066 | D(p->level--); |
| 29067 | return _res; |
| 29068 | } |
| 29069 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29070 | // _tmp_177: ')' | '**' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 29071 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29072 | _tmp_177_rule(Parser *p) |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29073 | { |
| 29074 | D(p->level++); |
| 29075 | if (p->error_indicator) { |
| 29076 | D(p->level--); |
| 29077 | return NULL; |
| 29078 | } |
| 29079 | void * _res = NULL; |
| 29080 | int _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29081 | { // ')' |
| 29082 | if (p->error_indicator) { |
| 29083 | D(p->level--); |
| 29084 | return NULL; |
| 29085 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29086 | D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29087 | Token * _literal; |
| 29088 | if ( |
| 29089 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 29090 | ) |
| 29091 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29092 | D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29093 | _res = _literal; |
| 29094 | goto done; |
| 29095 | } |
| 29096 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29097 | D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29098 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29099 | } |
| 29100 | { // '**' |
| 29101 | if (p->error_indicator) { |
| 29102 | D(p->level--); |
| 29103 | return NULL; |
| 29104 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29105 | D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29106 | Token * _literal; |
| 29107 | if ( |
| 29108 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 29109 | ) |
| 29110 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29111 | D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29112 | _res = _literal; |
| 29113 | goto done; |
| 29114 | } |
| 29115 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29116 | D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29117 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
| 29118 | } |
| 29119 | _res = NULL; |
| 29120 | done: |
| 29121 | D(p->level--); |
| 29122 | return _res; |
| 29123 | } |
| 29124 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29125 | // _tmp_178: ':' | '**' |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29126 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29127 | _tmp_178_rule(Parser *p) |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29128 | { |
| 29129 | D(p->level++); |
| 29130 | if (p->error_indicator) { |
| 29131 | D(p->level--); |
| 29132 | return NULL; |
| 29133 | } |
| 29134 | void * _res = NULL; |
| 29135 | int _mark = p->mark; |
| 29136 | { // ':' |
| 29137 | if (p->error_indicator) { |
| 29138 | D(p->level--); |
| 29139 | return NULL; |
| 29140 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29141 | D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29142 | Token * _literal; |
| 29143 | if ( |
| 29144 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 29145 | ) |
| 29146 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29147 | D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29148 | _res = _literal; |
| 29149 | goto done; |
| 29150 | } |
| 29151 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29152 | D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29153 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
| 29154 | } |
| 29155 | { // '**' |
| 29156 | if (p->error_indicator) { |
| 29157 | D(p->level--); |
| 29158 | return NULL; |
| 29159 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29160 | D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29161 | Token * _literal; |
| 29162 | if ( |
| 29163 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 29164 | ) |
| 29165 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29166 | D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29167 | _res = _literal; |
| 29168 | goto done; |
| 29169 | } |
| 29170 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29171 | D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29172 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
| 29173 | } |
| 29174 | _res = NULL; |
| 29175 | done: |
| 29176 | D(p->level--); |
| 29177 | return _res; |
| 29178 | } |
| 29179 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29180 | // _tmp_179: expression ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29181 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29182 | _tmp_179_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29183 | { |
| 29184 | D(p->level++); |
| 29185 | if (p->error_indicator) { |
| 29186 | D(p->level--); |
| 29187 | return NULL; |
| 29188 | } |
| 29189 | void * _res = NULL; |
| 29190 | int _mark = p->mark; |
| 29191 | { // expression ['as' star_target] |
| 29192 | if (p->error_indicator) { |
| 29193 | D(p->level--); |
| 29194 | return NULL; |
| 29195 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29196 | D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29197 | void *_opt_var; |
| 29198 | UNUSED(_opt_var); // Silence compiler warnings |
| 29199 | expr_ty expression_var; |
| 29200 | if ( |
| 29201 | (expression_var = expression_rule(p)) // expression |
| 29202 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29203 | (_opt_var = _tmp_181_rule(p), 1) // ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29204 | ) |
| 29205 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29206 | D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29207 | _res = _PyPegen_dummy_name(p, expression_var, _opt_var); |
| 29208 | goto done; |
| 29209 | } |
| 29210 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29211 | D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29212 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); |
| 29213 | } |
| 29214 | _res = NULL; |
| 29215 | done: |
| 29216 | D(p->level--); |
| 29217 | return _res; |
| 29218 | } |
| 29219 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29220 | // _tmp_180: expressions ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29221 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29222 | _tmp_180_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29223 | { |
| 29224 | D(p->level++); |
| 29225 | if (p->error_indicator) { |
| 29226 | D(p->level--); |
| 29227 | return NULL; |
| 29228 | } |
| 29229 | void * _res = NULL; |
| 29230 | int _mark = p->mark; |
| 29231 | { // expressions ['as' star_target] |
| 29232 | if (p->error_indicator) { |
| 29233 | D(p->level--); |
| 29234 | return NULL; |
| 29235 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29236 | D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29237 | void *_opt_var; |
| 29238 | UNUSED(_opt_var); // Silence compiler warnings |
| 29239 | expr_ty expressions_var; |
| 29240 | if ( |
| 29241 | (expressions_var = expressions_rule(p)) // expressions |
| 29242 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29243 | (_opt_var = _tmp_182_rule(p), 1) // ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29244 | ) |
| 29245 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29246 | D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29247 | _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); |
| 29248 | goto done; |
| 29249 | } |
| 29250 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29251 | D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29252 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); |
| 29253 | } |
| 29254 | _res = NULL; |
| 29255 | done: |
| 29256 | D(p->level--); |
| 29257 | return _res; |
| 29258 | } |
| 29259 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29260 | // _tmp_181: 'as' star_target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29261 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29262 | _tmp_181_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29263 | { |
| 29264 | D(p->level++); |
| 29265 | if (p->error_indicator) { |
| 29266 | D(p->level--); |
| 29267 | return NULL; |
| 29268 | } |
| 29269 | void * _res = NULL; |
| 29270 | int _mark = p->mark; |
| 29271 | { // 'as' star_target |
| 29272 | if (p->error_indicator) { |
| 29273 | D(p->level--); |
| 29274 | return NULL; |
| 29275 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29276 | D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29277 | Token * _keyword; |
| 29278 | expr_ty star_target_var; |
| 29279 | if ( |
| 29280 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 29281 | && |
| 29282 | (star_target_var = star_target_rule(p)) // star_target |
| 29283 | ) |
| 29284 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29285 | D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29286 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
| 29287 | goto done; |
| 29288 | } |
| 29289 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29290 | D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29291 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); |
| 29292 | } |
| 29293 | _res = NULL; |
| 29294 | done: |
| 29295 | D(p->level--); |
| 29296 | return _res; |
| 29297 | } |
| 29298 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29299 | // _tmp_182: 'as' star_target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29300 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29301 | _tmp_182_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29302 | { |
| 29303 | D(p->level++); |
| 29304 | if (p->error_indicator) { |
| 29305 | D(p->level--); |
| 29306 | return NULL; |
| 29307 | } |
| 29308 | void * _res = NULL; |
| 29309 | int _mark = p->mark; |
| 29310 | { // 'as' star_target |
| 29311 | if (p->error_indicator) { |
| 29312 | D(p->level--); |
| 29313 | return NULL; |
| 29314 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29315 | D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29316 | Token * _keyword; |
| 29317 | expr_ty star_target_var; |
| 29318 | if ( |
| 29319 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 29320 | && |
| 29321 | (star_target_var = star_target_rule(p)) // star_target |
| 29322 | ) |
| 29323 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29324 | D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29325 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
| 29326 | goto done; |
| 29327 | } |
| 29328 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29329 | D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29330 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); |
| 29331 | } |
| 29332 | _res = NULL; |
| 29333 | done: |
| 29334 | D(p->level--); |
| 29335 | return _res; |
| 29336 | } |
| 29337 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29338 | void * |
| 29339 | _PyPegen_parse(Parser *p) |
| 29340 | { |
| 29341 | // Initialize keywords |
| 29342 | p->keywords = reserved_keywords; |
| 29343 | p->n_keyword_lists = n_keyword_lists; |
| 29344 | |
| 29345 | // Run parser |
| 29346 | void *result = NULL; |
| 29347 | if (p->start_rule == Py_file_input) { |
| 29348 | result = file_rule(p); |
| 29349 | } else if (p->start_rule == Py_single_input) { |
| 29350 | result = interactive_rule(p); |
| 29351 | } else if (p->start_rule == Py_eval_input) { |
| 29352 | result = eval_rule(p); |
| 29353 | } else if (p->start_rule == Py_func_type_input) { |
| 29354 | result = func_type_rule(p); |
| 29355 | } else if (p->start_rule == Py_fstring_input) { |
| 29356 | result = fstring_rule(p); |
| 29357 | } |
| 29358 | |
| 29359 | return result; |
| 29360 | } |
| 29361 | |
| 29362 | // The end |