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) |
Guido van Rossum | 86bea46 | 1997-04-29 21:03:06 +0000 | [diff] [blame] | 5 | extern int Py_DebugFlag; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 6 | #define D(x) if (Py_DebugFlag) x; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 7 | #else |
| 8 | #define D(x) |
| 9 | #endif |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10 | static const int n_keyword_lists = 9; |
| 11 | static KeywordToken *reserved_keywords[] = { |
Pablo Galindo | 1ac0cbc | 2020-07-06 20:31:16 +0100 | [diff] [blame] | 12 | (KeywordToken[]) {{NULL, -1}}, |
| 13 | (KeywordToken[]) {{NULL, -1}}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14 | (KeywordToken[]) { |
| 15 | {"if", 510}, |
| 16 | {"in", 518}, |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 17 | {"as", 520}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18 | {"is", 530}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19 | {"or", 531}, |
| 20 | {NULL, -1}, |
| 21 | }, |
| 22 | (KeywordToken[]) { |
| 23 | {"del", 503}, |
| 24 | {"try", 511}, |
| 25 | {"for", 517}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26 | {"def", 526}, |
| 27 | {"not", 529}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28 | {"and", 532}, |
| 29 | {NULL, -1}, |
| 30 | }, |
| 31 | (KeywordToken[]) { |
| 32 | {"pass", 502}, |
| 33 | {"from", 514}, |
| 34 | {"elif", 515}, |
| 35 | {"else", 516}, |
| 36 | {"with", 519}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 37 | {"None", 523}, |
| 38 | {"True", 524}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 39 | {NULL, -1}, |
| 40 | }, |
| 41 | (KeywordToken[]) { |
| 42 | {"raise", 501}, |
| 43 | {"yield", 504}, |
| 44 | {"break", 506}, |
| 45 | {"while", 512}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 46 | {"False", 525}, |
| 47 | {"class", 527}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 48 | {NULL, -1}, |
| 49 | }, |
| 50 | (KeywordToken[]) { |
| 51 | {"return", 500}, |
| 52 | {"assert", 505}, |
| 53 | {"global", 508}, |
| 54 | {"import", 513}, |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 55 | {"except", 521}, |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 56 | {"lambda", 528}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 57 | {NULL, -1}, |
| 58 | }, |
| 59 | (KeywordToken[]) { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 60 | {"finally", 522}, |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 61 | {NULL, -1}, |
| 62 | }, |
| 63 | (KeywordToken[]) { |
| 64 | {"continue", 507}, |
| 65 | {"nonlocal", 509}, |
| 66 | {NULL, -1}, |
| 67 | }, |
| 68 | }; |
| 69 | #define file_type 1000 |
| 70 | #define interactive_type 1001 |
| 71 | #define eval_type 1002 |
| 72 | #define func_type_type 1003 |
| 73 | #define fstring_type 1004 |
| 74 | #define type_expressions_type 1005 |
| 75 | #define statements_type 1006 |
| 76 | #define statement_type 1007 |
| 77 | #define statement_newline_type 1008 |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 78 | #define simple_stmts_type 1009 |
| 79 | #define simple_stmt_type 1010 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 80 | #define compound_stmt_type 1011 |
| 81 | #define assignment_type 1012 |
| 82 | #define augassign_type 1013 |
| 83 | #define global_stmt_type 1014 |
| 84 | #define nonlocal_stmt_type 1015 |
| 85 | #define yield_stmt_type 1016 |
| 86 | #define assert_stmt_type 1017 |
| 87 | #define del_stmt_type 1018 |
| 88 | #define import_stmt_type 1019 |
| 89 | #define import_name_type 1020 |
| 90 | #define import_from_type 1021 |
| 91 | #define import_from_targets_type 1022 |
| 92 | #define import_from_as_names_type 1023 |
| 93 | #define import_from_as_name_type 1024 |
| 94 | #define dotted_as_names_type 1025 |
| 95 | #define dotted_as_name_type 1026 |
| 96 | #define dotted_name_type 1027 // Left-recursive |
| 97 | #define if_stmt_type 1028 |
| 98 | #define elif_stmt_type 1029 |
| 99 | #define else_block_type 1030 |
| 100 | #define while_stmt_type 1031 |
| 101 | #define for_stmt_type 1032 |
| 102 | #define with_stmt_type 1033 |
| 103 | #define with_item_type 1034 |
| 104 | #define try_stmt_type 1035 |
| 105 | #define except_block_type 1036 |
| 106 | #define finally_block_type 1037 |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 107 | #define match_stmt_type 1038 |
| 108 | #define subject_expr_type 1039 |
| 109 | #define case_block_type 1040 |
| 110 | #define guard_type 1041 |
| 111 | #define patterns_type 1042 |
| 112 | #define pattern_type 1043 |
| 113 | #define as_pattern_type 1044 |
| 114 | #define or_pattern_type 1045 |
| 115 | #define closed_pattern_type 1046 |
| 116 | #define literal_pattern_type 1047 |
| 117 | #define signed_number_type 1048 |
| 118 | #define capture_pattern_type 1049 |
| 119 | #define wildcard_pattern_type 1050 |
| 120 | #define value_pattern_type 1051 |
| 121 | #define attr_type 1052 // Left-recursive |
| 122 | #define name_or_attr_type 1053 // Left-recursive |
| 123 | #define group_pattern_type 1054 |
| 124 | #define sequence_pattern_type 1055 |
| 125 | #define open_sequence_pattern_type 1056 |
| 126 | #define maybe_sequence_pattern_type 1057 |
| 127 | #define maybe_star_pattern_type 1058 |
| 128 | #define star_pattern_type 1059 |
| 129 | #define mapping_pattern_type 1060 |
| 130 | #define items_pattern_type 1061 |
| 131 | #define key_value_pattern_type 1062 |
| 132 | #define double_star_pattern_type 1063 |
| 133 | #define class_pattern_type 1064 |
| 134 | #define positional_patterns_type 1065 |
| 135 | #define keyword_patterns_type 1066 |
| 136 | #define keyword_pattern_type 1067 |
| 137 | #define return_stmt_type 1068 |
| 138 | #define raise_stmt_type 1069 |
| 139 | #define function_def_type 1070 |
| 140 | #define function_def_raw_type 1071 |
| 141 | #define func_type_comment_type 1072 |
| 142 | #define params_type 1073 |
| 143 | #define parameters_type 1074 |
| 144 | #define slash_no_default_type 1075 |
| 145 | #define slash_with_default_type 1076 |
| 146 | #define star_etc_type 1077 |
| 147 | #define kwds_type 1078 |
| 148 | #define param_no_default_type 1079 |
| 149 | #define param_with_default_type 1080 |
| 150 | #define param_maybe_default_type 1081 |
| 151 | #define param_type 1082 |
| 152 | #define annotation_type 1083 |
| 153 | #define default_type 1084 |
| 154 | #define decorators_type 1085 |
| 155 | #define class_def_type 1086 |
| 156 | #define class_def_raw_type 1087 |
| 157 | #define block_type 1088 |
| 158 | #define star_expressions_type 1089 |
| 159 | #define star_expression_type 1090 |
| 160 | #define star_named_expressions_type 1091 |
| 161 | #define star_named_expression_type 1092 |
| 162 | #define named_expression_type 1093 |
| 163 | #define annotated_rhs_type 1094 |
| 164 | #define expressions_type 1095 |
| 165 | #define expression_type 1096 |
| 166 | #define lambdef_type 1097 |
| 167 | #define lambda_params_type 1098 |
| 168 | #define lambda_parameters_type 1099 |
| 169 | #define lambda_slash_no_default_type 1100 |
| 170 | #define lambda_slash_with_default_type 1101 |
| 171 | #define lambda_star_etc_type 1102 |
| 172 | #define lambda_kwds_type 1103 |
| 173 | #define lambda_param_no_default_type 1104 |
| 174 | #define lambda_param_with_default_type 1105 |
| 175 | #define lambda_param_maybe_default_type 1106 |
| 176 | #define lambda_param_type 1107 |
| 177 | #define disjunction_type 1108 |
| 178 | #define conjunction_type 1109 |
| 179 | #define inversion_type 1110 |
| 180 | #define comparison_type 1111 |
| 181 | #define compare_op_bitwise_or_pair_type 1112 |
| 182 | #define eq_bitwise_or_type 1113 |
| 183 | #define noteq_bitwise_or_type 1114 |
| 184 | #define lte_bitwise_or_type 1115 |
| 185 | #define lt_bitwise_or_type 1116 |
| 186 | #define gte_bitwise_or_type 1117 |
| 187 | #define gt_bitwise_or_type 1118 |
| 188 | #define notin_bitwise_or_type 1119 |
| 189 | #define in_bitwise_or_type 1120 |
| 190 | #define isnot_bitwise_or_type 1121 |
| 191 | #define is_bitwise_or_type 1122 |
| 192 | #define bitwise_or_type 1123 // Left-recursive |
| 193 | #define bitwise_xor_type 1124 // Left-recursive |
| 194 | #define bitwise_and_type 1125 // Left-recursive |
| 195 | #define shift_expr_type 1126 // Left-recursive |
| 196 | #define sum_type 1127 // Left-recursive |
| 197 | #define term_type 1128 // Left-recursive |
| 198 | #define factor_type 1129 |
| 199 | #define power_type 1130 |
| 200 | #define await_primary_type 1131 |
| 201 | #define primary_type 1132 // Left-recursive |
| 202 | #define slices_type 1133 |
| 203 | #define slice_type 1134 |
| 204 | #define atom_type 1135 |
| 205 | #define strings_type 1136 |
| 206 | #define list_type 1137 |
| 207 | #define listcomp_type 1138 |
| 208 | #define tuple_type 1139 |
| 209 | #define group_type 1140 |
| 210 | #define genexp_type 1141 |
| 211 | #define set_type 1142 |
| 212 | #define setcomp_type 1143 |
| 213 | #define dict_type 1144 |
| 214 | #define dictcomp_type 1145 |
| 215 | #define double_starred_kvpairs_type 1146 |
| 216 | #define double_starred_kvpair_type 1147 |
| 217 | #define kvpair_type 1148 |
| 218 | #define for_if_clauses_type 1149 |
| 219 | #define for_if_clause_type 1150 |
| 220 | #define yield_expr_type 1151 |
| 221 | #define arguments_type 1152 |
| 222 | #define args_type 1153 |
| 223 | #define kwargs_type 1154 |
| 224 | #define starred_expression_type 1155 |
| 225 | #define kwarg_or_starred_type 1156 |
| 226 | #define kwarg_or_double_starred_type 1157 |
| 227 | #define star_targets_type 1158 |
| 228 | #define star_targets_list_seq_type 1159 |
| 229 | #define star_targets_tuple_seq_type 1160 |
| 230 | #define star_target_type 1161 |
| 231 | #define target_with_star_atom_type 1162 |
| 232 | #define star_atom_type 1163 |
| 233 | #define single_target_type 1164 |
| 234 | #define single_subscript_attribute_target_type 1165 |
| 235 | #define del_targets_type 1166 |
| 236 | #define del_target_type 1167 |
| 237 | #define del_t_atom_type 1168 |
| 238 | #define targets_type 1169 |
| 239 | #define target_type 1170 |
| 240 | #define t_primary_type 1171 // Left-recursive |
| 241 | #define t_lookahead_type 1172 |
| 242 | #define t_atom_type 1173 |
| 243 | #define invalid_arguments_type 1174 |
| 244 | #define invalid_kwarg_type 1175 |
| 245 | #define invalid_named_expression_type 1176 |
| 246 | #define invalid_assignment_type 1177 |
| 247 | #define invalid_ann_assign_target_type 1178 |
| 248 | #define invalid_del_stmt_type 1179 |
| 249 | #define invalid_block_type 1180 |
| 250 | #define invalid_primary_type 1181 // Left-recursive |
| 251 | #define invalid_comprehension_type 1182 |
| 252 | #define invalid_dict_comprehension_type 1183 |
| 253 | #define invalid_parameters_type 1184 |
| 254 | #define invalid_parameters_helper_type 1185 |
| 255 | #define invalid_lambda_parameters_type 1186 |
| 256 | #define invalid_lambda_parameters_helper_type 1187 |
| 257 | #define invalid_star_etc_type 1188 |
| 258 | #define invalid_lambda_star_etc_type 1189 |
| 259 | #define invalid_double_type_comments_type 1190 |
| 260 | #define invalid_with_item_type 1191 |
| 261 | #define invalid_for_target_type 1192 |
| 262 | #define invalid_group_type 1193 |
| 263 | #define invalid_import_from_targets_type 1194 |
| 264 | #define invalid_with_stmt_type 1195 |
| 265 | #define invalid_except_block_type 1196 |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 266 | #define invalid_match_stmt_type 1197 |
| 267 | #define invalid_case_block_type 1198 |
| 268 | #define _loop0_1_type 1199 |
| 269 | #define _loop0_2_type 1200 |
| 270 | #define _loop0_4_type 1201 |
| 271 | #define _gather_3_type 1202 |
| 272 | #define _loop0_6_type 1203 |
| 273 | #define _gather_5_type 1204 |
| 274 | #define _loop0_8_type 1205 |
| 275 | #define _gather_7_type 1206 |
| 276 | #define _loop0_10_type 1207 |
| 277 | #define _gather_9_type 1208 |
| 278 | #define _loop1_11_type 1209 |
| 279 | #define _loop0_13_type 1210 |
| 280 | #define _gather_12_type 1211 |
| 281 | #define _tmp_14_type 1212 |
| 282 | #define _tmp_15_type 1213 |
| 283 | #define _tmp_16_type 1214 |
| 284 | #define _tmp_17_type 1215 |
| 285 | #define _tmp_18_type 1216 |
| 286 | #define _tmp_19_type 1217 |
| 287 | #define _tmp_20_type 1218 |
| 288 | #define _tmp_21_type 1219 |
| 289 | #define _loop1_22_type 1220 |
| 290 | #define _tmp_23_type 1221 |
| 291 | #define _tmp_24_type 1222 |
| 292 | #define _loop0_26_type 1223 |
| 293 | #define _gather_25_type 1224 |
| 294 | #define _loop0_28_type 1225 |
| 295 | #define _gather_27_type 1226 |
| 296 | #define _tmp_29_type 1227 |
| 297 | #define _tmp_30_type 1228 |
| 298 | #define _loop0_31_type 1229 |
| 299 | #define _loop1_32_type 1230 |
| 300 | #define _loop0_34_type 1231 |
| 301 | #define _gather_33_type 1232 |
| 302 | #define _tmp_35_type 1233 |
| 303 | #define _loop0_37_type 1234 |
| 304 | #define _gather_36_type 1235 |
| 305 | #define _tmp_38_type 1236 |
| 306 | #define _loop0_40_type 1237 |
| 307 | #define _gather_39_type 1238 |
| 308 | #define _loop0_42_type 1239 |
| 309 | #define _gather_41_type 1240 |
| 310 | #define _loop0_44_type 1241 |
| 311 | #define _gather_43_type 1242 |
| 312 | #define _loop0_46_type 1243 |
| 313 | #define _gather_45_type 1244 |
| 314 | #define _tmp_47_type 1245 |
| 315 | #define _loop1_48_type 1246 |
| 316 | #define _tmp_49_type 1247 |
| 317 | #define _loop1_50_type 1248 |
| 318 | #define _loop0_52_type 1249 |
| 319 | #define _gather_51_type 1250 |
| 320 | #define _tmp_53_type 1251 |
| 321 | #define _tmp_54_type 1252 |
| 322 | #define _tmp_55_type 1253 |
| 323 | #define _loop0_57_type 1254 |
| 324 | #define _gather_56_type 1255 |
| 325 | #define _tmp_58_type 1256 |
| 326 | #define _loop0_60_type 1257 |
| 327 | #define _gather_59_type 1258 |
| 328 | #define _tmp_61_type 1259 |
| 329 | #define _loop0_63_type 1260 |
| 330 | #define _gather_62_type 1261 |
| 331 | #define _loop0_65_type 1262 |
| 332 | #define _gather_64_type 1263 |
| 333 | #define _tmp_66_type 1264 |
| 334 | #define _tmp_67_type 1265 |
| 335 | #define _tmp_68_type 1266 |
| 336 | #define _tmp_69_type 1267 |
| 337 | #define _loop0_70_type 1268 |
| 338 | #define _loop0_71_type 1269 |
| 339 | #define _loop0_72_type 1270 |
| 340 | #define _loop1_73_type 1271 |
| 341 | #define _loop0_74_type 1272 |
| 342 | #define _loop1_75_type 1273 |
| 343 | #define _loop1_76_type 1274 |
| 344 | #define _loop1_77_type 1275 |
| 345 | #define _loop0_78_type 1276 |
| 346 | #define _loop1_79_type 1277 |
| 347 | #define _loop0_80_type 1278 |
| 348 | #define _loop1_81_type 1279 |
| 349 | #define _loop0_82_type 1280 |
| 350 | #define _loop1_83_type 1281 |
| 351 | #define _loop1_84_type 1282 |
| 352 | #define _tmp_85_type 1283 |
| 353 | #define _loop1_86_type 1284 |
| 354 | #define _loop0_88_type 1285 |
| 355 | #define _gather_87_type 1286 |
| 356 | #define _loop1_89_type 1287 |
| 357 | #define _loop0_90_type 1288 |
| 358 | #define _loop0_91_type 1289 |
| 359 | #define _loop0_92_type 1290 |
| 360 | #define _loop1_93_type 1291 |
| 361 | #define _loop0_94_type 1292 |
| 362 | #define _loop1_95_type 1293 |
| 363 | #define _loop1_96_type 1294 |
| 364 | #define _loop1_97_type 1295 |
| 365 | #define _loop0_98_type 1296 |
| 366 | #define _loop1_99_type 1297 |
| 367 | #define _loop0_100_type 1298 |
| 368 | #define _loop1_101_type 1299 |
| 369 | #define _loop0_102_type 1300 |
| 370 | #define _loop1_103_type 1301 |
| 371 | #define _loop1_104_type 1302 |
| 372 | #define _loop1_105_type 1303 |
| 373 | #define _loop1_106_type 1304 |
| 374 | #define _tmp_107_type 1305 |
| 375 | #define _loop0_109_type 1306 |
| 376 | #define _gather_108_type 1307 |
| 377 | #define _tmp_110_type 1308 |
| 378 | #define _tmp_111_type 1309 |
| 379 | #define _tmp_112_type 1310 |
| 380 | #define _tmp_113_type 1311 |
| 381 | #define _loop1_114_type 1312 |
| 382 | #define _tmp_115_type 1313 |
| 383 | #define _tmp_116_type 1314 |
| 384 | #define _loop0_118_type 1315 |
| 385 | #define _gather_117_type 1316 |
| 386 | #define _loop1_119_type 1317 |
| 387 | #define _loop0_120_type 1318 |
| 388 | #define _loop0_121_type 1319 |
| 389 | #define _loop0_123_type 1320 |
| 390 | #define _gather_122_type 1321 |
| 391 | #define _tmp_124_type 1322 |
| 392 | #define _loop0_126_type 1323 |
| 393 | #define _gather_125_type 1324 |
| 394 | #define _loop0_128_type 1325 |
| 395 | #define _gather_127_type 1326 |
| 396 | #define _loop0_130_type 1327 |
| 397 | #define _gather_129_type 1328 |
| 398 | #define _loop0_132_type 1329 |
| 399 | #define _gather_131_type 1330 |
| 400 | #define _loop0_133_type 1331 |
| 401 | #define _loop0_135_type 1332 |
| 402 | #define _gather_134_type 1333 |
| 403 | #define _loop1_136_type 1334 |
| 404 | #define _tmp_137_type 1335 |
| 405 | #define _loop0_139_type 1336 |
| 406 | #define _gather_138_type 1337 |
| 407 | #define _loop0_141_type 1338 |
| 408 | #define _gather_140_type 1339 |
| 409 | #define _tmp_142_type 1340 |
| 410 | #define _loop0_143_type 1341 |
| 411 | #define _loop0_144_type 1342 |
| 412 | #define _loop0_145_type 1343 |
| 413 | #define _tmp_146_type 1344 |
| 414 | #define _tmp_147_type 1345 |
| 415 | #define _tmp_148_type 1346 |
| 416 | #define _loop0_149_type 1347 |
| 417 | #define _loop1_150_type 1348 |
| 418 | #define _loop0_151_type 1349 |
| 419 | #define _loop1_152_type 1350 |
| 420 | #define _tmp_153_type 1351 |
| 421 | #define _tmp_154_type 1352 |
| 422 | #define _tmp_155_type 1353 |
| 423 | #define _loop0_157_type 1354 |
| 424 | #define _gather_156_type 1355 |
| 425 | #define _loop0_159_type 1356 |
| 426 | #define _gather_158_type 1357 |
| 427 | #define _tmp_160_type 1358 |
| 428 | #define _tmp_161_type 1359 |
| 429 | #define _tmp_162_type 1360 |
| 430 | #define _tmp_163_type 1361 |
| 431 | #define _tmp_164_type 1362 |
| 432 | #define _tmp_165_type 1363 |
| 433 | #define _tmp_166_type 1364 |
| 434 | #define _tmp_167_type 1365 |
| 435 | #define _tmp_168_type 1366 |
| 436 | #define _tmp_169_type 1367 |
| 437 | #define _tmp_170_type 1368 |
| 438 | #define _tmp_171_type 1369 |
| 439 | #define _tmp_172_type 1370 |
| 440 | #define _tmp_173_type 1371 |
| 441 | #define _tmp_174_type 1372 |
| 442 | #define _tmp_175_type 1373 |
| 443 | #define _tmp_176_type 1374 |
| 444 | #define _tmp_177_type 1375 |
| 445 | #define _tmp_178_type 1376 |
| 446 | #define _tmp_179_type 1377 |
| 447 | #define _tmp_180_type 1378 |
| 448 | #define _tmp_181_type 1379 |
| 449 | #define _tmp_182_type 1380 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 450 | |
| 451 | static mod_ty file_rule(Parser *p); |
| 452 | static mod_ty interactive_rule(Parser *p); |
| 453 | static mod_ty eval_rule(Parser *p); |
| 454 | static mod_ty func_type_rule(Parser *p); |
| 455 | static expr_ty fstring_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 456 | static asdl_expr_seq* type_expressions_rule(Parser *p); |
| 457 | static asdl_stmt_seq* statements_rule(Parser *p); |
| 458 | static asdl_stmt_seq* statement_rule(Parser *p); |
| 459 | static asdl_stmt_seq* statement_newline_rule(Parser *p); |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 460 | static asdl_stmt_seq* simple_stmts_rule(Parser *p); |
| 461 | static stmt_ty simple_stmt_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 462 | static stmt_ty compound_stmt_rule(Parser *p); |
| 463 | static stmt_ty assignment_rule(Parser *p); |
| 464 | static AugOperator* augassign_rule(Parser *p); |
| 465 | static stmt_ty global_stmt_rule(Parser *p); |
| 466 | static stmt_ty nonlocal_stmt_rule(Parser *p); |
| 467 | static stmt_ty yield_stmt_rule(Parser *p); |
| 468 | static stmt_ty assert_stmt_rule(Parser *p); |
| 469 | static stmt_ty del_stmt_rule(Parser *p); |
| 470 | static stmt_ty import_stmt_rule(Parser *p); |
| 471 | static stmt_ty import_name_rule(Parser *p); |
| 472 | static stmt_ty import_from_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 473 | static asdl_alias_seq* import_from_targets_rule(Parser *p); |
| 474 | static asdl_alias_seq* import_from_as_names_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 475 | static alias_ty import_from_as_name_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 476 | static asdl_alias_seq* dotted_as_names_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 477 | static alias_ty dotted_as_name_rule(Parser *p); |
| 478 | static expr_ty dotted_name_rule(Parser *p); |
| 479 | static stmt_ty if_stmt_rule(Parser *p); |
| 480 | static stmt_ty elif_stmt_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 481 | static asdl_stmt_seq* else_block_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 482 | static stmt_ty while_stmt_rule(Parser *p); |
| 483 | static stmt_ty for_stmt_rule(Parser *p); |
| 484 | static stmt_ty with_stmt_rule(Parser *p); |
| 485 | static withitem_ty with_item_rule(Parser *p); |
| 486 | static stmt_ty try_stmt_rule(Parser *p); |
| 487 | static excepthandler_ty except_block_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 488 | static asdl_stmt_seq* finally_block_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 489 | static stmt_ty match_stmt_rule(Parser *p); |
| 490 | static expr_ty subject_expr_rule(Parser *p); |
| 491 | static match_case_ty case_block_rule(Parser *p); |
| 492 | static expr_ty guard_rule(Parser *p); |
| 493 | static expr_ty patterns_rule(Parser *p); |
| 494 | static expr_ty pattern_rule(Parser *p); |
| 495 | static expr_ty as_pattern_rule(Parser *p); |
| 496 | static expr_ty or_pattern_rule(Parser *p); |
| 497 | static expr_ty closed_pattern_rule(Parser *p); |
| 498 | static expr_ty literal_pattern_rule(Parser *p); |
| 499 | static expr_ty signed_number_rule(Parser *p); |
| 500 | static expr_ty capture_pattern_rule(Parser *p); |
| 501 | static expr_ty wildcard_pattern_rule(Parser *p); |
| 502 | static expr_ty value_pattern_rule(Parser *p); |
| 503 | static expr_ty attr_rule(Parser *p); |
| 504 | static expr_ty name_or_attr_rule(Parser *p); |
| 505 | static expr_ty group_pattern_rule(Parser *p); |
| 506 | static expr_ty sequence_pattern_rule(Parser *p); |
| 507 | static asdl_seq* open_sequence_pattern_rule(Parser *p); |
| 508 | static asdl_seq* maybe_sequence_pattern_rule(Parser *p); |
| 509 | static expr_ty maybe_star_pattern_rule(Parser *p); |
| 510 | static expr_ty star_pattern_rule(Parser *p); |
| 511 | static expr_ty mapping_pattern_rule(Parser *p); |
| 512 | static asdl_seq* items_pattern_rule(Parser *p); |
| 513 | static KeyValuePair* key_value_pattern_rule(Parser *p); |
| 514 | static KeyValuePair* double_star_pattern_rule(Parser *p); |
| 515 | static expr_ty class_pattern_rule(Parser *p); |
| 516 | static asdl_expr_seq* positional_patterns_rule(Parser *p); |
| 517 | static asdl_keyword_seq* keyword_patterns_rule(Parser *p); |
| 518 | static keyword_ty keyword_pattern_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 519 | static stmt_ty return_stmt_rule(Parser *p); |
| 520 | static stmt_ty raise_stmt_rule(Parser *p); |
| 521 | static stmt_ty function_def_rule(Parser *p); |
| 522 | static stmt_ty function_def_raw_rule(Parser *p); |
| 523 | static Token* func_type_comment_rule(Parser *p); |
| 524 | static arguments_ty params_rule(Parser *p); |
| 525 | static arguments_ty parameters_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 526 | static asdl_arg_seq* slash_no_default_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 527 | static SlashWithDefault* slash_with_default_rule(Parser *p); |
| 528 | static StarEtc* star_etc_rule(Parser *p); |
| 529 | static arg_ty kwds_rule(Parser *p); |
| 530 | static arg_ty param_no_default_rule(Parser *p); |
| 531 | static NameDefaultPair* param_with_default_rule(Parser *p); |
| 532 | static NameDefaultPair* param_maybe_default_rule(Parser *p); |
| 533 | static arg_ty param_rule(Parser *p); |
| 534 | static expr_ty annotation_rule(Parser *p); |
| 535 | static expr_ty default_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 536 | static asdl_expr_seq* decorators_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 537 | static stmt_ty class_def_rule(Parser *p); |
| 538 | static stmt_ty class_def_raw_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 539 | static asdl_stmt_seq* block_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 540 | static expr_ty star_expressions_rule(Parser *p); |
| 541 | static expr_ty star_expression_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 542 | static asdl_expr_seq* star_named_expressions_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 543 | static expr_ty star_named_expression_rule(Parser *p); |
| 544 | static expr_ty named_expression_rule(Parser *p); |
| 545 | static expr_ty annotated_rhs_rule(Parser *p); |
| 546 | static expr_ty expressions_rule(Parser *p); |
| 547 | static expr_ty expression_rule(Parser *p); |
| 548 | static expr_ty lambdef_rule(Parser *p); |
| 549 | static arguments_ty lambda_params_rule(Parser *p); |
| 550 | static arguments_ty lambda_parameters_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 551 | static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 552 | static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); |
| 553 | static StarEtc* lambda_star_etc_rule(Parser *p); |
| 554 | static arg_ty lambda_kwds_rule(Parser *p); |
| 555 | static arg_ty lambda_param_no_default_rule(Parser *p); |
| 556 | static NameDefaultPair* lambda_param_with_default_rule(Parser *p); |
| 557 | static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p); |
| 558 | static arg_ty lambda_param_rule(Parser *p); |
| 559 | static expr_ty disjunction_rule(Parser *p); |
| 560 | static expr_ty conjunction_rule(Parser *p); |
| 561 | static expr_ty inversion_rule(Parser *p); |
| 562 | static expr_ty comparison_rule(Parser *p); |
| 563 | static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p); |
| 564 | static CmpopExprPair* eq_bitwise_or_rule(Parser *p); |
| 565 | static CmpopExprPair* noteq_bitwise_or_rule(Parser *p); |
| 566 | static CmpopExprPair* lte_bitwise_or_rule(Parser *p); |
| 567 | static CmpopExprPair* lt_bitwise_or_rule(Parser *p); |
| 568 | static CmpopExprPair* gte_bitwise_or_rule(Parser *p); |
| 569 | static CmpopExprPair* gt_bitwise_or_rule(Parser *p); |
| 570 | static CmpopExprPair* notin_bitwise_or_rule(Parser *p); |
| 571 | static CmpopExprPair* in_bitwise_or_rule(Parser *p); |
| 572 | static CmpopExprPair* isnot_bitwise_or_rule(Parser *p); |
| 573 | static CmpopExprPair* is_bitwise_or_rule(Parser *p); |
| 574 | static expr_ty bitwise_or_rule(Parser *p); |
| 575 | static expr_ty bitwise_xor_rule(Parser *p); |
| 576 | static expr_ty bitwise_and_rule(Parser *p); |
| 577 | static expr_ty shift_expr_rule(Parser *p); |
| 578 | static expr_ty sum_rule(Parser *p); |
| 579 | static expr_ty term_rule(Parser *p); |
| 580 | static expr_ty factor_rule(Parser *p); |
| 581 | static expr_ty power_rule(Parser *p); |
| 582 | static expr_ty await_primary_rule(Parser *p); |
| 583 | static expr_ty primary_rule(Parser *p); |
| 584 | static expr_ty slices_rule(Parser *p); |
| 585 | static expr_ty slice_rule(Parser *p); |
| 586 | static expr_ty atom_rule(Parser *p); |
| 587 | static expr_ty strings_rule(Parser *p); |
| 588 | static expr_ty list_rule(Parser *p); |
| 589 | static expr_ty listcomp_rule(Parser *p); |
| 590 | static expr_ty tuple_rule(Parser *p); |
| 591 | static expr_ty group_rule(Parser *p); |
| 592 | static expr_ty genexp_rule(Parser *p); |
| 593 | static expr_ty set_rule(Parser *p); |
| 594 | static expr_ty setcomp_rule(Parser *p); |
| 595 | static expr_ty dict_rule(Parser *p); |
| 596 | static expr_ty dictcomp_rule(Parser *p); |
| 597 | static asdl_seq* double_starred_kvpairs_rule(Parser *p); |
| 598 | static KeyValuePair* double_starred_kvpair_rule(Parser *p); |
| 599 | static KeyValuePair* kvpair_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 600 | static asdl_comprehension_seq* for_if_clauses_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 601 | static comprehension_ty for_if_clause_rule(Parser *p); |
| 602 | static expr_ty yield_expr_rule(Parser *p); |
| 603 | static expr_ty arguments_rule(Parser *p); |
| 604 | static expr_ty args_rule(Parser *p); |
| 605 | static asdl_seq* kwargs_rule(Parser *p); |
| 606 | static expr_ty starred_expression_rule(Parser *p); |
| 607 | static KeywordOrStarred* kwarg_or_starred_rule(Parser *p); |
| 608 | static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p); |
| 609 | static expr_ty star_targets_rule(Parser *p); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 610 | static asdl_expr_seq* star_targets_list_seq_rule(Parser *p); |
| 611 | static asdl_expr_seq* star_targets_tuple_seq_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 612 | static expr_ty star_target_rule(Parser *p); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 613 | static expr_ty target_with_star_atom_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 614 | static expr_ty star_atom_rule(Parser *p); |
| 615 | static expr_ty single_target_rule(Parser *p); |
| 616 | static expr_ty single_subscript_attribute_target_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 617 | static asdl_expr_seq* del_targets_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 618 | static expr_ty del_target_rule(Parser *p); |
| 619 | static expr_ty del_t_atom_rule(Parser *p); |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 620 | static asdl_expr_seq* targets_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 621 | static expr_ty target_rule(Parser *p); |
| 622 | static expr_ty t_primary_rule(Parser *p); |
| 623 | static void *t_lookahead_rule(Parser *p); |
| 624 | static expr_ty t_atom_rule(Parser *p); |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 625 | static void *invalid_arguments_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 626 | static void *invalid_kwarg_rule(Parser *p); |
| 627 | static void *invalid_named_expression_rule(Parser *p); |
| 628 | static void *invalid_assignment_rule(Parser *p); |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 629 | static expr_ty invalid_ann_assign_target_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 630 | static void *invalid_del_stmt_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 631 | static void *invalid_block_rule(Parser *p); |
Lysandros Nikolaou | 15acc4e | 2020-10-27 20:54:20 +0200 | [diff] [blame] | 632 | static void *invalid_primary_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 633 | static void *invalid_comprehension_rule(Parser *p); |
| 634 | static void *invalid_dict_comprehension_rule(Parser *p); |
| 635 | static void *invalid_parameters_rule(Parser *p); |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 636 | static void *invalid_parameters_helper_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 637 | static void *invalid_lambda_parameters_rule(Parser *p); |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 638 | static void *invalid_lambda_parameters_helper_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 639 | static void *invalid_star_etc_rule(Parser *p); |
| 640 | static void *invalid_lambda_star_etc_rule(Parser *p); |
| 641 | static void *invalid_double_type_comments_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 642 | static void *invalid_with_item_rule(Parser *p); |
| 643 | static void *invalid_for_target_rule(Parser *p); |
| 644 | static void *invalid_group_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 645 | static void *invalid_import_from_targets_rule(Parser *p); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 646 | static void *invalid_with_stmt_rule(Parser *p); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 647 | static void *invalid_except_block_rule(Parser *p); |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 648 | static void *invalid_match_stmt_rule(Parser *p); |
| 649 | static void *invalid_case_block_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 650 | static asdl_seq *_loop0_1_rule(Parser *p); |
| 651 | static asdl_seq *_loop0_2_rule(Parser *p); |
| 652 | static asdl_seq *_loop0_4_rule(Parser *p); |
| 653 | static asdl_seq *_gather_3_rule(Parser *p); |
| 654 | static asdl_seq *_loop0_6_rule(Parser *p); |
| 655 | static asdl_seq *_gather_5_rule(Parser *p); |
| 656 | static asdl_seq *_loop0_8_rule(Parser *p); |
| 657 | static asdl_seq *_gather_7_rule(Parser *p); |
| 658 | static asdl_seq *_loop0_10_rule(Parser *p); |
| 659 | static asdl_seq *_gather_9_rule(Parser *p); |
| 660 | static asdl_seq *_loop1_11_rule(Parser *p); |
| 661 | static asdl_seq *_loop0_13_rule(Parser *p); |
| 662 | static asdl_seq *_gather_12_rule(Parser *p); |
| 663 | static void *_tmp_14_rule(Parser *p); |
| 664 | static void *_tmp_15_rule(Parser *p); |
| 665 | static void *_tmp_16_rule(Parser *p); |
| 666 | static void *_tmp_17_rule(Parser *p); |
| 667 | static void *_tmp_18_rule(Parser *p); |
| 668 | static void *_tmp_19_rule(Parser *p); |
| 669 | static void *_tmp_20_rule(Parser *p); |
| 670 | static void *_tmp_21_rule(Parser *p); |
| 671 | static asdl_seq *_loop1_22_rule(Parser *p); |
| 672 | static void *_tmp_23_rule(Parser *p); |
| 673 | static void *_tmp_24_rule(Parser *p); |
| 674 | static asdl_seq *_loop0_26_rule(Parser *p); |
| 675 | static asdl_seq *_gather_25_rule(Parser *p); |
| 676 | static asdl_seq *_loop0_28_rule(Parser *p); |
| 677 | static asdl_seq *_gather_27_rule(Parser *p); |
| 678 | static void *_tmp_29_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 679 | static void *_tmp_30_rule(Parser *p); |
| 680 | static asdl_seq *_loop0_31_rule(Parser *p); |
| 681 | static asdl_seq *_loop1_32_rule(Parser *p); |
| 682 | static asdl_seq *_loop0_34_rule(Parser *p); |
| 683 | static asdl_seq *_gather_33_rule(Parser *p); |
| 684 | static void *_tmp_35_rule(Parser *p); |
| 685 | static asdl_seq *_loop0_37_rule(Parser *p); |
| 686 | static asdl_seq *_gather_36_rule(Parser *p); |
| 687 | static void *_tmp_38_rule(Parser *p); |
| 688 | static asdl_seq *_loop0_40_rule(Parser *p); |
| 689 | static asdl_seq *_gather_39_rule(Parser *p); |
| 690 | static asdl_seq *_loop0_42_rule(Parser *p); |
| 691 | static asdl_seq *_gather_41_rule(Parser *p); |
| 692 | static asdl_seq *_loop0_44_rule(Parser *p); |
| 693 | static asdl_seq *_gather_43_rule(Parser *p); |
| 694 | static asdl_seq *_loop0_46_rule(Parser *p); |
| 695 | static asdl_seq *_gather_45_rule(Parser *p); |
| 696 | static void *_tmp_47_rule(Parser *p); |
| 697 | static asdl_seq *_loop1_48_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 698 | static void *_tmp_49_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 699 | static asdl_seq *_loop1_50_rule(Parser *p); |
| 700 | static asdl_seq *_loop0_52_rule(Parser *p); |
| 701 | static asdl_seq *_gather_51_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 702 | static void *_tmp_53_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 703 | static void *_tmp_54_rule(Parser *p); |
| 704 | static void *_tmp_55_rule(Parser *p); |
| 705 | static asdl_seq *_loop0_57_rule(Parser *p); |
| 706 | static asdl_seq *_gather_56_rule(Parser *p); |
| 707 | static void *_tmp_58_rule(Parser *p); |
| 708 | static asdl_seq *_loop0_60_rule(Parser *p); |
| 709 | static asdl_seq *_gather_59_rule(Parser *p); |
| 710 | static void *_tmp_61_rule(Parser *p); |
| 711 | static asdl_seq *_loop0_63_rule(Parser *p); |
| 712 | static asdl_seq *_gather_62_rule(Parser *p); |
| 713 | static asdl_seq *_loop0_65_rule(Parser *p); |
| 714 | static asdl_seq *_gather_64_rule(Parser *p); |
| 715 | static void *_tmp_66_rule(Parser *p); |
| 716 | static void *_tmp_67_rule(Parser *p); |
| 717 | static void *_tmp_68_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 718 | static void *_tmp_69_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 719 | static asdl_seq *_loop0_70_rule(Parser *p); |
| 720 | static asdl_seq *_loop0_71_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 721 | static asdl_seq *_loop0_72_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 722 | static asdl_seq *_loop1_73_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 723 | static asdl_seq *_loop0_74_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 724 | static asdl_seq *_loop1_75_rule(Parser *p); |
| 725 | static asdl_seq *_loop1_76_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 726 | static asdl_seq *_loop1_77_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 727 | static asdl_seq *_loop0_78_rule(Parser *p); |
| 728 | static asdl_seq *_loop1_79_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 729 | static asdl_seq *_loop0_80_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 730 | static asdl_seq *_loop1_81_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 731 | static asdl_seq *_loop0_82_rule(Parser *p); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 732 | static asdl_seq *_loop1_83_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 733 | static asdl_seq *_loop1_84_rule(Parser *p); |
| 734 | static void *_tmp_85_rule(Parser *p); |
| 735 | static asdl_seq *_loop1_86_rule(Parser *p); |
| 736 | static asdl_seq *_loop0_88_rule(Parser *p); |
| 737 | static asdl_seq *_gather_87_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 738 | static asdl_seq *_loop1_89_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 739 | static asdl_seq *_loop0_90_rule(Parser *p); |
| 740 | static asdl_seq *_loop0_91_rule(Parser *p); |
| 741 | static asdl_seq *_loop0_92_rule(Parser *p); |
| 742 | static asdl_seq *_loop1_93_rule(Parser *p); |
| 743 | static asdl_seq *_loop0_94_rule(Parser *p); |
| 744 | static asdl_seq *_loop1_95_rule(Parser *p); |
| 745 | static asdl_seq *_loop1_96_rule(Parser *p); |
| 746 | static asdl_seq *_loop1_97_rule(Parser *p); |
| 747 | static asdl_seq *_loop0_98_rule(Parser *p); |
| 748 | static asdl_seq *_loop1_99_rule(Parser *p); |
| 749 | static asdl_seq *_loop0_100_rule(Parser *p); |
| 750 | static asdl_seq *_loop1_101_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 751 | static asdl_seq *_loop0_102_rule(Parser *p); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 752 | static asdl_seq *_loop1_103_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 753 | static asdl_seq *_loop1_104_rule(Parser *p); |
| 754 | static asdl_seq *_loop1_105_rule(Parser *p); |
| 755 | static asdl_seq *_loop1_106_rule(Parser *p); |
| 756 | static void *_tmp_107_rule(Parser *p); |
| 757 | static asdl_seq *_loop0_109_rule(Parser *p); |
| 758 | static asdl_seq *_gather_108_rule(Parser *p); |
| 759 | static void *_tmp_110_rule(Parser *p); |
| 760 | static void *_tmp_111_rule(Parser *p); |
| 761 | static void *_tmp_112_rule(Parser *p); |
| 762 | static void *_tmp_113_rule(Parser *p); |
| 763 | static asdl_seq *_loop1_114_rule(Parser *p); |
| 764 | static void *_tmp_115_rule(Parser *p); |
| 765 | static void *_tmp_116_rule(Parser *p); |
| 766 | static asdl_seq *_loop0_118_rule(Parser *p); |
| 767 | static asdl_seq *_gather_117_rule(Parser *p); |
| 768 | static asdl_seq *_loop1_119_rule(Parser *p); |
| 769 | static asdl_seq *_loop0_120_rule(Parser *p); |
| 770 | static asdl_seq *_loop0_121_rule(Parser *p); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 771 | static asdl_seq *_loop0_123_rule(Parser *p); |
| 772 | static asdl_seq *_gather_122_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 773 | static void *_tmp_124_rule(Parser *p); |
| 774 | static asdl_seq *_loop0_126_rule(Parser *p); |
| 775 | static asdl_seq *_gather_125_rule(Parser *p); |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 776 | static asdl_seq *_loop0_128_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 777 | static asdl_seq *_gather_127_rule(Parser *p); |
| 778 | static asdl_seq *_loop0_130_rule(Parser *p); |
| 779 | static asdl_seq *_gather_129_rule(Parser *p); |
| 780 | static asdl_seq *_loop0_132_rule(Parser *p); |
| 781 | static asdl_seq *_gather_131_rule(Parser *p); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 782 | static asdl_seq *_loop0_133_rule(Parser *p); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 783 | static asdl_seq *_loop0_135_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 784 | static asdl_seq *_gather_134_rule(Parser *p); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 785 | static asdl_seq *_loop1_136_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 786 | static void *_tmp_137_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 787 | static asdl_seq *_loop0_139_rule(Parser *p); |
| 788 | static asdl_seq *_gather_138_rule(Parser *p); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 789 | static asdl_seq *_loop0_141_rule(Parser *p); |
| 790 | static asdl_seq *_gather_140_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 791 | static void *_tmp_142_rule(Parser *p); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 792 | static asdl_seq *_loop0_143_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 793 | static asdl_seq *_loop0_144_rule(Parser *p); |
| 794 | static asdl_seq *_loop0_145_rule(Parser *p); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 795 | static void *_tmp_146_rule(Parser *p); |
| 796 | static void *_tmp_147_rule(Parser *p); |
| 797 | static void *_tmp_148_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 798 | static asdl_seq *_loop0_149_rule(Parser *p); |
| 799 | static asdl_seq *_loop1_150_rule(Parser *p); |
| 800 | static asdl_seq *_loop0_151_rule(Parser *p); |
| 801 | static asdl_seq *_loop1_152_rule(Parser *p); |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 802 | static void *_tmp_153_rule(Parser *p); |
| 803 | static void *_tmp_154_rule(Parser *p); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 804 | static void *_tmp_155_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 805 | static asdl_seq *_loop0_157_rule(Parser *p); |
| 806 | static asdl_seq *_gather_156_rule(Parser *p); |
| 807 | static asdl_seq *_loop0_159_rule(Parser *p); |
| 808 | static asdl_seq *_gather_158_rule(Parser *p); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 809 | static void *_tmp_160_rule(Parser *p); |
| 810 | static void *_tmp_161_rule(Parser *p); |
| 811 | static void *_tmp_162_rule(Parser *p); |
| 812 | static void *_tmp_163_rule(Parser *p); |
| 813 | static void *_tmp_164_rule(Parser *p); |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 814 | static void *_tmp_165_rule(Parser *p); |
| 815 | static void *_tmp_166_rule(Parser *p); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 816 | static void *_tmp_167_rule(Parser *p); |
| 817 | static void *_tmp_168_rule(Parser *p); |
| 818 | static void *_tmp_169_rule(Parser *p); |
| 819 | static void *_tmp_170_rule(Parser *p); |
| 820 | static void *_tmp_171_rule(Parser *p); |
| 821 | static void *_tmp_172_rule(Parser *p); |
| 822 | static void *_tmp_173_rule(Parser *p); |
| 823 | static void *_tmp_174_rule(Parser *p); |
| 824 | static void *_tmp_175_rule(Parser *p); |
| 825 | static void *_tmp_176_rule(Parser *p); |
| 826 | static void *_tmp_177_rule(Parser *p); |
| 827 | static void *_tmp_178_rule(Parser *p); |
| 828 | static void *_tmp_179_rule(Parser *p); |
| 829 | static void *_tmp_180_rule(Parser *p); |
| 830 | static void *_tmp_181_rule(Parser *p); |
| 831 | static void *_tmp_182_rule(Parser *p); |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 832 | |
| 833 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 834 | // file: statements? $ |
| 835 | static mod_ty |
| 836 | file_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 837 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 838 | D(p->level++); |
| 839 | if (p->error_indicator) { |
| 840 | D(p->level--); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 841 | return NULL; |
| 842 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 843 | mod_ty _res = NULL; |
| 844 | int _mark = p->mark; |
| 845 | { // statements? $ |
| 846 | if (p->error_indicator) { |
| 847 | D(p->level--); |
| 848 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 849 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 850 | D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $")); |
| 851 | void *a; |
| 852 | Token * endmarker_var; |
| 853 | if ( |
| 854 | (a = statements_rule(p), 1) // statements? |
| 855 | && |
| 856 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
| 857 | ) |
| 858 | { |
| 859 | D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $")); |
| 860 | _res = _PyPegen_make_module ( p , a ); |
| 861 | if (_res == NULL && PyErr_Occurred()) { |
| 862 | p->error_indicator = 1; |
| 863 | D(p->level--); |
| 864 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 865 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 866 | goto done; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 867 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 868 | p->mark = _mark; |
| 869 | D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ', |
| 870 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $")); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 871 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 872 | _res = NULL; |
| 873 | done: |
| 874 | D(p->level--); |
| 875 | return _res; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 876 | } |
| 877 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 878 | // interactive: statement_newline |
| 879 | static mod_ty |
| 880 | interactive_rule(Parser *p) |
Guido van Rossum | b09f7ed | 2001-07-15 21:08:29 +0000 | [diff] [blame] | 881 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 882 | D(p->level++); |
| 883 | if (p->error_indicator) { |
| 884 | D(p->level--); |
| 885 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 886 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 887 | mod_ty _res = NULL; |
| 888 | int _mark = p->mark; |
| 889 | { // statement_newline |
| 890 | if (p->error_indicator) { |
| 891 | D(p->level--); |
| 892 | return NULL; |
| 893 | } |
| 894 | 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] | 895 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 896 | if ( |
| 897 | (a = statement_newline_rule(p)) // statement_newline |
| 898 | ) |
| 899 | { |
| 900 | D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline")); |
| 901 | _res = Interactive ( a , p -> arena ); |
| 902 | if (_res == NULL && PyErr_Occurred()) { |
| 903 | p->error_indicator = 1; |
| 904 | D(p->level--); |
| 905 | return NULL; |
| 906 | } |
| 907 | goto done; |
| 908 | } |
| 909 | p->mark = _mark; |
| 910 | D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ', |
| 911 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline")); |
| 912 | } |
| 913 | _res = NULL; |
| 914 | done: |
| 915 | D(p->level--); |
| 916 | return _res; |
Guido van Rossum | b09f7ed | 2001-07-15 21:08:29 +0000 | [diff] [blame] | 917 | } |
| 918 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 919 | // eval: expressions NEWLINE* $ |
| 920 | static mod_ty |
| 921 | eval_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 922 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 923 | D(p->level++); |
| 924 | if (p->error_indicator) { |
| 925 | D(p->level--); |
| 926 | return NULL; |
| 927 | } |
| 928 | mod_ty _res = NULL; |
| 929 | int _mark = p->mark; |
| 930 | { // expressions NEWLINE* $ |
| 931 | if (p->error_indicator) { |
| 932 | D(p->level--); |
| 933 | return NULL; |
| 934 | } |
| 935 | D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $")); |
| 936 | asdl_seq * _loop0_1_var; |
| 937 | expr_ty a; |
| 938 | Token * endmarker_var; |
| 939 | if ( |
| 940 | (a = expressions_rule(p)) // expressions |
| 941 | && |
| 942 | (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE* |
| 943 | && |
| 944 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
| 945 | ) |
| 946 | { |
| 947 | D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $")); |
| 948 | _res = Expression ( a , p -> arena ); |
| 949 | if (_res == NULL && PyErr_Occurred()) { |
| 950 | p->error_indicator = 1; |
| 951 | D(p->level--); |
| 952 | return NULL; |
| 953 | } |
| 954 | goto done; |
| 955 | } |
| 956 | p->mark = _mark; |
| 957 | D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ', |
| 958 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $")); |
| 959 | } |
| 960 | _res = NULL; |
| 961 | done: |
| 962 | D(p->level--); |
| 963 | return _res; |
| 964 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 965 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 966 | // func_type: '(' type_expressions? ')' '->' expression NEWLINE* $ |
| 967 | static mod_ty |
| 968 | func_type_rule(Parser *p) |
| 969 | { |
| 970 | D(p->level++); |
| 971 | if (p->error_indicator) { |
| 972 | D(p->level--); |
| 973 | return NULL; |
| 974 | } |
| 975 | mod_ty _res = NULL; |
| 976 | int _mark = p->mark; |
| 977 | { // '(' type_expressions? ')' '->' expression NEWLINE* $ |
| 978 | if (p->error_indicator) { |
| 979 | D(p->level--); |
| 980 | return NULL; |
| 981 | } |
| 982 | D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
| 983 | Token * _literal; |
| 984 | Token * _literal_1; |
| 985 | Token * _literal_2; |
| 986 | asdl_seq * _loop0_2_var; |
| 987 | void *a; |
| 988 | expr_ty b; |
| 989 | Token * endmarker_var; |
| 990 | if ( |
| 991 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 992 | && |
| 993 | (a = type_expressions_rule(p), 1) // type_expressions? |
| 994 | && |
| 995 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 996 | && |
| 997 | (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->' |
| 998 | && |
| 999 | (b = expression_rule(p)) // expression |
| 1000 | && |
| 1001 | (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE* |
| 1002 | && |
| 1003 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
| 1004 | ) |
| 1005 | { |
| 1006 | D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
| 1007 | _res = FunctionType ( a , b , p -> arena ); |
| 1008 | if (_res == NULL && PyErr_Occurred()) { |
| 1009 | p->error_indicator = 1; |
| 1010 | D(p->level--); |
| 1011 | return NULL; |
| 1012 | } |
| 1013 | goto done; |
| 1014 | } |
| 1015 | p->mark = _mark; |
| 1016 | D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ', |
| 1017 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
| 1018 | } |
| 1019 | _res = NULL; |
| 1020 | done: |
| 1021 | D(p->level--); |
| 1022 | return _res; |
| 1023 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 1024 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1025 | // fstring: star_expressions |
| 1026 | static expr_ty |
| 1027 | fstring_rule(Parser *p) |
| 1028 | { |
| 1029 | D(p->level++); |
| 1030 | if (p->error_indicator) { |
| 1031 | D(p->level--); |
| 1032 | return NULL; |
| 1033 | } |
| 1034 | expr_ty _res = NULL; |
| 1035 | int _mark = p->mark; |
| 1036 | { // star_expressions |
| 1037 | if (p->error_indicator) { |
| 1038 | D(p->level--); |
| 1039 | return NULL; |
| 1040 | } |
| 1041 | D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 1042 | expr_ty star_expressions_var; |
| 1043 | if ( |
| 1044 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 1045 | ) |
| 1046 | { |
| 1047 | D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 1048 | _res = star_expressions_var; |
| 1049 | goto done; |
| 1050 | } |
| 1051 | p->mark = _mark; |
| 1052 | D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ', |
| 1053 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 1054 | } |
| 1055 | _res = NULL; |
| 1056 | done: |
| 1057 | D(p->level--); |
| 1058 | return _res; |
| 1059 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 1060 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1061 | // type_expressions: |
| 1062 | // | ','.expression+ ',' '*' expression ',' '**' expression |
| 1063 | // | ','.expression+ ',' '*' expression |
| 1064 | // | ','.expression+ ',' '**' expression |
| 1065 | // | '*' expression ',' '**' expression |
| 1066 | // | '*' expression |
| 1067 | // | '**' expression |
| 1068 | // | ','.expression+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1069 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1070 | type_expressions_rule(Parser *p) |
| 1071 | { |
| 1072 | D(p->level++); |
| 1073 | if (p->error_indicator) { |
| 1074 | D(p->level--); |
| 1075 | return NULL; |
| 1076 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1077 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1078 | int _mark = p->mark; |
| 1079 | { // ','.expression+ ',' '*' expression ',' '**' expression |
| 1080 | if (p->error_indicator) { |
| 1081 | D(p->level--); |
| 1082 | return NULL; |
| 1083 | } |
| 1084 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
| 1085 | Token * _literal; |
| 1086 | Token * _literal_1; |
| 1087 | Token * _literal_2; |
| 1088 | Token * _literal_3; |
| 1089 | asdl_seq * a; |
| 1090 | expr_ty b; |
| 1091 | expr_ty c; |
| 1092 | if ( |
| 1093 | (a = _gather_3_rule(p)) // ','.expression+ |
| 1094 | && |
| 1095 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 1096 | && |
| 1097 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
| 1098 | && |
| 1099 | (b = expression_rule(p)) // expression |
| 1100 | && |
| 1101 | (_literal_2 = _PyPegen_expect_token(p, 12)) // token=',' |
| 1102 | && |
| 1103 | (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**' |
| 1104 | && |
| 1105 | (c = expression_rule(p)) // expression |
| 1106 | ) |
| 1107 | { |
| 1108 | 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] | 1109 | _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] | 1110 | if (_res == NULL && PyErr_Occurred()) { |
| 1111 | p->error_indicator = 1; |
| 1112 | D(p->level--); |
| 1113 | return NULL; |
| 1114 | } |
| 1115 | goto done; |
| 1116 | } |
| 1117 | p->mark = _mark; |
| 1118 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1119 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
| 1120 | } |
| 1121 | { // ','.expression+ ',' '*' expression |
| 1122 | if (p->error_indicator) { |
| 1123 | D(p->level--); |
| 1124 | return NULL; |
| 1125 | } |
| 1126 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression")); |
| 1127 | Token * _literal; |
| 1128 | Token * _literal_1; |
| 1129 | asdl_seq * a; |
| 1130 | expr_ty b; |
| 1131 | if ( |
| 1132 | (a = _gather_5_rule(p)) // ','.expression+ |
| 1133 | && |
| 1134 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 1135 | && |
| 1136 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
| 1137 | && |
| 1138 | (b = expression_rule(p)) // expression |
| 1139 | ) |
| 1140 | { |
| 1141 | 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] | 1142 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1143 | if (_res == NULL && PyErr_Occurred()) { |
| 1144 | p->error_indicator = 1; |
| 1145 | D(p->level--); |
| 1146 | return NULL; |
| 1147 | } |
| 1148 | goto done; |
| 1149 | } |
| 1150 | p->mark = _mark; |
| 1151 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1152 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression")); |
| 1153 | } |
| 1154 | { // ','.expression+ ',' '**' expression |
| 1155 | if (p->error_indicator) { |
| 1156 | D(p->level--); |
| 1157 | return NULL; |
| 1158 | } |
| 1159 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression")); |
| 1160 | Token * _literal; |
| 1161 | Token * _literal_1; |
| 1162 | asdl_seq * a; |
| 1163 | expr_ty b; |
| 1164 | if ( |
| 1165 | (a = _gather_7_rule(p)) // ','.expression+ |
| 1166 | && |
| 1167 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 1168 | && |
| 1169 | (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**' |
| 1170 | && |
| 1171 | (b = expression_rule(p)) // expression |
| 1172 | ) |
| 1173 | { |
| 1174 | 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] | 1175 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1176 | if (_res == NULL && PyErr_Occurred()) { |
| 1177 | p->error_indicator = 1; |
| 1178 | D(p->level--); |
| 1179 | return NULL; |
| 1180 | } |
| 1181 | goto done; |
| 1182 | } |
| 1183 | p->mark = _mark; |
| 1184 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1185 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression")); |
| 1186 | } |
| 1187 | { // '*' expression ',' '**' expression |
| 1188 | if (p->error_indicator) { |
| 1189 | D(p->level--); |
| 1190 | return NULL; |
| 1191 | } |
| 1192 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression")); |
| 1193 | Token * _literal; |
| 1194 | Token * _literal_1; |
| 1195 | Token * _literal_2; |
| 1196 | expr_ty a; |
| 1197 | expr_ty b; |
| 1198 | if ( |
| 1199 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 1200 | && |
| 1201 | (a = expression_rule(p)) // expression |
| 1202 | && |
| 1203 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 1204 | && |
| 1205 | (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**' |
| 1206 | && |
| 1207 | (b = expression_rule(p)) // expression |
| 1208 | ) |
| 1209 | { |
| 1210 | 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] | 1211 | _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] | 1212 | if (_res == NULL && PyErr_Occurred()) { |
| 1213 | p->error_indicator = 1; |
| 1214 | D(p->level--); |
| 1215 | return NULL; |
| 1216 | } |
| 1217 | goto done; |
| 1218 | } |
| 1219 | p->mark = _mark; |
| 1220 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1221 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression")); |
| 1222 | } |
| 1223 | { // '*' expression |
| 1224 | if (p->error_indicator) { |
| 1225 | D(p->level--); |
| 1226 | return NULL; |
| 1227 | } |
| 1228 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
| 1229 | Token * _literal; |
| 1230 | expr_ty a; |
| 1231 | if ( |
| 1232 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 1233 | && |
| 1234 | (a = expression_rule(p)) // expression |
| 1235 | ) |
| 1236 | { |
| 1237 | 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] | 1238 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1239 | if (_res == NULL && PyErr_Occurred()) { |
| 1240 | p->error_indicator = 1; |
| 1241 | D(p->level--); |
| 1242 | return NULL; |
| 1243 | } |
| 1244 | goto done; |
| 1245 | } |
| 1246 | p->mark = _mark; |
| 1247 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1248 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
| 1249 | } |
| 1250 | { // '**' expression |
| 1251 | if (p->error_indicator) { |
| 1252 | D(p->level--); |
| 1253 | return NULL; |
| 1254 | } |
| 1255 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
| 1256 | Token * _literal; |
| 1257 | expr_ty a; |
| 1258 | if ( |
| 1259 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 1260 | && |
| 1261 | (a = expression_rule(p)) // expression |
| 1262 | ) |
| 1263 | { |
| 1264 | 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] | 1265 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1266 | if (_res == NULL && PyErr_Occurred()) { |
| 1267 | p->error_indicator = 1; |
| 1268 | D(p->level--); |
| 1269 | return NULL; |
| 1270 | } |
| 1271 | goto done; |
| 1272 | } |
| 1273 | p->mark = _mark; |
| 1274 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1275 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
| 1276 | } |
| 1277 | { // ','.expression+ |
| 1278 | if (p->error_indicator) { |
| 1279 | D(p->level--); |
| 1280 | return NULL; |
| 1281 | } |
| 1282 | 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] | 1283 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1284 | if ( |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1285 | (a = (asdl_expr_seq*)_gather_9_rule(p)) // ','.expression+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1286 | ) |
| 1287 | { |
| 1288 | 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] | 1289 | _res = a; |
| 1290 | if (_res == NULL && PyErr_Occurred()) { |
| 1291 | p->error_indicator = 1; |
| 1292 | D(p->level--); |
| 1293 | return NULL; |
| 1294 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1295 | goto done; |
| 1296 | } |
| 1297 | p->mark = _mark; |
| 1298 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1299 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+")); |
| 1300 | } |
| 1301 | _res = NULL; |
| 1302 | done: |
| 1303 | D(p->level--); |
| 1304 | return _res; |
| 1305 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 1306 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1307 | // statements: statement+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1308 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1309 | statements_rule(Parser *p) |
| 1310 | { |
| 1311 | D(p->level++); |
| 1312 | if (p->error_indicator) { |
| 1313 | D(p->level--); |
| 1314 | return NULL; |
| 1315 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1316 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1317 | int _mark = p->mark; |
| 1318 | { // statement+ |
| 1319 | if (p->error_indicator) { |
| 1320 | D(p->level--); |
| 1321 | return NULL; |
| 1322 | } |
| 1323 | D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+")); |
| 1324 | asdl_seq * a; |
| 1325 | if ( |
| 1326 | (a = _loop1_11_rule(p)) // statement+ |
| 1327 | ) |
| 1328 | { |
| 1329 | 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] | 1330 | _res = ( asdl_stmt_seq * ) _PyPegen_seq_flatten ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1331 | if (_res == NULL && PyErr_Occurred()) { |
| 1332 | p->error_indicator = 1; |
| 1333 | D(p->level--); |
| 1334 | return NULL; |
| 1335 | } |
| 1336 | goto done; |
| 1337 | } |
| 1338 | p->mark = _mark; |
| 1339 | D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ', |
| 1340 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+")); |
| 1341 | } |
| 1342 | _res = NULL; |
| 1343 | done: |
| 1344 | D(p->level--); |
| 1345 | return _res; |
| 1346 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 1347 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1348 | // statement: compound_stmt | simple_stmts |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1349 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1350 | statement_rule(Parser *p) |
| 1351 | { |
| 1352 | D(p->level++); |
| 1353 | if (p->error_indicator) { |
| 1354 | D(p->level--); |
| 1355 | return NULL; |
| 1356 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1357 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1358 | int _mark = p->mark; |
| 1359 | { // compound_stmt |
| 1360 | if (p->error_indicator) { |
| 1361 | D(p->level--); |
| 1362 | return NULL; |
| 1363 | } |
| 1364 | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
| 1365 | stmt_ty a; |
| 1366 | if ( |
| 1367 | (a = compound_stmt_rule(p)) // compound_stmt |
| 1368 | ) |
| 1369 | { |
| 1370 | 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] | 1371 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1372 | if (_res == NULL && PyErr_Occurred()) { |
| 1373 | p->error_indicator = 1; |
| 1374 | D(p->level--); |
| 1375 | return NULL; |
| 1376 | } |
| 1377 | goto done; |
| 1378 | } |
| 1379 | p->mark = _mark; |
| 1380 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
| 1381 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt")); |
| 1382 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1383 | { // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1384 | if (p->error_indicator) { |
| 1385 | D(p->level--); |
| 1386 | return NULL; |
| 1387 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1388 | 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] | 1389 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1390 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1391 | (a = (asdl_stmt_seq*)simple_stmts_rule(p)) // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1392 | ) |
| 1393 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1394 | 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] | 1395 | _res = a; |
| 1396 | if (_res == NULL && PyErr_Occurred()) { |
| 1397 | p->error_indicator = 1; |
| 1398 | D(p->level--); |
| 1399 | return NULL; |
| 1400 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1401 | goto done; |
| 1402 | } |
| 1403 | p->mark = _mark; |
| 1404 | 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] | 1405 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1406 | } |
| 1407 | _res = NULL; |
| 1408 | done: |
| 1409 | D(p->level--); |
| 1410 | return _res; |
| 1411 | } |
| 1412 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1413 | // statement_newline: compound_stmt NEWLINE | simple_stmts | NEWLINE | $ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1414 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1415 | statement_newline_rule(Parser *p) |
| 1416 | { |
| 1417 | D(p->level++); |
| 1418 | if (p->error_indicator) { |
| 1419 | D(p->level--); |
| 1420 | return NULL; |
| 1421 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1422 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1423 | int _mark = p->mark; |
| 1424 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 1425 | p->error_indicator = 1; |
| 1426 | D(p->level--); |
| 1427 | return NULL; |
| 1428 | } |
| 1429 | int _start_lineno = p->tokens[_mark]->lineno; |
| 1430 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 1431 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 1432 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 1433 | { // compound_stmt NEWLINE |
| 1434 | if (p->error_indicator) { |
| 1435 | D(p->level--); |
| 1436 | return NULL; |
| 1437 | } |
| 1438 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE")); |
| 1439 | stmt_ty a; |
| 1440 | Token * newline_var; |
| 1441 | if ( |
| 1442 | (a = compound_stmt_rule(p)) // compound_stmt |
| 1443 | && |
| 1444 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 1445 | ) |
| 1446 | { |
| 1447 | 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] | 1448 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1449 | if (_res == NULL && PyErr_Occurred()) { |
| 1450 | p->error_indicator = 1; |
| 1451 | D(p->level--); |
| 1452 | return NULL; |
| 1453 | } |
| 1454 | goto done; |
| 1455 | } |
| 1456 | p->mark = _mark; |
| 1457 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1458 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE")); |
| 1459 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1460 | { // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1461 | if (p->error_indicator) { |
| 1462 | D(p->level--); |
| 1463 | return NULL; |
| 1464 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1465 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
| 1466 | asdl_stmt_seq* simple_stmts_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1467 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1468 | (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1469 | ) |
| 1470 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1471 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
| 1472 | _res = simple_stmts_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1473 | goto done; |
| 1474 | } |
| 1475 | p->mark = _mark; |
| 1476 | 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] | 1477 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1478 | } |
| 1479 | { // NEWLINE |
| 1480 | if (p->error_indicator) { |
| 1481 | D(p->level--); |
| 1482 | return NULL; |
| 1483 | } |
| 1484 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 1485 | Token * newline_var; |
| 1486 | if ( |
| 1487 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 1488 | ) |
| 1489 | { |
| 1490 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 1491 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1492 | if (_token == NULL) { |
| 1493 | D(p->level--); |
| 1494 | return NULL; |
| 1495 | } |
| 1496 | int _end_lineno = _token->end_lineno; |
| 1497 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1498 | int _end_col_offset = _token->end_col_offset; |
| 1499 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 1500 | _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] | 1501 | if (_res == NULL && PyErr_Occurred()) { |
| 1502 | p->error_indicator = 1; |
| 1503 | D(p->level--); |
| 1504 | return NULL; |
| 1505 | } |
| 1506 | goto done; |
| 1507 | } |
| 1508 | p->mark = _mark; |
| 1509 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1510 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
| 1511 | } |
| 1512 | { // $ |
| 1513 | if (p->error_indicator) { |
| 1514 | D(p->level--); |
| 1515 | return NULL; |
| 1516 | } |
| 1517 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$")); |
| 1518 | Token * endmarker_var; |
| 1519 | if ( |
| 1520 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
| 1521 | ) |
| 1522 | { |
| 1523 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$")); |
| 1524 | _res = _PyPegen_interactive_exit ( p ); |
| 1525 | if (_res == NULL && PyErr_Occurred()) { |
| 1526 | p->error_indicator = 1; |
| 1527 | D(p->level--); |
| 1528 | return NULL; |
| 1529 | } |
| 1530 | goto done; |
| 1531 | } |
| 1532 | p->mark = _mark; |
| 1533 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1534 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$")); |
| 1535 | } |
| 1536 | _res = NULL; |
| 1537 | done: |
| 1538 | D(p->level--); |
| 1539 | return _res; |
| 1540 | } |
| 1541 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1542 | // simple_stmts: simple_stmt !';' NEWLINE | ';'.simple_stmt+ ';'? NEWLINE |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1543 | static asdl_stmt_seq* |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1544 | simple_stmts_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1545 | { |
| 1546 | D(p->level++); |
| 1547 | if (p->error_indicator) { |
| 1548 | D(p->level--); |
| 1549 | return NULL; |
| 1550 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1551 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1552 | int _mark = p->mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1553 | { // simple_stmt !';' NEWLINE |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1554 | if (p->error_indicator) { |
| 1555 | D(p->level--); |
| 1556 | return NULL; |
| 1557 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1558 | 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] | 1559 | stmt_ty a; |
| 1560 | Token * newline_var; |
| 1561 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1562 | (a = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1563 | && |
| 1564 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';' |
| 1565 | && |
| 1566 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 1567 | ) |
| 1568 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1569 | 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] | 1570 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1571 | if (_res == NULL && PyErr_Occurred()) { |
| 1572 | p->error_indicator = 1; |
| 1573 | D(p->level--); |
| 1574 | return NULL; |
| 1575 | } |
| 1576 | goto done; |
| 1577 | } |
| 1578 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1579 | D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ', |
| 1580 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt !';' NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1581 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1582 | { // ';'.simple_stmt+ ';'? NEWLINE |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1583 | if (p->error_indicator) { |
| 1584 | D(p->level--); |
| 1585 | return NULL; |
| 1586 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1587 | 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] | 1588 | void *_opt_var; |
| 1589 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 1590 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1591 | Token * newline_var; |
| 1592 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1593 | (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.simple_stmt+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1594 | && |
| 1595 | (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'? |
| 1596 | && |
| 1597 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 1598 | ) |
| 1599 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1600 | 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] | 1601 | _res = a; |
| 1602 | if (_res == NULL && PyErr_Occurred()) { |
| 1603 | p->error_indicator = 1; |
| 1604 | D(p->level--); |
| 1605 | return NULL; |
| 1606 | } |
| 1607 | goto done; |
| 1608 | } |
| 1609 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1610 | D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ', |
| 1611 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1612 | } |
| 1613 | _res = NULL; |
| 1614 | done: |
| 1615 | D(p->level--); |
| 1616 | return _res; |
| 1617 | } |
| 1618 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1619 | // simple_stmt: |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1620 | // | assignment |
| 1621 | // | star_expressions |
| 1622 | // | &'return' return_stmt |
| 1623 | // | &('import' | 'from') import_stmt |
| 1624 | // | &'raise' raise_stmt |
| 1625 | // | 'pass' |
| 1626 | // | &'del' del_stmt |
| 1627 | // | &'yield' yield_stmt |
| 1628 | // | &'assert' assert_stmt |
| 1629 | // | 'break' |
| 1630 | // | 'continue' |
| 1631 | // | &'global' global_stmt |
| 1632 | // | &'nonlocal' nonlocal_stmt |
| 1633 | static stmt_ty |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1634 | simple_stmt_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1635 | { |
| 1636 | D(p->level++); |
| 1637 | if (p->error_indicator) { |
| 1638 | D(p->level--); |
| 1639 | return NULL; |
| 1640 | } |
| 1641 | stmt_ty _res = NULL; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1642 | if (_PyPegen_is_memoized(p, simple_stmt_type, &_res)) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1643 | D(p->level--); |
| 1644 | return _res; |
| 1645 | } |
| 1646 | int _mark = p->mark; |
| 1647 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 1648 | p->error_indicator = 1; |
| 1649 | D(p->level--); |
| 1650 | return NULL; |
| 1651 | } |
| 1652 | int _start_lineno = p->tokens[_mark]->lineno; |
| 1653 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 1654 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 1655 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 1656 | { // assignment |
| 1657 | if (p->error_indicator) { |
| 1658 | D(p->level--); |
| 1659 | return NULL; |
| 1660 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1661 | 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] | 1662 | stmt_ty assignment_var; |
| 1663 | if ( |
| 1664 | (assignment_var = assignment_rule(p)) // assignment |
| 1665 | ) |
| 1666 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1667 | 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] | 1668 | _res = assignment_var; |
| 1669 | goto done; |
| 1670 | } |
| 1671 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1672 | 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] | 1673 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment")); |
| 1674 | } |
| 1675 | { // star_expressions |
| 1676 | if (p->error_indicator) { |
| 1677 | D(p->level--); |
| 1678 | return NULL; |
| 1679 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1680 | 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] | 1681 | expr_ty e; |
| 1682 | if ( |
| 1683 | (e = star_expressions_rule(p)) // star_expressions |
| 1684 | ) |
| 1685 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1686 | 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] | 1687 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1688 | if (_token == NULL) { |
| 1689 | D(p->level--); |
| 1690 | return NULL; |
| 1691 | } |
| 1692 | int _end_lineno = _token->end_lineno; |
| 1693 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1694 | int _end_col_offset = _token->end_col_offset; |
| 1695 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1696 | _res = _Py_Expr ( e , EXTRA ); |
| 1697 | if (_res == NULL && PyErr_Occurred()) { |
| 1698 | p->error_indicator = 1; |
| 1699 | D(p->level--); |
| 1700 | return NULL; |
| 1701 | } |
| 1702 | goto done; |
| 1703 | } |
| 1704 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1705 | 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] | 1706 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 1707 | } |
| 1708 | { // &'return' return_stmt |
| 1709 | if (p->error_indicator) { |
| 1710 | D(p->level--); |
| 1711 | return NULL; |
| 1712 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1713 | 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] | 1714 | stmt_ty return_stmt_var; |
| 1715 | if ( |
| 1716 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return' |
| 1717 | && |
| 1718 | (return_stmt_var = return_stmt_rule(p)) // return_stmt |
| 1719 | ) |
| 1720 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1721 | 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] | 1722 | _res = return_stmt_var; |
| 1723 | goto done; |
| 1724 | } |
| 1725 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1726 | 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] | 1727 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt")); |
| 1728 | } |
| 1729 | { // &('import' | 'from') import_stmt |
| 1730 | if (p->error_indicator) { |
| 1731 | D(p->level--); |
| 1732 | return NULL; |
| 1733 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1734 | 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] | 1735 | stmt_ty import_stmt_var; |
| 1736 | if ( |
| 1737 | _PyPegen_lookahead(1, _tmp_14_rule, p) |
| 1738 | && |
| 1739 | (import_stmt_var = import_stmt_rule(p)) // import_stmt |
| 1740 | ) |
| 1741 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1742 | 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] | 1743 | _res = import_stmt_var; |
| 1744 | goto done; |
| 1745 | } |
| 1746 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1747 | 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] | 1748 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt")); |
| 1749 | } |
| 1750 | { // &'raise' raise_stmt |
| 1751 | if (p->error_indicator) { |
| 1752 | D(p->level--); |
| 1753 | return NULL; |
| 1754 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1755 | 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] | 1756 | stmt_ty raise_stmt_var; |
| 1757 | if ( |
| 1758 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise' |
| 1759 | && |
| 1760 | (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt |
| 1761 | ) |
| 1762 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1763 | 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] | 1764 | _res = raise_stmt_var; |
| 1765 | goto done; |
| 1766 | } |
| 1767 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1768 | 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] | 1769 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt")); |
| 1770 | } |
| 1771 | { // 'pass' |
| 1772 | if (p->error_indicator) { |
| 1773 | D(p->level--); |
| 1774 | return NULL; |
| 1775 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1776 | 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] | 1777 | Token * _keyword; |
| 1778 | if ( |
| 1779 | (_keyword = _PyPegen_expect_token(p, 502)) // token='pass' |
| 1780 | ) |
| 1781 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1782 | 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] | 1783 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1784 | if (_token == NULL) { |
| 1785 | D(p->level--); |
| 1786 | return NULL; |
| 1787 | } |
| 1788 | int _end_lineno = _token->end_lineno; |
| 1789 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1790 | int _end_col_offset = _token->end_col_offset; |
| 1791 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1792 | _res = _Py_Pass ( EXTRA ); |
| 1793 | if (_res == NULL && PyErr_Occurred()) { |
| 1794 | p->error_indicator = 1; |
| 1795 | D(p->level--); |
| 1796 | return NULL; |
| 1797 | } |
| 1798 | goto done; |
| 1799 | } |
| 1800 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1801 | 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] | 1802 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'")); |
| 1803 | } |
| 1804 | { // &'del' del_stmt |
| 1805 | if (p->error_indicator) { |
| 1806 | D(p->level--); |
| 1807 | return NULL; |
| 1808 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1809 | 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] | 1810 | stmt_ty del_stmt_var; |
| 1811 | if ( |
| 1812 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del' |
| 1813 | && |
| 1814 | (del_stmt_var = del_stmt_rule(p)) // del_stmt |
| 1815 | ) |
| 1816 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1817 | 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] | 1818 | _res = del_stmt_var; |
| 1819 | goto done; |
| 1820 | } |
| 1821 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1822 | 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] | 1823 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt")); |
| 1824 | } |
| 1825 | { // &'yield' yield_stmt |
| 1826 | if (p->error_indicator) { |
| 1827 | D(p->level--); |
| 1828 | return NULL; |
| 1829 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1830 | 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] | 1831 | stmt_ty yield_stmt_var; |
| 1832 | if ( |
| 1833 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield' |
| 1834 | && |
| 1835 | (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt |
| 1836 | ) |
| 1837 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1838 | 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] | 1839 | _res = yield_stmt_var; |
| 1840 | goto done; |
| 1841 | } |
| 1842 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1843 | 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] | 1844 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt")); |
| 1845 | } |
| 1846 | { // &'assert' assert_stmt |
| 1847 | if (p->error_indicator) { |
| 1848 | D(p->level--); |
| 1849 | return NULL; |
| 1850 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1851 | 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] | 1852 | stmt_ty assert_stmt_var; |
| 1853 | if ( |
| 1854 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert' |
| 1855 | && |
| 1856 | (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt |
| 1857 | ) |
| 1858 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1859 | 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] | 1860 | _res = assert_stmt_var; |
| 1861 | goto done; |
| 1862 | } |
| 1863 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1864 | 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] | 1865 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt")); |
| 1866 | } |
| 1867 | { // 'break' |
| 1868 | if (p->error_indicator) { |
| 1869 | D(p->level--); |
| 1870 | return NULL; |
| 1871 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1872 | 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] | 1873 | Token * _keyword; |
| 1874 | if ( |
| 1875 | (_keyword = _PyPegen_expect_token(p, 506)) // token='break' |
| 1876 | ) |
| 1877 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1878 | 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] | 1879 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1880 | if (_token == NULL) { |
| 1881 | D(p->level--); |
| 1882 | return NULL; |
| 1883 | } |
| 1884 | int _end_lineno = _token->end_lineno; |
| 1885 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1886 | int _end_col_offset = _token->end_col_offset; |
| 1887 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1888 | _res = _Py_Break ( EXTRA ); |
| 1889 | if (_res == NULL && PyErr_Occurred()) { |
| 1890 | p->error_indicator = 1; |
| 1891 | D(p->level--); |
| 1892 | return NULL; |
| 1893 | } |
| 1894 | goto done; |
| 1895 | } |
| 1896 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1897 | 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] | 1898 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'")); |
| 1899 | } |
| 1900 | { // 'continue' |
| 1901 | if (p->error_indicator) { |
| 1902 | D(p->level--); |
| 1903 | return NULL; |
| 1904 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1905 | 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] | 1906 | Token * _keyword; |
| 1907 | if ( |
| 1908 | (_keyword = _PyPegen_expect_token(p, 507)) // token='continue' |
| 1909 | ) |
| 1910 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1911 | 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] | 1912 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1913 | if (_token == NULL) { |
| 1914 | D(p->level--); |
| 1915 | return NULL; |
| 1916 | } |
| 1917 | int _end_lineno = _token->end_lineno; |
| 1918 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1919 | int _end_col_offset = _token->end_col_offset; |
| 1920 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1921 | _res = _Py_Continue ( EXTRA ); |
| 1922 | if (_res == NULL && PyErr_Occurred()) { |
| 1923 | p->error_indicator = 1; |
| 1924 | D(p->level--); |
| 1925 | return NULL; |
| 1926 | } |
| 1927 | goto done; |
| 1928 | } |
| 1929 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1930 | 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] | 1931 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'")); |
| 1932 | } |
| 1933 | { // &'global' global_stmt |
| 1934 | if (p->error_indicator) { |
| 1935 | D(p->level--); |
| 1936 | return NULL; |
| 1937 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1938 | 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] | 1939 | stmt_ty global_stmt_var; |
| 1940 | if ( |
| 1941 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global' |
| 1942 | && |
| 1943 | (global_stmt_var = global_stmt_rule(p)) // global_stmt |
| 1944 | ) |
| 1945 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1946 | 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] | 1947 | _res = global_stmt_var; |
| 1948 | goto done; |
| 1949 | } |
| 1950 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1951 | 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] | 1952 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt")); |
| 1953 | } |
| 1954 | { // &'nonlocal' nonlocal_stmt |
| 1955 | if (p->error_indicator) { |
| 1956 | D(p->level--); |
| 1957 | return NULL; |
| 1958 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1959 | 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] | 1960 | stmt_ty nonlocal_stmt_var; |
| 1961 | if ( |
| 1962 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal' |
| 1963 | && |
| 1964 | (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt |
| 1965 | ) |
| 1966 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1967 | 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] | 1968 | _res = nonlocal_stmt_var; |
| 1969 | goto done; |
| 1970 | } |
| 1971 | p->mark = _mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1972 | 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] | 1973 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
| 1974 | } |
| 1975 | _res = NULL; |
| 1976 | done: |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 1977 | _PyPegen_insert_memo(p, _mark, simple_stmt_type, _res); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1978 | D(p->level--); |
| 1979 | return _res; |
| 1980 | } |
| 1981 | |
| 1982 | // compound_stmt: |
| 1983 | // | &('def' | '@' | ASYNC) function_def |
| 1984 | // | &'if' if_stmt |
| 1985 | // | &('class' | '@') class_def |
| 1986 | // | &('with' | ASYNC) with_stmt |
| 1987 | // | &('for' | ASYNC) for_stmt |
| 1988 | // | &'try' try_stmt |
| 1989 | // | &'while' while_stmt |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 1990 | // | match_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 1991 | static stmt_ty |
| 1992 | compound_stmt_rule(Parser *p) |
| 1993 | { |
| 1994 | D(p->level++); |
| 1995 | if (p->error_indicator) { |
| 1996 | D(p->level--); |
| 1997 | return NULL; |
| 1998 | } |
| 1999 | stmt_ty _res = NULL; |
| 2000 | int _mark = p->mark; |
| 2001 | { // &('def' | '@' | ASYNC) function_def |
| 2002 | if (p->error_indicator) { |
| 2003 | D(p->level--); |
| 2004 | return NULL; |
| 2005 | } |
| 2006 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
| 2007 | stmt_ty function_def_var; |
| 2008 | if ( |
| 2009 | _PyPegen_lookahead(1, _tmp_15_rule, p) |
| 2010 | && |
| 2011 | (function_def_var = function_def_rule(p)) // function_def |
| 2012 | ) |
| 2013 | { |
| 2014 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
| 2015 | _res = function_def_var; |
| 2016 | goto done; |
| 2017 | } |
| 2018 | p->mark = _mark; |
| 2019 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2020 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
| 2021 | } |
| 2022 | { // &'if' if_stmt |
| 2023 | if (p->error_indicator) { |
| 2024 | D(p->level--); |
| 2025 | return NULL; |
| 2026 | } |
| 2027 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); |
| 2028 | stmt_ty if_stmt_var; |
| 2029 | if ( |
| 2030 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if' |
| 2031 | && |
| 2032 | (if_stmt_var = if_stmt_rule(p)) // if_stmt |
| 2033 | ) |
| 2034 | { |
| 2035 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); |
| 2036 | _res = if_stmt_var; |
| 2037 | goto done; |
| 2038 | } |
| 2039 | p->mark = _mark; |
| 2040 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2041 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt")); |
| 2042 | } |
| 2043 | { // &('class' | '@') class_def |
| 2044 | if (p->error_indicator) { |
| 2045 | D(p->level--); |
| 2046 | return NULL; |
| 2047 | } |
| 2048 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def")); |
| 2049 | stmt_ty class_def_var; |
| 2050 | if ( |
| 2051 | _PyPegen_lookahead(1, _tmp_16_rule, p) |
| 2052 | && |
| 2053 | (class_def_var = class_def_rule(p)) // class_def |
| 2054 | ) |
| 2055 | { |
| 2056 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def")); |
| 2057 | _res = class_def_var; |
| 2058 | goto done; |
| 2059 | } |
| 2060 | p->mark = _mark; |
| 2061 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2062 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def")); |
| 2063 | } |
| 2064 | { // &('with' | ASYNC) with_stmt |
| 2065 | if (p->error_indicator) { |
| 2066 | D(p->level--); |
| 2067 | return NULL; |
| 2068 | } |
| 2069 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
| 2070 | stmt_ty with_stmt_var; |
| 2071 | if ( |
| 2072 | _PyPegen_lookahead(1, _tmp_17_rule, p) |
| 2073 | && |
| 2074 | (with_stmt_var = with_stmt_rule(p)) // with_stmt |
| 2075 | ) |
| 2076 | { |
| 2077 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
| 2078 | _res = with_stmt_var; |
| 2079 | goto done; |
| 2080 | } |
| 2081 | p->mark = _mark; |
| 2082 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2083 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
| 2084 | } |
| 2085 | { // &('for' | ASYNC) for_stmt |
| 2086 | if (p->error_indicator) { |
| 2087 | D(p->level--); |
| 2088 | return NULL; |
| 2089 | } |
| 2090 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
| 2091 | stmt_ty for_stmt_var; |
| 2092 | if ( |
| 2093 | _PyPegen_lookahead(1, _tmp_18_rule, p) |
| 2094 | && |
| 2095 | (for_stmt_var = for_stmt_rule(p)) // for_stmt |
| 2096 | ) |
| 2097 | { |
| 2098 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
| 2099 | _res = for_stmt_var; |
| 2100 | goto done; |
| 2101 | } |
| 2102 | p->mark = _mark; |
| 2103 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2104 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
| 2105 | } |
| 2106 | { // &'try' try_stmt |
| 2107 | if (p->error_indicator) { |
| 2108 | D(p->level--); |
| 2109 | return NULL; |
| 2110 | } |
| 2111 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); |
| 2112 | stmt_ty try_stmt_var; |
| 2113 | if ( |
| 2114 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try' |
| 2115 | && |
| 2116 | (try_stmt_var = try_stmt_rule(p)) // try_stmt |
| 2117 | ) |
| 2118 | { |
| 2119 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); |
| 2120 | _res = try_stmt_var; |
| 2121 | goto done; |
| 2122 | } |
| 2123 | p->mark = _mark; |
| 2124 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2125 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt")); |
| 2126 | } |
| 2127 | { // &'while' while_stmt |
| 2128 | if (p->error_indicator) { |
| 2129 | D(p->level--); |
| 2130 | return NULL; |
| 2131 | } |
| 2132 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); |
| 2133 | stmt_ty while_stmt_var; |
| 2134 | if ( |
| 2135 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while' |
| 2136 | && |
| 2137 | (while_stmt_var = while_stmt_rule(p)) // while_stmt |
| 2138 | ) |
| 2139 | { |
| 2140 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); |
| 2141 | _res = while_stmt_var; |
| 2142 | goto done; |
| 2143 | } |
| 2144 | p->mark = _mark; |
| 2145 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2146 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt")); |
| 2147 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 2148 | { // match_stmt |
| 2149 | if (p->error_indicator) { |
| 2150 | D(p->level--); |
| 2151 | return NULL; |
| 2152 | } |
| 2153 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt")); |
| 2154 | stmt_ty match_stmt_var; |
| 2155 | if ( |
| 2156 | (match_stmt_var = match_stmt_rule(p)) // match_stmt |
| 2157 | ) |
| 2158 | { |
| 2159 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "match_stmt")); |
| 2160 | _res = match_stmt_var; |
| 2161 | goto done; |
| 2162 | } |
| 2163 | p->mark = _mark; |
| 2164 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2165 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "match_stmt")); |
| 2166 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2167 | _res = NULL; |
| 2168 | done: |
| 2169 | D(p->level--); |
| 2170 | return _res; |
| 2171 | } |
| 2172 | |
| 2173 | // assignment: |
| 2174 | // | NAME ':' expression ['=' annotated_rhs] |
| 2175 | // | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
| 2176 | // | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT? |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2177 | // | single_target augassign ~ (yield_expr | star_expressions) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2178 | // | invalid_assignment |
| 2179 | static stmt_ty |
| 2180 | assignment_rule(Parser *p) |
| 2181 | { |
| 2182 | D(p->level++); |
| 2183 | if (p->error_indicator) { |
| 2184 | D(p->level--); |
| 2185 | return NULL; |
| 2186 | } |
| 2187 | stmt_ty _res = NULL; |
| 2188 | int _mark = p->mark; |
| 2189 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2190 | p->error_indicator = 1; |
| 2191 | D(p->level--); |
| 2192 | return NULL; |
| 2193 | } |
| 2194 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2195 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2196 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2197 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2198 | { // NAME ':' expression ['=' annotated_rhs] |
| 2199 | if (p->error_indicator) { |
| 2200 | D(p->level--); |
| 2201 | return NULL; |
| 2202 | } |
| 2203 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
| 2204 | Token * _literal; |
| 2205 | expr_ty a; |
| 2206 | expr_ty b; |
| 2207 | void *c; |
| 2208 | if ( |
| 2209 | (a = _PyPegen_name_token(p)) // NAME |
| 2210 | && |
| 2211 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 2212 | && |
| 2213 | (b = expression_rule(p)) // expression |
| 2214 | && |
| 2215 | (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs] |
| 2216 | ) |
| 2217 | { |
| 2218 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
| 2219 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2220 | if (_token == NULL) { |
| 2221 | D(p->level--); |
| 2222 | return NULL; |
| 2223 | } |
| 2224 | int _end_lineno = _token->end_lineno; |
| 2225 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2226 | int _end_col_offset = _token->end_col_offset; |
| 2227 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2228 | _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] | 2229 | if (_res == NULL && PyErr_Occurred()) { |
| 2230 | p->error_indicator = 1; |
| 2231 | D(p->level--); |
| 2232 | return NULL; |
| 2233 | } |
| 2234 | goto done; |
| 2235 | } |
| 2236 | p->mark = _mark; |
| 2237 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2238 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
| 2239 | } |
| 2240 | { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
| 2241 | if (p->error_indicator) { |
| 2242 | D(p->level--); |
| 2243 | return NULL; |
| 2244 | } |
| 2245 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
| 2246 | Token * _literal; |
| 2247 | void *a; |
| 2248 | expr_ty b; |
| 2249 | void *c; |
| 2250 | if ( |
| 2251 | (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target |
| 2252 | && |
| 2253 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 2254 | && |
| 2255 | (b = expression_rule(p)) // expression |
| 2256 | && |
| 2257 | (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs] |
| 2258 | ) |
| 2259 | { |
| 2260 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
| 2261 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2262 | if (_token == NULL) { |
| 2263 | D(p->level--); |
| 2264 | return NULL; |
| 2265 | } |
| 2266 | int _end_lineno = _token->end_lineno; |
| 2267 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2268 | int _end_col_offset = _token->end_col_offset; |
| 2269 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2270 | _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] | 2271 | if (_res == NULL && PyErr_Occurred()) { |
| 2272 | p->error_indicator = 1; |
| 2273 | D(p->level--); |
| 2274 | return NULL; |
| 2275 | } |
| 2276 | goto done; |
| 2277 | } |
| 2278 | p->mark = _mark; |
| 2279 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2280 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
| 2281 | } |
| 2282 | { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT? |
| 2283 | if (p->error_indicator) { |
| 2284 | D(p->level--); |
| 2285 | return NULL; |
| 2286 | } |
| 2287 | 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] | 2288 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2289 | void *b; |
| 2290 | void *tc; |
| 2291 | if ( |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2292 | (a = (asdl_expr_seq*)_loop1_22_rule(p)) // ((star_targets '='))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2293 | && |
| 2294 | (b = _tmp_23_rule(p)) // yield_expr | star_expressions |
| 2295 | && |
| 2296 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
| 2297 | && |
| 2298 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 2299 | ) |
| 2300 | { |
| 2301 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?")); |
| 2302 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2303 | if (_token == NULL) { |
| 2304 | D(p->level--); |
| 2305 | return NULL; |
| 2306 | } |
| 2307 | int _end_lineno = _token->end_lineno; |
| 2308 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2309 | int _end_col_offset = _token->end_col_offset; |
| 2310 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2311 | _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 2312 | if (_res == NULL && PyErr_Occurred()) { |
| 2313 | p->error_indicator = 1; |
| 2314 | D(p->level--); |
| 2315 | return NULL; |
| 2316 | } |
| 2317 | goto done; |
| 2318 | } |
| 2319 | p->mark = _mark; |
| 2320 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2321 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?")); |
| 2322 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2323 | { // single_target augassign ~ (yield_expr | star_expressions) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2324 | if (p->error_indicator) { |
| 2325 | D(p->level--); |
| 2326 | return NULL; |
| 2327 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2328 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)")); |
| 2329 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2330 | expr_ty a; |
| 2331 | AugOperator* b; |
| 2332 | void *c; |
| 2333 | if ( |
| 2334 | (a = single_target_rule(p)) // single_target |
| 2335 | && |
| 2336 | (b = augassign_rule(p)) // augassign |
| 2337 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2338 | (_cut_var = 1) |
| 2339 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2340 | (c = _tmp_24_rule(p)) // yield_expr | star_expressions |
| 2341 | ) |
| 2342 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2343 | 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] | 2344 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2345 | if (_token == NULL) { |
| 2346 | D(p->level--); |
| 2347 | return NULL; |
| 2348 | } |
| 2349 | int _end_lineno = _token->end_lineno; |
| 2350 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2351 | int _end_col_offset = _token->end_col_offset; |
| 2352 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2353 | _res = _Py_AugAssign ( a , b -> kind , c , EXTRA ); |
| 2354 | if (_res == NULL && PyErr_Occurred()) { |
| 2355 | p->error_indicator = 1; |
| 2356 | D(p->level--); |
| 2357 | return NULL; |
| 2358 | } |
| 2359 | goto done; |
| 2360 | } |
| 2361 | p->mark = _mark; |
| 2362 | 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] | 2363 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)")); |
| 2364 | if (_cut_var) { |
| 2365 | D(p->level--); |
| 2366 | return NULL; |
| 2367 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2368 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 2369 | if (p->call_invalid_rules) { // invalid_assignment |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2370 | if (p->error_indicator) { |
| 2371 | D(p->level--); |
| 2372 | return NULL; |
| 2373 | } |
| 2374 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment")); |
| 2375 | void *invalid_assignment_var; |
| 2376 | if ( |
| 2377 | (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment |
| 2378 | ) |
| 2379 | { |
| 2380 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment")); |
| 2381 | _res = invalid_assignment_var; |
| 2382 | goto done; |
| 2383 | } |
| 2384 | p->mark = _mark; |
| 2385 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2386 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment")); |
| 2387 | } |
| 2388 | _res = NULL; |
| 2389 | done: |
| 2390 | D(p->level--); |
| 2391 | return _res; |
| 2392 | } |
| 2393 | |
| 2394 | // augassign: |
| 2395 | // | '+=' |
| 2396 | // | '-=' |
| 2397 | // | '*=' |
| 2398 | // | '@=' |
| 2399 | // | '/=' |
| 2400 | // | '%=' |
| 2401 | // | '&=' |
| 2402 | // | '|=' |
| 2403 | // | '^=' |
| 2404 | // | '<<=' |
| 2405 | // | '>>=' |
| 2406 | // | '**=' |
| 2407 | // | '//=' |
| 2408 | static AugOperator* |
| 2409 | augassign_rule(Parser *p) |
| 2410 | { |
| 2411 | D(p->level++); |
| 2412 | if (p->error_indicator) { |
| 2413 | D(p->level--); |
| 2414 | return NULL; |
| 2415 | } |
| 2416 | AugOperator* _res = NULL; |
| 2417 | int _mark = p->mark; |
| 2418 | { // '+=' |
| 2419 | if (p->error_indicator) { |
| 2420 | D(p->level--); |
| 2421 | return NULL; |
| 2422 | } |
| 2423 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='")); |
| 2424 | Token * _literal; |
| 2425 | if ( |
| 2426 | (_literal = _PyPegen_expect_token(p, 36)) // token='+=' |
| 2427 | ) |
| 2428 | { |
| 2429 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='")); |
| 2430 | _res = _PyPegen_augoperator ( p , Add ); |
| 2431 | if (_res == NULL && PyErr_Occurred()) { |
| 2432 | p->error_indicator = 1; |
| 2433 | D(p->level--); |
| 2434 | return NULL; |
| 2435 | } |
| 2436 | goto done; |
| 2437 | } |
| 2438 | p->mark = _mark; |
| 2439 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2440 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='")); |
| 2441 | } |
| 2442 | { // '-=' |
| 2443 | if (p->error_indicator) { |
| 2444 | D(p->level--); |
| 2445 | return NULL; |
| 2446 | } |
| 2447 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='")); |
| 2448 | Token * _literal; |
| 2449 | if ( |
| 2450 | (_literal = _PyPegen_expect_token(p, 37)) // token='-=' |
| 2451 | ) |
| 2452 | { |
| 2453 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='")); |
| 2454 | _res = _PyPegen_augoperator ( p , Sub ); |
| 2455 | if (_res == NULL && PyErr_Occurred()) { |
| 2456 | p->error_indicator = 1; |
| 2457 | D(p->level--); |
| 2458 | return NULL; |
| 2459 | } |
| 2460 | goto done; |
| 2461 | } |
| 2462 | p->mark = _mark; |
| 2463 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2464 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='")); |
| 2465 | } |
| 2466 | { // '*=' |
| 2467 | if (p->error_indicator) { |
| 2468 | D(p->level--); |
| 2469 | return NULL; |
| 2470 | } |
| 2471 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='")); |
| 2472 | Token * _literal; |
| 2473 | if ( |
| 2474 | (_literal = _PyPegen_expect_token(p, 38)) // token='*=' |
| 2475 | ) |
| 2476 | { |
| 2477 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='")); |
| 2478 | _res = _PyPegen_augoperator ( p , Mult ); |
| 2479 | if (_res == NULL && PyErr_Occurred()) { |
| 2480 | p->error_indicator = 1; |
| 2481 | D(p->level--); |
| 2482 | return NULL; |
| 2483 | } |
| 2484 | goto done; |
| 2485 | } |
| 2486 | p->mark = _mark; |
| 2487 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2488 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='")); |
| 2489 | } |
| 2490 | { // '@=' |
| 2491 | if (p->error_indicator) { |
| 2492 | D(p->level--); |
| 2493 | return NULL; |
| 2494 | } |
| 2495 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='")); |
| 2496 | Token * _literal; |
| 2497 | if ( |
| 2498 | (_literal = _PyPegen_expect_token(p, 50)) // token='@=' |
| 2499 | ) |
| 2500 | { |
| 2501 | 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] | 2502 | _res = CHECK_VERSION ( AugOperator * , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2503 | if (_res == NULL && PyErr_Occurred()) { |
| 2504 | p->error_indicator = 1; |
| 2505 | D(p->level--); |
| 2506 | return NULL; |
| 2507 | } |
| 2508 | goto done; |
| 2509 | } |
| 2510 | p->mark = _mark; |
| 2511 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2512 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='")); |
| 2513 | } |
| 2514 | { // '/=' |
| 2515 | if (p->error_indicator) { |
| 2516 | D(p->level--); |
| 2517 | return NULL; |
| 2518 | } |
| 2519 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='")); |
| 2520 | Token * _literal; |
| 2521 | if ( |
| 2522 | (_literal = _PyPegen_expect_token(p, 39)) // token='/=' |
| 2523 | ) |
| 2524 | { |
| 2525 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='")); |
| 2526 | _res = _PyPegen_augoperator ( p , Div ); |
| 2527 | if (_res == NULL && PyErr_Occurred()) { |
| 2528 | p->error_indicator = 1; |
| 2529 | D(p->level--); |
| 2530 | return NULL; |
| 2531 | } |
| 2532 | goto done; |
| 2533 | } |
| 2534 | p->mark = _mark; |
| 2535 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2536 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='")); |
| 2537 | } |
| 2538 | { // '%=' |
| 2539 | if (p->error_indicator) { |
| 2540 | D(p->level--); |
| 2541 | return NULL; |
| 2542 | } |
| 2543 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='")); |
| 2544 | Token * _literal; |
| 2545 | if ( |
| 2546 | (_literal = _PyPegen_expect_token(p, 40)) // token='%=' |
| 2547 | ) |
| 2548 | { |
| 2549 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='")); |
| 2550 | _res = _PyPegen_augoperator ( p , Mod ); |
| 2551 | if (_res == NULL && PyErr_Occurred()) { |
| 2552 | p->error_indicator = 1; |
| 2553 | D(p->level--); |
| 2554 | return NULL; |
| 2555 | } |
| 2556 | goto done; |
| 2557 | } |
| 2558 | p->mark = _mark; |
| 2559 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2560 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='")); |
| 2561 | } |
| 2562 | { // '&=' |
| 2563 | if (p->error_indicator) { |
| 2564 | D(p->level--); |
| 2565 | return NULL; |
| 2566 | } |
| 2567 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='")); |
| 2568 | Token * _literal; |
| 2569 | if ( |
| 2570 | (_literal = _PyPegen_expect_token(p, 41)) // token='&=' |
| 2571 | ) |
| 2572 | { |
| 2573 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='")); |
| 2574 | _res = _PyPegen_augoperator ( p , BitAnd ); |
| 2575 | if (_res == NULL && PyErr_Occurred()) { |
| 2576 | p->error_indicator = 1; |
| 2577 | D(p->level--); |
| 2578 | return NULL; |
| 2579 | } |
| 2580 | goto done; |
| 2581 | } |
| 2582 | p->mark = _mark; |
| 2583 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2584 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='")); |
| 2585 | } |
| 2586 | { // '|=' |
| 2587 | if (p->error_indicator) { |
| 2588 | D(p->level--); |
| 2589 | return NULL; |
| 2590 | } |
| 2591 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='")); |
| 2592 | Token * _literal; |
| 2593 | if ( |
| 2594 | (_literal = _PyPegen_expect_token(p, 42)) // token='|=' |
| 2595 | ) |
| 2596 | { |
| 2597 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='")); |
| 2598 | _res = _PyPegen_augoperator ( p , BitOr ); |
| 2599 | if (_res == NULL && PyErr_Occurred()) { |
| 2600 | p->error_indicator = 1; |
| 2601 | D(p->level--); |
| 2602 | return NULL; |
| 2603 | } |
| 2604 | goto done; |
| 2605 | } |
| 2606 | p->mark = _mark; |
| 2607 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2608 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='")); |
| 2609 | } |
| 2610 | { // '^=' |
| 2611 | if (p->error_indicator) { |
| 2612 | D(p->level--); |
| 2613 | return NULL; |
| 2614 | } |
| 2615 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='")); |
| 2616 | Token * _literal; |
| 2617 | if ( |
| 2618 | (_literal = _PyPegen_expect_token(p, 43)) // token='^=' |
| 2619 | ) |
| 2620 | { |
| 2621 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='")); |
| 2622 | _res = _PyPegen_augoperator ( p , BitXor ); |
| 2623 | if (_res == NULL && PyErr_Occurred()) { |
| 2624 | p->error_indicator = 1; |
| 2625 | D(p->level--); |
| 2626 | return NULL; |
| 2627 | } |
| 2628 | goto done; |
| 2629 | } |
| 2630 | p->mark = _mark; |
| 2631 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2632 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='")); |
| 2633 | } |
| 2634 | { // '<<=' |
| 2635 | if (p->error_indicator) { |
| 2636 | D(p->level--); |
| 2637 | return NULL; |
| 2638 | } |
| 2639 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='")); |
| 2640 | Token * _literal; |
| 2641 | if ( |
| 2642 | (_literal = _PyPegen_expect_token(p, 44)) // token='<<=' |
| 2643 | ) |
| 2644 | { |
| 2645 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='")); |
| 2646 | _res = _PyPegen_augoperator ( p , LShift ); |
| 2647 | if (_res == NULL && PyErr_Occurred()) { |
| 2648 | p->error_indicator = 1; |
| 2649 | D(p->level--); |
| 2650 | return NULL; |
| 2651 | } |
| 2652 | goto done; |
| 2653 | } |
| 2654 | p->mark = _mark; |
| 2655 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2656 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='")); |
| 2657 | } |
| 2658 | { // '>>=' |
| 2659 | if (p->error_indicator) { |
| 2660 | D(p->level--); |
| 2661 | return NULL; |
| 2662 | } |
| 2663 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='")); |
| 2664 | Token * _literal; |
| 2665 | if ( |
| 2666 | (_literal = _PyPegen_expect_token(p, 45)) // token='>>=' |
| 2667 | ) |
| 2668 | { |
| 2669 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='")); |
| 2670 | _res = _PyPegen_augoperator ( p , RShift ); |
| 2671 | if (_res == NULL && PyErr_Occurred()) { |
| 2672 | p->error_indicator = 1; |
| 2673 | D(p->level--); |
| 2674 | return NULL; |
| 2675 | } |
| 2676 | goto done; |
| 2677 | } |
| 2678 | p->mark = _mark; |
| 2679 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2680 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='")); |
| 2681 | } |
| 2682 | { // '**=' |
| 2683 | if (p->error_indicator) { |
| 2684 | D(p->level--); |
| 2685 | return NULL; |
| 2686 | } |
| 2687 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='")); |
| 2688 | Token * _literal; |
| 2689 | if ( |
| 2690 | (_literal = _PyPegen_expect_token(p, 46)) // token='**=' |
| 2691 | ) |
| 2692 | { |
| 2693 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='")); |
| 2694 | _res = _PyPegen_augoperator ( p , Pow ); |
| 2695 | if (_res == NULL && PyErr_Occurred()) { |
| 2696 | p->error_indicator = 1; |
| 2697 | D(p->level--); |
| 2698 | return NULL; |
| 2699 | } |
| 2700 | goto done; |
| 2701 | } |
| 2702 | p->mark = _mark; |
| 2703 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2704 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='")); |
| 2705 | } |
| 2706 | { // '//=' |
| 2707 | if (p->error_indicator) { |
| 2708 | D(p->level--); |
| 2709 | return NULL; |
| 2710 | } |
| 2711 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='")); |
| 2712 | Token * _literal; |
| 2713 | if ( |
| 2714 | (_literal = _PyPegen_expect_token(p, 48)) // token='//=' |
| 2715 | ) |
| 2716 | { |
| 2717 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='")); |
| 2718 | _res = _PyPegen_augoperator ( p , FloorDiv ); |
| 2719 | if (_res == NULL && PyErr_Occurred()) { |
| 2720 | p->error_indicator = 1; |
| 2721 | D(p->level--); |
| 2722 | return NULL; |
| 2723 | } |
| 2724 | goto done; |
| 2725 | } |
| 2726 | p->mark = _mark; |
| 2727 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2728 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='")); |
| 2729 | } |
| 2730 | _res = NULL; |
| 2731 | done: |
| 2732 | D(p->level--); |
| 2733 | return _res; |
| 2734 | } |
| 2735 | |
| 2736 | // global_stmt: 'global' ','.NAME+ |
| 2737 | static stmt_ty |
| 2738 | global_stmt_rule(Parser *p) |
| 2739 | { |
| 2740 | D(p->level++); |
| 2741 | if (p->error_indicator) { |
| 2742 | D(p->level--); |
| 2743 | return NULL; |
| 2744 | } |
| 2745 | stmt_ty _res = NULL; |
| 2746 | int _mark = p->mark; |
| 2747 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2748 | p->error_indicator = 1; |
| 2749 | D(p->level--); |
| 2750 | return NULL; |
| 2751 | } |
| 2752 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2753 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2754 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2755 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2756 | { // 'global' ','.NAME+ |
| 2757 | if (p->error_indicator) { |
| 2758 | D(p->level--); |
| 2759 | return NULL; |
| 2760 | } |
| 2761 | D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+")); |
| 2762 | Token * _keyword; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2763 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2764 | if ( |
| 2765 | (_keyword = _PyPegen_expect_token(p, 508)) // token='global' |
| 2766 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2767 | (a = (asdl_expr_seq*)_gather_25_rule(p)) // ','.NAME+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2768 | ) |
| 2769 | { |
| 2770 | D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+")); |
| 2771 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2772 | if (_token == NULL) { |
| 2773 | D(p->level--); |
| 2774 | return NULL; |
| 2775 | } |
| 2776 | int _end_lineno = _token->end_lineno; |
| 2777 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2778 | int _end_col_offset = _token->end_col_offset; |
| 2779 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2780 | _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] | 2781 | if (_res == NULL && PyErr_Occurred()) { |
| 2782 | p->error_indicator = 1; |
| 2783 | D(p->level--); |
| 2784 | return NULL; |
| 2785 | } |
| 2786 | goto done; |
| 2787 | } |
| 2788 | p->mark = _mark; |
| 2789 | D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2790 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+")); |
| 2791 | } |
| 2792 | _res = NULL; |
| 2793 | done: |
| 2794 | D(p->level--); |
| 2795 | return _res; |
| 2796 | } |
| 2797 | |
| 2798 | // nonlocal_stmt: 'nonlocal' ','.NAME+ |
| 2799 | static stmt_ty |
| 2800 | nonlocal_stmt_rule(Parser *p) |
| 2801 | { |
| 2802 | D(p->level++); |
| 2803 | if (p->error_indicator) { |
| 2804 | D(p->level--); |
| 2805 | return NULL; |
| 2806 | } |
| 2807 | stmt_ty _res = NULL; |
| 2808 | int _mark = p->mark; |
| 2809 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2810 | p->error_indicator = 1; |
| 2811 | D(p->level--); |
| 2812 | return NULL; |
| 2813 | } |
| 2814 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2815 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2816 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2817 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2818 | { // 'nonlocal' ','.NAME+ |
| 2819 | if (p->error_indicator) { |
| 2820 | D(p->level--); |
| 2821 | return NULL; |
| 2822 | } |
| 2823 | D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+")); |
| 2824 | Token * _keyword; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2825 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2826 | if ( |
| 2827 | (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal' |
| 2828 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 2829 | (a = (asdl_expr_seq*)_gather_27_rule(p)) // ','.NAME+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2830 | ) |
| 2831 | { |
| 2832 | D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+")); |
| 2833 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2834 | if (_token == NULL) { |
| 2835 | D(p->level--); |
| 2836 | return NULL; |
| 2837 | } |
| 2838 | int _end_lineno = _token->end_lineno; |
| 2839 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2840 | int _end_col_offset = _token->end_col_offset; |
| 2841 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 2842 | _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] | 2843 | if (_res == NULL && PyErr_Occurred()) { |
| 2844 | p->error_indicator = 1; |
| 2845 | D(p->level--); |
| 2846 | return NULL; |
| 2847 | } |
| 2848 | goto done; |
| 2849 | } |
| 2850 | p->mark = _mark; |
| 2851 | D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2852 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+")); |
| 2853 | } |
| 2854 | _res = NULL; |
| 2855 | done: |
| 2856 | D(p->level--); |
| 2857 | return _res; |
| 2858 | } |
| 2859 | |
| 2860 | // yield_stmt: yield_expr |
| 2861 | static stmt_ty |
| 2862 | yield_stmt_rule(Parser *p) |
| 2863 | { |
| 2864 | D(p->level++); |
| 2865 | if (p->error_indicator) { |
| 2866 | D(p->level--); |
| 2867 | return NULL; |
| 2868 | } |
| 2869 | stmt_ty _res = NULL; |
| 2870 | int _mark = p->mark; |
| 2871 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2872 | p->error_indicator = 1; |
| 2873 | D(p->level--); |
| 2874 | return NULL; |
| 2875 | } |
| 2876 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2877 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2878 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2879 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2880 | { // yield_expr |
| 2881 | if (p->error_indicator) { |
| 2882 | D(p->level--); |
| 2883 | return NULL; |
| 2884 | } |
| 2885 | D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 2886 | expr_ty y; |
| 2887 | if ( |
| 2888 | (y = yield_expr_rule(p)) // yield_expr |
| 2889 | ) |
| 2890 | { |
| 2891 | D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 2892 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2893 | if (_token == NULL) { |
| 2894 | D(p->level--); |
| 2895 | return NULL; |
| 2896 | } |
| 2897 | int _end_lineno = _token->end_lineno; |
| 2898 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2899 | int _end_col_offset = _token->end_col_offset; |
| 2900 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2901 | _res = _Py_Expr ( y , EXTRA ); |
| 2902 | if (_res == NULL && PyErr_Occurred()) { |
| 2903 | p->error_indicator = 1; |
| 2904 | D(p->level--); |
| 2905 | return NULL; |
| 2906 | } |
| 2907 | goto done; |
| 2908 | } |
| 2909 | p->mark = _mark; |
| 2910 | D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2911 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 2912 | } |
| 2913 | _res = NULL; |
| 2914 | done: |
| 2915 | D(p->level--); |
| 2916 | return _res; |
| 2917 | } |
| 2918 | |
| 2919 | // assert_stmt: 'assert' expression [',' expression] |
| 2920 | static stmt_ty |
| 2921 | assert_stmt_rule(Parser *p) |
| 2922 | { |
| 2923 | D(p->level++); |
| 2924 | if (p->error_indicator) { |
| 2925 | D(p->level--); |
| 2926 | return NULL; |
| 2927 | } |
| 2928 | stmt_ty _res = NULL; |
| 2929 | int _mark = p->mark; |
| 2930 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2931 | p->error_indicator = 1; |
| 2932 | D(p->level--); |
| 2933 | return NULL; |
| 2934 | } |
| 2935 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2936 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2937 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2938 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 2939 | { // 'assert' expression [',' expression] |
| 2940 | if (p->error_indicator) { |
| 2941 | D(p->level--); |
| 2942 | return NULL; |
| 2943 | } |
| 2944 | D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]")); |
| 2945 | Token * _keyword; |
| 2946 | expr_ty a; |
| 2947 | void *b; |
| 2948 | if ( |
| 2949 | (_keyword = _PyPegen_expect_token(p, 505)) // token='assert' |
| 2950 | && |
| 2951 | (a = expression_rule(p)) // expression |
| 2952 | && |
| 2953 | (b = _tmp_29_rule(p), 1) // [',' expression] |
| 2954 | ) |
| 2955 | { |
| 2956 | D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]")); |
| 2957 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2958 | if (_token == NULL) { |
| 2959 | D(p->level--); |
| 2960 | return NULL; |
| 2961 | } |
| 2962 | int _end_lineno = _token->end_lineno; |
| 2963 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2964 | int _end_col_offset = _token->end_col_offset; |
| 2965 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2966 | _res = _Py_Assert ( a , b , EXTRA ); |
| 2967 | if (_res == NULL && PyErr_Occurred()) { |
| 2968 | p->error_indicator = 1; |
| 2969 | D(p->level--); |
| 2970 | return NULL; |
| 2971 | } |
| 2972 | goto done; |
| 2973 | } |
| 2974 | p->mark = _mark; |
| 2975 | D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2976 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]")); |
| 2977 | } |
| 2978 | _res = NULL; |
| 2979 | done: |
| 2980 | D(p->level--); |
| 2981 | return _res; |
| 2982 | } |
| 2983 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 2984 | // del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 2985 | static stmt_ty |
| 2986 | del_stmt_rule(Parser *p) |
| 2987 | { |
| 2988 | D(p->level++); |
| 2989 | if (p->error_indicator) { |
| 2990 | D(p->level--); |
| 2991 | return NULL; |
| 2992 | } |
| 2993 | stmt_ty _res = NULL; |
| 2994 | int _mark = p->mark; |
| 2995 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2996 | p->error_indicator = 1; |
| 2997 | D(p->level--); |
| 2998 | return NULL; |
| 2999 | } |
| 3000 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3001 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3002 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3003 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3004 | { // 'del' del_targets &(';' | NEWLINE) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3005 | if (p->error_indicator) { |
| 3006 | D(p->level--); |
| 3007 | return NULL; |
| 3008 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3009 | 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] | 3010 | Token * _keyword; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3011 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3012 | if ( |
| 3013 | (_keyword = _PyPegen_expect_token(p, 503)) // token='del' |
| 3014 | && |
| 3015 | (a = del_targets_rule(p)) // del_targets |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3016 | && |
| 3017 | _PyPegen_lookahead(1, _tmp_30_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3018 | ) |
| 3019 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3020 | 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] | 3021 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3022 | if (_token == NULL) { |
| 3023 | D(p->level--); |
| 3024 | return NULL; |
| 3025 | } |
| 3026 | int _end_lineno = _token->end_lineno; |
| 3027 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3028 | int _end_col_offset = _token->end_col_offset; |
| 3029 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3030 | _res = _Py_Delete ( a , EXTRA ); |
| 3031 | if (_res == NULL && PyErr_Occurred()) { |
| 3032 | p->error_indicator = 1; |
| 3033 | D(p->level--); |
| 3034 | return NULL; |
| 3035 | } |
| 3036 | goto done; |
| 3037 | } |
| 3038 | p->mark = _mark; |
| 3039 | 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] | 3040 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)")); |
| 3041 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 3042 | if (p->call_invalid_rules) { // invalid_del_stmt |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3043 | if (p->error_indicator) { |
| 3044 | D(p->level--); |
| 3045 | return NULL; |
| 3046 | } |
| 3047 | D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt")); |
| 3048 | void *invalid_del_stmt_var; |
| 3049 | if ( |
| 3050 | (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt |
| 3051 | ) |
| 3052 | { |
| 3053 | D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt")); |
| 3054 | _res = invalid_del_stmt_var; |
| 3055 | goto done; |
| 3056 | } |
| 3057 | p->mark = _mark; |
| 3058 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3059 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3060 | } |
| 3061 | _res = NULL; |
| 3062 | done: |
| 3063 | D(p->level--); |
| 3064 | return _res; |
| 3065 | } |
| 3066 | |
| 3067 | // import_stmt: import_name | import_from |
| 3068 | static stmt_ty |
| 3069 | import_stmt_rule(Parser *p) |
| 3070 | { |
| 3071 | D(p->level++); |
| 3072 | if (p->error_indicator) { |
| 3073 | D(p->level--); |
| 3074 | return NULL; |
| 3075 | } |
| 3076 | stmt_ty _res = NULL; |
| 3077 | int _mark = p->mark; |
| 3078 | { // import_name |
| 3079 | if (p->error_indicator) { |
| 3080 | D(p->level--); |
| 3081 | return NULL; |
| 3082 | } |
| 3083 | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name")); |
| 3084 | stmt_ty import_name_var; |
| 3085 | if ( |
| 3086 | (import_name_var = import_name_rule(p)) // import_name |
| 3087 | ) |
| 3088 | { |
| 3089 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name")); |
| 3090 | _res = import_name_var; |
| 3091 | goto done; |
| 3092 | } |
| 3093 | p->mark = _mark; |
| 3094 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3095 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name")); |
| 3096 | } |
| 3097 | { // import_from |
| 3098 | if (p->error_indicator) { |
| 3099 | D(p->level--); |
| 3100 | return NULL; |
| 3101 | } |
| 3102 | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from")); |
| 3103 | stmt_ty import_from_var; |
| 3104 | if ( |
| 3105 | (import_from_var = import_from_rule(p)) // import_from |
| 3106 | ) |
| 3107 | { |
| 3108 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from")); |
| 3109 | _res = import_from_var; |
| 3110 | goto done; |
| 3111 | } |
| 3112 | p->mark = _mark; |
| 3113 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3114 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from")); |
| 3115 | } |
| 3116 | _res = NULL; |
| 3117 | done: |
| 3118 | D(p->level--); |
| 3119 | return _res; |
| 3120 | } |
| 3121 | |
| 3122 | // import_name: 'import' dotted_as_names |
| 3123 | static stmt_ty |
| 3124 | import_name_rule(Parser *p) |
| 3125 | { |
| 3126 | D(p->level++); |
| 3127 | if (p->error_indicator) { |
| 3128 | D(p->level--); |
| 3129 | return NULL; |
| 3130 | } |
| 3131 | stmt_ty _res = NULL; |
| 3132 | int _mark = p->mark; |
| 3133 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3134 | p->error_indicator = 1; |
| 3135 | D(p->level--); |
| 3136 | return NULL; |
| 3137 | } |
| 3138 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3139 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3140 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3141 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 3142 | { // 'import' dotted_as_names |
| 3143 | if (p->error_indicator) { |
| 3144 | D(p->level--); |
| 3145 | return NULL; |
| 3146 | } |
| 3147 | D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names")); |
| 3148 | Token * _keyword; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3149 | asdl_alias_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3150 | if ( |
| 3151 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
| 3152 | && |
| 3153 | (a = dotted_as_names_rule(p)) // dotted_as_names |
| 3154 | ) |
| 3155 | { |
| 3156 | D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names")); |
| 3157 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3158 | if (_token == NULL) { |
| 3159 | D(p->level--); |
| 3160 | return NULL; |
| 3161 | } |
| 3162 | int _end_lineno = _token->end_lineno; |
| 3163 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3164 | int _end_col_offset = _token->end_col_offset; |
| 3165 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3166 | _res = _Py_Import ( a , EXTRA ); |
| 3167 | if (_res == NULL && PyErr_Occurred()) { |
| 3168 | p->error_indicator = 1; |
| 3169 | D(p->level--); |
| 3170 | return NULL; |
| 3171 | } |
| 3172 | goto done; |
| 3173 | } |
| 3174 | p->mark = _mark; |
| 3175 | D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3176 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names")); |
| 3177 | } |
| 3178 | _res = NULL; |
| 3179 | done: |
| 3180 | D(p->level--); |
| 3181 | return _res; |
| 3182 | } |
| 3183 | |
| 3184 | // import_from: |
| 3185 | // | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
| 3186 | // | 'from' (('.' | '...'))+ 'import' import_from_targets |
| 3187 | static stmt_ty |
| 3188 | import_from_rule(Parser *p) |
| 3189 | { |
| 3190 | D(p->level++); |
| 3191 | if (p->error_indicator) { |
| 3192 | D(p->level--); |
| 3193 | return NULL; |
| 3194 | } |
| 3195 | stmt_ty _res = NULL; |
| 3196 | int _mark = p->mark; |
| 3197 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3198 | p->error_indicator = 1; |
| 3199 | D(p->level--); |
| 3200 | return NULL; |
| 3201 | } |
| 3202 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3203 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3204 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3205 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 3206 | { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
| 3207 | if (p->error_indicator) { |
| 3208 | D(p->level--); |
| 3209 | return NULL; |
| 3210 | } |
| 3211 | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
| 3212 | Token * _keyword; |
| 3213 | Token * _keyword_1; |
| 3214 | asdl_seq * a; |
| 3215 | expr_ty b; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3216 | asdl_alias_seq* c; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3217 | if ( |
| 3218 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
| 3219 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3220 | (a = _loop0_31_rule(p)) // (('.' | '...'))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3221 | && |
| 3222 | (b = dotted_name_rule(p)) // dotted_name |
| 3223 | && |
| 3224 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
| 3225 | && |
| 3226 | (c = import_from_targets_rule(p)) // import_from_targets |
| 3227 | ) |
| 3228 | { |
| 3229 | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
| 3230 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3231 | if (_token == NULL) { |
| 3232 | D(p->level--); |
| 3233 | return NULL; |
| 3234 | } |
| 3235 | int _end_lineno = _token->end_lineno; |
| 3236 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3237 | int _end_col_offset = _token->end_col_offset; |
| 3238 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3239 | _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
| 3240 | if (_res == NULL && PyErr_Occurred()) { |
| 3241 | p->error_indicator = 1; |
| 3242 | D(p->level--); |
| 3243 | return NULL; |
| 3244 | } |
| 3245 | goto done; |
| 3246 | } |
| 3247 | p->mark = _mark; |
| 3248 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
| 3249 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
| 3250 | } |
| 3251 | { // 'from' (('.' | '...'))+ 'import' import_from_targets |
| 3252 | if (p->error_indicator) { |
| 3253 | D(p->level--); |
| 3254 | return NULL; |
| 3255 | } |
| 3256 | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
| 3257 | Token * _keyword; |
| 3258 | Token * _keyword_1; |
| 3259 | asdl_seq * a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3260 | asdl_alias_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3261 | if ( |
| 3262 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
| 3263 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3264 | (a = _loop1_32_rule(p)) // (('.' | '...'))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3265 | && |
| 3266 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
| 3267 | && |
| 3268 | (b = import_from_targets_rule(p)) // import_from_targets |
| 3269 | ) |
| 3270 | { |
| 3271 | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
| 3272 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3273 | if (_token == NULL) { |
| 3274 | D(p->level--); |
| 3275 | return NULL; |
| 3276 | } |
| 3277 | int _end_lineno = _token->end_lineno; |
| 3278 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3279 | int _end_col_offset = _token->end_col_offset; |
| 3280 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3281 | _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
| 3282 | if (_res == NULL && PyErr_Occurred()) { |
| 3283 | p->error_indicator = 1; |
| 3284 | D(p->level--); |
| 3285 | return NULL; |
| 3286 | } |
| 3287 | goto done; |
| 3288 | } |
| 3289 | p->mark = _mark; |
| 3290 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
| 3291 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
| 3292 | } |
| 3293 | _res = NULL; |
| 3294 | done: |
| 3295 | D(p->level--); |
| 3296 | return _res; |
| 3297 | } |
| 3298 | |
| 3299 | // import_from_targets: |
| 3300 | // | '(' import_from_as_names ','? ')' |
| 3301 | // | import_from_as_names !',' |
| 3302 | // | '*' |
| 3303 | // | invalid_import_from_targets |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3304 | static asdl_alias_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3305 | import_from_targets_rule(Parser *p) |
| 3306 | { |
| 3307 | D(p->level++); |
| 3308 | if (p->error_indicator) { |
| 3309 | D(p->level--); |
| 3310 | return NULL; |
| 3311 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3312 | asdl_alias_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3313 | int _mark = p->mark; |
| 3314 | { // '(' import_from_as_names ','? ')' |
| 3315 | if (p->error_indicator) { |
| 3316 | D(p->level--); |
| 3317 | return NULL; |
| 3318 | } |
| 3319 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
| 3320 | Token * _literal; |
| 3321 | Token * _literal_1; |
| 3322 | void *_opt_var; |
| 3323 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3324 | asdl_alias_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3325 | if ( |
| 3326 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 3327 | && |
| 3328 | (a = import_from_as_names_rule(p)) // import_from_as_names |
| 3329 | && |
| 3330 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 3331 | && |
| 3332 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 3333 | ) |
| 3334 | { |
| 3335 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
| 3336 | _res = a; |
| 3337 | if (_res == NULL && PyErr_Occurred()) { |
| 3338 | p->error_indicator = 1; |
| 3339 | D(p->level--); |
| 3340 | return NULL; |
| 3341 | } |
| 3342 | goto done; |
| 3343 | } |
| 3344 | p->mark = _mark; |
| 3345 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3346 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
| 3347 | } |
| 3348 | { // import_from_as_names !',' |
| 3349 | if (p->error_indicator) { |
| 3350 | D(p->level--); |
| 3351 | return NULL; |
| 3352 | } |
| 3353 | 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] | 3354 | asdl_alias_seq* import_from_as_names_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3355 | if ( |
| 3356 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
| 3357 | && |
| 3358 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
| 3359 | ) |
| 3360 | { |
| 3361 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','")); |
| 3362 | _res = import_from_as_names_var; |
| 3363 | goto done; |
| 3364 | } |
| 3365 | p->mark = _mark; |
| 3366 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3367 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','")); |
| 3368 | } |
| 3369 | { // '*' |
| 3370 | if (p->error_indicator) { |
| 3371 | D(p->level--); |
| 3372 | return NULL; |
| 3373 | } |
| 3374 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); |
| 3375 | Token * _literal; |
| 3376 | if ( |
| 3377 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 3378 | ) |
| 3379 | { |
| 3380 | 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] | 3381 | _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] | 3382 | if (_res == NULL && PyErr_Occurred()) { |
| 3383 | p->error_indicator = 1; |
| 3384 | D(p->level--); |
| 3385 | return NULL; |
| 3386 | } |
| 3387 | goto done; |
| 3388 | } |
| 3389 | p->mark = _mark; |
| 3390 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3391 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); |
| 3392 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 3393 | if (p->call_invalid_rules) { // invalid_import_from_targets |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3394 | if (p->error_indicator) { |
| 3395 | D(p->level--); |
| 3396 | return NULL; |
| 3397 | } |
| 3398 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets")); |
| 3399 | void *invalid_import_from_targets_var; |
| 3400 | if ( |
| 3401 | (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets |
| 3402 | ) |
| 3403 | { |
| 3404 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets")); |
| 3405 | _res = invalid_import_from_targets_var; |
| 3406 | goto done; |
| 3407 | } |
| 3408 | p->mark = _mark; |
| 3409 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3410 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets")); |
| 3411 | } |
| 3412 | _res = NULL; |
| 3413 | done: |
| 3414 | D(p->level--); |
| 3415 | return _res; |
| 3416 | } |
| 3417 | |
| 3418 | // import_from_as_names: ','.import_from_as_name+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3419 | static asdl_alias_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3420 | import_from_as_names_rule(Parser *p) |
| 3421 | { |
| 3422 | D(p->level++); |
| 3423 | if (p->error_indicator) { |
| 3424 | D(p->level--); |
| 3425 | return NULL; |
| 3426 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3427 | asdl_alias_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3428 | int _mark = p->mark; |
| 3429 | { // ','.import_from_as_name+ |
| 3430 | if (p->error_indicator) { |
| 3431 | D(p->level--); |
| 3432 | return NULL; |
| 3433 | } |
| 3434 | 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] | 3435 | asdl_alias_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3436 | if ( |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3437 | (a = (asdl_alias_seq*)_gather_33_rule(p)) // ','.import_from_as_name+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3438 | ) |
| 3439 | { |
| 3440 | D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+")); |
| 3441 | _res = a; |
| 3442 | if (_res == NULL && PyErr_Occurred()) { |
| 3443 | p->error_indicator = 1; |
| 3444 | D(p->level--); |
| 3445 | return NULL; |
| 3446 | } |
| 3447 | goto done; |
| 3448 | } |
| 3449 | p->mark = _mark; |
| 3450 | D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
| 3451 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+")); |
| 3452 | } |
| 3453 | _res = NULL; |
| 3454 | done: |
| 3455 | D(p->level--); |
| 3456 | return _res; |
| 3457 | } |
| 3458 | |
| 3459 | // import_from_as_name: NAME ['as' NAME] |
| 3460 | static alias_ty |
| 3461 | import_from_as_name_rule(Parser *p) |
| 3462 | { |
| 3463 | D(p->level++); |
| 3464 | if (p->error_indicator) { |
| 3465 | D(p->level--); |
| 3466 | return NULL; |
| 3467 | } |
| 3468 | alias_ty _res = NULL; |
| 3469 | int _mark = p->mark; |
| 3470 | { // NAME ['as' NAME] |
| 3471 | if (p->error_indicator) { |
| 3472 | D(p->level--); |
| 3473 | return NULL; |
| 3474 | } |
| 3475 | D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]")); |
| 3476 | expr_ty a; |
| 3477 | void *b; |
| 3478 | if ( |
| 3479 | (a = _PyPegen_name_token(p)) // NAME |
| 3480 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3481 | (b = _tmp_35_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3482 | ) |
| 3483 | { |
| 3484 | D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]")); |
| 3485 | _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena ); |
| 3486 | if (_res == NULL && PyErr_Occurred()) { |
| 3487 | p->error_indicator = 1; |
| 3488 | D(p->level--); |
| 3489 | return NULL; |
| 3490 | } |
| 3491 | goto done; |
| 3492 | } |
| 3493 | p->mark = _mark; |
| 3494 | D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3495 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]")); |
| 3496 | } |
| 3497 | _res = NULL; |
| 3498 | done: |
| 3499 | D(p->level--); |
| 3500 | return _res; |
| 3501 | } |
| 3502 | |
| 3503 | // dotted_as_names: ','.dotted_as_name+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3504 | static asdl_alias_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3505 | dotted_as_names_rule(Parser *p) |
| 3506 | { |
| 3507 | D(p->level++); |
| 3508 | if (p->error_indicator) { |
| 3509 | D(p->level--); |
| 3510 | return NULL; |
| 3511 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3512 | asdl_alias_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3513 | int _mark = p->mark; |
| 3514 | { // ','.dotted_as_name+ |
| 3515 | if (p->error_indicator) { |
| 3516 | D(p->level--); |
| 3517 | return NULL; |
| 3518 | } |
| 3519 | 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] | 3520 | asdl_alias_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3521 | if ( |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3522 | (a = (asdl_alias_seq*)_gather_36_rule(p)) // ','.dotted_as_name+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3523 | ) |
| 3524 | { |
| 3525 | D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+")); |
| 3526 | _res = a; |
| 3527 | if (_res == NULL && PyErr_Occurred()) { |
| 3528 | p->error_indicator = 1; |
| 3529 | D(p->level--); |
| 3530 | return NULL; |
| 3531 | } |
| 3532 | goto done; |
| 3533 | } |
| 3534 | p->mark = _mark; |
| 3535 | D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
| 3536 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+")); |
| 3537 | } |
| 3538 | _res = NULL; |
| 3539 | done: |
| 3540 | D(p->level--); |
| 3541 | return _res; |
| 3542 | } |
| 3543 | |
| 3544 | // dotted_as_name: dotted_name ['as' NAME] |
| 3545 | static alias_ty |
| 3546 | dotted_as_name_rule(Parser *p) |
| 3547 | { |
| 3548 | D(p->level++); |
| 3549 | if (p->error_indicator) { |
| 3550 | D(p->level--); |
| 3551 | return NULL; |
| 3552 | } |
| 3553 | alias_ty _res = NULL; |
| 3554 | int _mark = p->mark; |
| 3555 | { // dotted_name ['as' NAME] |
| 3556 | if (p->error_indicator) { |
| 3557 | D(p->level--); |
| 3558 | return NULL; |
| 3559 | } |
| 3560 | D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]")); |
| 3561 | expr_ty a; |
| 3562 | void *b; |
| 3563 | if ( |
| 3564 | (a = dotted_name_rule(p)) // dotted_name |
| 3565 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 3566 | (b = _tmp_38_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3567 | ) |
| 3568 | { |
| 3569 | D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]")); |
| 3570 | _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena ); |
| 3571 | if (_res == NULL && PyErr_Occurred()) { |
| 3572 | p->error_indicator = 1; |
| 3573 | D(p->level--); |
| 3574 | return NULL; |
| 3575 | } |
| 3576 | goto done; |
| 3577 | } |
| 3578 | p->mark = _mark; |
| 3579 | D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3580 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]")); |
| 3581 | } |
| 3582 | _res = NULL; |
| 3583 | done: |
| 3584 | D(p->level--); |
| 3585 | return _res; |
| 3586 | } |
| 3587 | |
| 3588 | // Left-recursive |
| 3589 | // dotted_name: dotted_name '.' NAME | NAME |
| 3590 | static expr_ty dotted_name_raw(Parser *); |
| 3591 | static expr_ty |
| 3592 | dotted_name_rule(Parser *p) |
| 3593 | { |
| 3594 | D(p->level++); |
| 3595 | expr_ty _res = NULL; |
| 3596 | if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) { |
| 3597 | D(p->level--); |
| 3598 | return _res; |
| 3599 | } |
| 3600 | int _mark = p->mark; |
| 3601 | int _resmark = p->mark; |
| 3602 | while (1) { |
| 3603 | int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res); |
| 3604 | if (tmpvar_0) { |
| 3605 | D(p->level--); |
| 3606 | return _res; |
| 3607 | } |
| 3608 | p->mark = _mark; |
| 3609 | void *_raw = dotted_name_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 3610 | if (p->error_indicator) |
| 3611 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3612 | if (_raw == NULL || p->mark <= _resmark) |
| 3613 | break; |
| 3614 | _resmark = p->mark; |
| 3615 | _res = _raw; |
| 3616 | } |
| 3617 | p->mark = _resmark; |
| 3618 | D(p->level--); |
| 3619 | return _res; |
| 3620 | } |
| 3621 | static expr_ty |
| 3622 | dotted_name_raw(Parser *p) |
| 3623 | { |
| 3624 | D(p->level++); |
| 3625 | if (p->error_indicator) { |
| 3626 | D(p->level--); |
| 3627 | return NULL; |
| 3628 | } |
| 3629 | expr_ty _res = NULL; |
| 3630 | int _mark = p->mark; |
| 3631 | { // dotted_name '.' NAME |
| 3632 | if (p->error_indicator) { |
| 3633 | D(p->level--); |
| 3634 | return NULL; |
| 3635 | } |
| 3636 | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME")); |
| 3637 | Token * _literal; |
| 3638 | expr_ty a; |
| 3639 | expr_ty b; |
| 3640 | if ( |
| 3641 | (a = dotted_name_rule(p)) // dotted_name |
| 3642 | && |
| 3643 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 3644 | && |
| 3645 | (b = _PyPegen_name_token(p)) // NAME |
| 3646 | ) |
| 3647 | { |
| 3648 | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME")); |
| 3649 | _res = _PyPegen_join_names_with_dot ( p , a , b ); |
| 3650 | if (_res == NULL && PyErr_Occurred()) { |
| 3651 | p->error_indicator = 1; |
| 3652 | D(p->level--); |
| 3653 | return NULL; |
| 3654 | } |
| 3655 | goto done; |
| 3656 | } |
| 3657 | p->mark = _mark; |
| 3658 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3659 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME")); |
| 3660 | } |
| 3661 | { // NAME |
| 3662 | if (p->error_indicator) { |
| 3663 | D(p->level--); |
| 3664 | return NULL; |
| 3665 | } |
| 3666 | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 3667 | expr_ty name_var; |
| 3668 | if ( |
| 3669 | (name_var = _PyPegen_name_token(p)) // NAME |
| 3670 | ) |
| 3671 | { |
| 3672 | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 3673 | _res = name_var; |
| 3674 | goto done; |
| 3675 | } |
| 3676 | p->mark = _mark; |
| 3677 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3678 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 3679 | } |
| 3680 | _res = NULL; |
| 3681 | done: |
| 3682 | D(p->level--); |
| 3683 | return _res; |
| 3684 | } |
| 3685 | |
| 3686 | // if_stmt: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3687 | // | 'if' named_expression &&':' block elif_stmt |
| 3688 | // | 'if' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3689 | static stmt_ty |
| 3690 | if_stmt_rule(Parser *p) |
| 3691 | { |
| 3692 | D(p->level++); |
| 3693 | if (p->error_indicator) { |
| 3694 | D(p->level--); |
| 3695 | return NULL; |
| 3696 | } |
| 3697 | stmt_ty _res = NULL; |
| 3698 | int _mark = p->mark; |
| 3699 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3700 | p->error_indicator = 1; |
| 3701 | D(p->level--); |
| 3702 | return NULL; |
| 3703 | } |
| 3704 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3705 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3706 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3707 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3708 | { // 'if' named_expression &&':' block elif_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3709 | if (p->error_indicator) { |
| 3710 | D(p->level--); |
| 3711 | return NULL; |
| 3712 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3713 | 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] | 3714 | Token * _keyword; |
| 3715 | Token * _literal; |
| 3716 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3717 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3718 | stmt_ty c; |
| 3719 | if ( |
| 3720 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 3721 | && |
| 3722 | (a = named_expression_rule(p)) // named_expression |
| 3723 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3724 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3725 | && |
| 3726 | (b = block_rule(p)) // block |
| 3727 | && |
| 3728 | (c = elif_stmt_rule(p)) // elif_stmt |
| 3729 | ) |
| 3730 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3731 | 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] | 3732 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3733 | if (_token == NULL) { |
| 3734 | D(p->level--); |
| 3735 | return NULL; |
| 3736 | } |
| 3737 | int _end_lineno = _token->end_lineno; |
| 3738 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3739 | int _end_col_offset = _token->end_col_offset; |
| 3740 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 3741 | _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] | 3742 | if (_res == NULL && PyErr_Occurred()) { |
| 3743 | p->error_indicator = 1; |
| 3744 | D(p->level--); |
| 3745 | return NULL; |
| 3746 | } |
| 3747 | goto done; |
| 3748 | } |
| 3749 | p->mark = _mark; |
| 3750 | 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] | 3751 | 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] | 3752 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3753 | { // 'if' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3754 | if (p->error_indicator) { |
| 3755 | D(p->level--); |
| 3756 | return NULL; |
| 3757 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3758 | 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] | 3759 | Token * _keyword; |
| 3760 | Token * _literal; |
| 3761 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3762 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3763 | void *c; |
| 3764 | if ( |
| 3765 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 3766 | && |
| 3767 | (a = named_expression_rule(p)) // named_expression |
| 3768 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3769 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3770 | && |
| 3771 | (b = block_rule(p)) // block |
| 3772 | && |
| 3773 | (c = else_block_rule(p), 1) // else_block? |
| 3774 | ) |
| 3775 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3776 | 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] | 3777 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3778 | if (_token == NULL) { |
| 3779 | D(p->level--); |
| 3780 | return NULL; |
| 3781 | } |
| 3782 | int _end_lineno = _token->end_lineno; |
| 3783 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3784 | int _end_col_offset = _token->end_col_offset; |
| 3785 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3786 | _res = _Py_If ( a , b , c , EXTRA ); |
| 3787 | if (_res == NULL && PyErr_Occurred()) { |
| 3788 | p->error_indicator = 1; |
| 3789 | D(p->level--); |
| 3790 | return NULL; |
| 3791 | } |
| 3792 | goto done; |
| 3793 | } |
| 3794 | p->mark = _mark; |
| 3795 | 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] | 3796 | 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] | 3797 | } |
| 3798 | _res = NULL; |
| 3799 | done: |
| 3800 | D(p->level--); |
| 3801 | return _res; |
| 3802 | } |
| 3803 | |
| 3804 | // elif_stmt: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3805 | // | 'elif' named_expression &&':' block elif_stmt |
| 3806 | // | 'elif' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3807 | static stmt_ty |
| 3808 | elif_stmt_rule(Parser *p) |
| 3809 | { |
| 3810 | D(p->level++); |
| 3811 | if (p->error_indicator) { |
| 3812 | D(p->level--); |
| 3813 | return NULL; |
| 3814 | } |
| 3815 | stmt_ty _res = NULL; |
| 3816 | int _mark = p->mark; |
| 3817 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3818 | p->error_indicator = 1; |
| 3819 | D(p->level--); |
| 3820 | return NULL; |
| 3821 | } |
| 3822 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3823 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3824 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3825 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3826 | { // 'elif' named_expression &&':' block elif_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3827 | if (p->error_indicator) { |
| 3828 | D(p->level--); |
| 3829 | return NULL; |
| 3830 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3831 | 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] | 3832 | Token * _keyword; |
| 3833 | Token * _literal; |
| 3834 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3835 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3836 | stmt_ty c; |
| 3837 | if ( |
| 3838 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
| 3839 | && |
| 3840 | (a = named_expression_rule(p)) // named_expression |
| 3841 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3842 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3843 | && |
| 3844 | (b = block_rule(p)) // block |
| 3845 | && |
| 3846 | (c = elif_stmt_rule(p)) // elif_stmt |
| 3847 | ) |
| 3848 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3849 | 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] | 3850 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3851 | if (_token == NULL) { |
| 3852 | D(p->level--); |
| 3853 | return NULL; |
| 3854 | } |
| 3855 | int _end_lineno = _token->end_lineno; |
| 3856 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3857 | int _end_col_offset = _token->end_col_offset; |
| 3858 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 3859 | _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] | 3860 | if (_res == NULL && PyErr_Occurred()) { |
| 3861 | p->error_indicator = 1; |
| 3862 | D(p->level--); |
| 3863 | return NULL; |
| 3864 | } |
| 3865 | goto done; |
| 3866 | } |
| 3867 | p->mark = _mark; |
| 3868 | 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] | 3869 | 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] | 3870 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3871 | { // 'elif' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3872 | if (p->error_indicator) { |
| 3873 | D(p->level--); |
| 3874 | return NULL; |
| 3875 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3876 | 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] | 3877 | Token * _keyword; |
| 3878 | Token * _literal; |
| 3879 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3880 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3881 | void *c; |
| 3882 | if ( |
| 3883 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
| 3884 | && |
| 3885 | (a = named_expression_rule(p)) // named_expression |
| 3886 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3887 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3888 | && |
| 3889 | (b = block_rule(p)) // block |
| 3890 | && |
| 3891 | (c = else_block_rule(p), 1) // else_block? |
| 3892 | ) |
| 3893 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3894 | 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] | 3895 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3896 | if (_token == NULL) { |
| 3897 | D(p->level--); |
| 3898 | return NULL; |
| 3899 | } |
| 3900 | int _end_lineno = _token->end_lineno; |
| 3901 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3902 | int _end_col_offset = _token->end_col_offset; |
| 3903 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3904 | _res = _Py_If ( a , b , c , EXTRA ); |
| 3905 | if (_res == NULL && PyErr_Occurred()) { |
| 3906 | p->error_indicator = 1; |
| 3907 | D(p->level--); |
| 3908 | return NULL; |
| 3909 | } |
| 3910 | goto done; |
| 3911 | } |
| 3912 | p->mark = _mark; |
| 3913 | 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] | 3914 | 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] | 3915 | } |
| 3916 | _res = NULL; |
| 3917 | done: |
| 3918 | D(p->level--); |
| 3919 | return _res; |
| 3920 | } |
| 3921 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3922 | // else_block: 'else' &&':' block |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3923 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3924 | else_block_rule(Parser *p) |
| 3925 | { |
| 3926 | D(p->level++); |
| 3927 | if (p->error_indicator) { |
| 3928 | D(p->level--); |
| 3929 | return NULL; |
| 3930 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3931 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3932 | int _mark = p->mark; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3933 | { // 'else' &&':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3934 | if (p->error_indicator) { |
| 3935 | D(p->level--); |
| 3936 | return NULL; |
| 3937 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3938 | 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] | 3939 | Token * _keyword; |
| 3940 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3941 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3942 | if ( |
| 3943 | (_keyword = _PyPegen_expect_token(p, 516)) // token='else' |
| 3944 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3945 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3946 | && |
| 3947 | (b = block_rule(p)) // block |
| 3948 | ) |
| 3949 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3950 | 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] | 3951 | _res = b; |
| 3952 | if (_res == NULL && PyErr_Occurred()) { |
| 3953 | p->error_indicator = 1; |
| 3954 | D(p->level--); |
| 3955 | return NULL; |
| 3956 | } |
| 3957 | goto done; |
| 3958 | } |
| 3959 | p->mark = _mark; |
| 3960 | 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] | 3961 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' &&':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3962 | } |
| 3963 | _res = NULL; |
| 3964 | done: |
| 3965 | D(p->level--); |
| 3966 | return _res; |
| 3967 | } |
| 3968 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3969 | // while_stmt: 'while' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3970 | static stmt_ty |
| 3971 | while_stmt_rule(Parser *p) |
| 3972 | { |
| 3973 | D(p->level++); |
| 3974 | if (p->error_indicator) { |
| 3975 | D(p->level--); |
| 3976 | return NULL; |
| 3977 | } |
| 3978 | stmt_ty _res = NULL; |
| 3979 | int _mark = p->mark; |
| 3980 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3981 | p->error_indicator = 1; |
| 3982 | D(p->level--); |
| 3983 | return NULL; |
| 3984 | } |
| 3985 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3986 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3987 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3988 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3989 | { // 'while' named_expression &&':' block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3990 | if (p->error_indicator) { |
| 3991 | D(p->level--); |
| 3992 | return NULL; |
| 3993 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 3994 | 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] | 3995 | Token * _keyword; |
| 3996 | Token * _literal; |
| 3997 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 3998 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 3999 | void *c; |
| 4000 | if ( |
| 4001 | (_keyword = _PyPegen_expect_token(p, 512)) // token='while' |
| 4002 | && |
| 4003 | (a = named_expression_rule(p)) // named_expression |
| 4004 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4005 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4006 | && |
| 4007 | (b = block_rule(p)) // block |
| 4008 | && |
| 4009 | (c = else_block_rule(p), 1) // else_block? |
| 4010 | ) |
| 4011 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4012 | 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] | 4013 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4014 | if (_token == NULL) { |
| 4015 | D(p->level--); |
| 4016 | return NULL; |
| 4017 | } |
| 4018 | int _end_lineno = _token->end_lineno; |
| 4019 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4020 | int _end_col_offset = _token->end_col_offset; |
| 4021 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4022 | _res = _Py_While ( a , b , c , EXTRA ); |
| 4023 | if (_res == NULL && PyErr_Occurred()) { |
| 4024 | p->error_indicator = 1; |
| 4025 | D(p->level--); |
| 4026 | return NULL; |
| 4027 | } |
| 4028 | goto done; |
| 4029 | } |
| 4030 | p->mark = _mark; |
| 4031 | 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] | 4032 | 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] | 4033 | } |
| 4034 | _res = NULL; |
| 4035 | done: |
| 4036 | D(p->level--); |
| 4037 | return _res; |
| 4038 | } |
| 4039 | |
| 4040 | // for_stmt: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4041 | // | 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
| 4042 | // | ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4043 | // | invalid_for_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4044 | static stmt_ty |
| 4045 | for_stmt_rule(Parser *p) |
| 4046 | { |
| 4047 | D(p->level++); |
| 4048 | if (p->error_indicator) { |
| 4049 | D(p->level--); |
| 4050 | return NULL; |
| 4051 | } |
| 4052 | stmt_ty _res = NULL; |
| 4053 | int _mark = p->mark; |
| 4054 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4055 | p->error_indicator = 1; |
| 4056 | D(p->level--); |
| 4057 | return NULL; |
| 4058 | } |
| 4059 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4060 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4061 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4062 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4063 | { // 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4064 | if (p->error_indicator) { |
| 4065 | D(p->level--); |
| 4066 | return NULL; |
| 4067 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4068 | 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] | 4069 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4070 | Token * _keyword; |
| 4071 | Token * _keyword_1; |
| 4072 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4073 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4074 | void *el; |
| 4075 | expr_ty ex; |
| 4076 | expr_ty t; |
| 4077 | void *tc; |
| 4078 | if ( |
| 4079 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 4080 | && |
| 4081 | (t = star_targets_rule(p)) // star_targets |
| 4082 | && |
| 4083 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 4084 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4085 | (_cut_var = 1) |
| 4086 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4087 | (ex = star_expressions_rule(p)) // star_expressions |
| 4088 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4089 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4090 | && |
| 4091 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 4092 | && |
| 4093 | (b = block_rule(p)) // block |
| 4094 | && |
| 4095 | (el = else_block_rule(p), 1) // else_block? |
| 4096 | ) |
| 4097 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4098 | 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] | 4099 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4100 | if (_token == NULL) { |
| 4101 | D(p->level--); |
| 4102 | return NULL; |
| 4103 | } |
| 4104 | int _end_lineno = _token->end_lineno; |
| 4105 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4106 | int _end_col_offset = _token->end_col_offset; |
| 4107 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4108 | _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 4109 | if (_res == NULL && PyErr_Occurred()) { |
| 4110 | p->error_indicator = 1; |
| 4111 | D(p->level--); |
| 4112 | return NULL; |
| 4113 | } |
| 4114 | goto done; |
| 4115 | } |
| 4116 | p->mark = _mark; |
| 4117 | 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] | 4118 | 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] | 4119 | if (_cut_var) { |
| 4120 | D(p->level--); |
| 4121 | return NULL; |
| 4122 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4123 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4124 | { // ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4125 | if (p->error_indicator) { |
| 4126 | D(p->level--); |
| 4127 | return NULL; |
| 4128 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4129 | 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] | 4130 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4131 | Token * _keyword; |
| 4132 | Token * _keyword_1; |
| 4133 | Token * _literal; |
| 4134 | Token * async_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4135 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4136 | void *el; |
| 4137 | expr_ty ex; |
| 4138 | expr_ty t; |
| 4139 | void *tc; |
| 4140 | if ( |
| 4141 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 4142 | && |
| 4143 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 4144 | && |
| 4145 | (t = star_targets_rule(p)) // star_targets |
| 4146 | && |
| 4147 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 4148 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4149 | (_cut_var = 1) |
| 4150 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4151 | (ex = star_expressions_rule(p)) // star_expressions |
| 4152 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4153 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4154 | && |
| 4155 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 4156 | && |
| 4157 | (b = block_rule(p)) // block |
| 4158 | && |
| 4159 | (el = else_block_rule(p), 1) // else_block? |
| 4160 | ) |
| 4161 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4162 | 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] | 4163 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4164 | if (_token == NULL) { |
| 4165 | D(p->level--); |
| 4166 | return NULL; |
| 4167 | } |
| 4168 | int _end_lineno = _token->end_lineno; |
| 4169 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4170 | int _end_col_offset = _token->end_col_offset; |
| 4171 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 4172 | _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] | 4173 | if (_res == NULL && PyErr_Occurred()) { |
| 4174 | p->error_indicator = 1; |
| 4175 | D(p->level--); |
| 4176 | return NULL; |
| 4177 | } |
| 4178 | goto done; |
| 4179 | } |
| 4180 | p->mark = _mark; |
| 4181 | 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] | 4182 | 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] | 4183 | if (_cut_var) { |
| 4184 | D(p->level--); |
| 4185 | return NULL; |
| 4186 | } |
| 4187 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 4188 | if (p->call_invalid_rules) { // invalid_for_target |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4189 | if (p->error_indicator) { |
| 4190 | D(p->level--); |
| 4191 | return NULL; |
| 4192 | } |
| 4193 | D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
| 4194 | void *invalid_for_target_var; |
| 4195 | if ( |
| 4196 | (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target |
| 4197 | ) |
| 4198 | { |
| 4199 | D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
| 4200 | _res = invalid_for_target_var; |
| 4201 | goto done; |
| 4202 | } |
| 4203 | p->mark = _mark; |
| 4204 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4205 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4206 | } |
| 4207 | _res = NULL; |
| 4208 | done: |
| 4209 | D(p->level--); |
| 4210 | return _res; |
| 4211 | } |
| 4212 | |
| 4213 | // with_stmt: |
| 4214 | // | 'with' '(' ','.with_item+ ','? ')' ':' block |
| 4215 | // | 'with' ','.with_item+ ':' TYPE_COMMENT? block |
| 4216 | // | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
| 4217 | // | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4218 | // | invalid_with_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4219 | static stmt_ty |
| 4220 | with_stmt_rule(Parser *p) |
| 4221 | { |
| 4222 | D(p->level++); |
| 4223 | if (p->error_indicator) { |
| 4224 | D(p->level--); |
| 4225 | return NULL; |
| 4226 | } |
| 4227 | stmt_ty _res = NULL; |
| 4228 | int _mark = p->mark; |
| 4229 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4230 | p->error_indicator = 1; |
| 4231 | D(p->level--); |
| 4232 | return NULL; |
| 4233 | } |
| 4234 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4235 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4236 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4237 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 4238 | { // 'with' '(' ','.with_item+ ','? ')' ':' block |
| 4239 | if (p->error_indicator) { |
| 4240 | D(p->level--); |
| 4241 | return NULL; |
| 4242 | } |
| 4243 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4244 | Token * _keyword; |
| 4245 | Token * _literal; |
| 4246 | Token * _literal_1; |
| 4247 | Token * _literal_2; |
| 4248 | void *_opt_var; |
| 4249 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4250 | asdl_withitem_seq* a; |
| 4251 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4252 | if ( |
| 4253 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 4254 | && |
| 4255 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 4256 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4257 | (a = (asdl_withitem_seq*)_gather_39_rule(p)) // ','.with_item+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4258 | && |
| 4259 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 4260 | && |
| 4261 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 4262 | && |
| 4263 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
| 4264 | && |
| 4265 | (b = block_rule(p)) // block |
| 4266 | ) |
| 4267 | { |
| 4268 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4269 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4270 | if (_token == NULL) { |
| 4271 | D(p->level--); |
| 4272 | return NULL; |
| 4273 | } |
| 4274 | int _end_lineno = _token->end_lineno; |
| 4275 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4276 | int _end_col_offset = _token->end_col_offset; |
| 4277 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4278 | _res = _Py_With ( a , b , NULL , EXTRA ); |
| 4279 | if (_res == NULL && PyErr_Occurred()) { |
| 4280 | p->error_indicator = 1; |
| 4281 | D(p->level--); |
| 4282 | return NULL; |
| 4283 | } |
| 4284 | goto done; |
| 4285 | } |
| 4286 | p->mark = _mark; |
| 4287 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4288 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4289 | } |
| 4290 | { // 'with' ','.with_item+ ':' TYPE_COMMENT? block |
| 4291 | if (p->error_indicator) { |
| 4292 | D(p->level--); |
| 4293 | return NULL; |
| 4294 | } |
| 4295 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4296 | Token * _keyword; |
| 4297 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4298 | asdl_withitem_seq* a; |
| 4299 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4300 | void *tc; |
| 4301 | if ( |
| 4302 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 4303 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4304 | (a = (asdl_withitem_seq*)_gather_41_rule(p)) // ','.with_item+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4305 | && |
| 4306 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 4307 | && |
| 4308 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 4309 | && |
| 4310 | (b = block_rule(p)) // block |
| 4311 | ) |
| 4312 | { |
| 4313 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4314 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4315 | if (_token == NULL) { |
| 4316 | D(p->level--); |
| 4317 | return NULL; |
| 4318 | } |
| 4319 | int _end_lineno = _token->end_lineno; |
| 4320 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4321 | int _end_col_offset = _token->end_col_offset; |
| 4322 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4323 | _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 4324 | if (_res == NULL && PyErr_Occurred()) { |
| 4325 | p->error_indicator = 1; |
| 4326 | D(p->level--); |
| 4327 | return NULL; |
| 4328 | } |
| 4329 | goto done; |
| 4330 | } |
| 4331 | p->mark = _mark; |
| 4332 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4333 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4334 | } |
| 4335 | { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
| 4336 | if (p->error_indicator) { |
| 4337 | D(p->level--); |
| 4338 | return NULL; |
| 4339 | } |
| 4340 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4341 | Token * _keyword; |
| 4342 | Token * _literal; |
| 4343 | Token * _literal_1; |
| 4344 | Token * _literal_2; |
| 4345 | void *_opt_var; |
| 4346 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4347 | asdl_withitem_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4348 | Token * async_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4349 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4350 | if ( |
| 4351 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 4352 | && |
| 4353 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 4354 | && |
| 4355 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 4356 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4357 | (a = (asdl_withitem_seq*)_gather_43_rule(p)) // ','.with_item+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4358 | && |
| 4359 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 4360 | && |
| 4361 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 4362 | && |
| 4363 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
| 4364 | && |
| 4365 | (b = block_rule(p)) // block |
| 4366 | ) |
| 4367 | { |
| 4368 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4369 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4370 | if (_token == NULL) { |
| 4371 | D(p->level--); |
| 4372 | return NULL; |
| 4373 | } |
| 4374 | int _end_lineno = _token->end_lineno; |
| 4375 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4376 | int _end_col_offset = _token->end_col_offset; |
| 4377 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 4378 | _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] | 4379 | if (_res == NULL && PyErr_Occurred()) { |
| 4380 | p->error_indicator = 1; |
| 4381 | D(p->level--); |
| 4382 | return NULL; |
| 4383 | } |
| 4384 | goto done; |
| 4385 | } |
| 4386 | p->mark = _mark; |
| 4387 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4388 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
| 4389 | } |
| 4390 | { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
| 4391 | if (p->error_indicator) { |
| 4392 | D(p->level--); |
| 4393 | return NULL; |
| 4394 | } |
| 4395 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4396 | Token * _keyword; |
| 4397 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4398 | asdl_withitem_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4399 | Token * async_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4400 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4401 | void *tc; |
| 4402 | if ( |
| 4403 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 4404 | && |
| 4405 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 4406 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4407 | (a = (asdl_withitem_seq*)_gather_45_rule(p)) // ','.with_item+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4408 | && |
| 4409 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 4410 | && |
| 4411 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 4412 | && |
| 4413 | (b = block_rule(p)) // block |
| 4414 | ) |
| 4415 | { |
| 4416 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4417 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4418 | if (_token == NULL) { |
| 4419 | D(p->level--); |
| 4420 | return NULL; |
| 4421 | } |
| 4422 | int _end_lineno = _token->end_lineno; |
| 4423 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4424 | int _end_col_offset = _token->end_col_offset; |
| 4425 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 4426 | _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] | 4427 | if (_res == NULL && PyErr_Occurred()) { |
| 4428 | p->error_indicator = 1; |
| 4429 | D(p->level--); |
| 4430 | return NULL; |
| 4431 | } |
| 4432 | goto done; |
| 4433 | } |
| 4434 | p->mark = _mark; |
| 4435 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4436 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
| 4437 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4438 | if (p->call_invalid_rules) { // invalid_with_stmt |
| 4439 | if (p->error_indicator) { |
| 4440 | D(p->level--); |
| 4441 | return NULL; |
| 4442 | } |
| 4443 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt")); |
| 4444 | void *invalid_with_stmt_var; |
| 4445 | if ( |
| 4446 | (invalid_with_stmt_var = invalid_with_stmt_rule(p)) // invalid_with_stmt |
| 4447 | ) |
| 4448 | { |
| 4449 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt")); |
| 4450 | _res = invalid_with_stmt_var; |
| 4451 | goto done; |
| 4452 | } |
| 4453 | p->mark = _mark; |
| 4454 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4455 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt")); |
| 4456 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4457 | _res = NULL; |
| 4458 | done: |
| 4459 | D(p->level--); |
| 4460 | return _res; |
| 4461 | } |
| 4462 | |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4463 | // with_item: |
| 4464 | // | expression 'as' star_target &(',' | ')' | ':') |
| 4465 | // | invalid_with_item |
| 4466 | // | expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4467 | static withitem_ty |
| 4468 | with_item_rule(Parser *p) |
| 4469 | { |
| 4470 | D(p->level++); |
| 4471 | if (p->error_indicator) { |
| 4472 | D(p->level--); |
| 4473 | return NULL; |
| 4474 | } |
| 4475 | withitem_ty _res = NULL; |
| 4476 | int _mark = p->mark; |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4477 | { // expression 'as' star_target &(',' | ')' | ':') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4478 | if (p->error_indicator) { |
| 4479 | D(p->level--); |
| 4480 | return NULL; |
| 4481 | } |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4482 | 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] | 4483 | Token * _keyword; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4484 | expr_ty e; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4485 | expr_ty t; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4486 | if ( |
| 4487 | (e = expression_rule(p)) // expression |
| 4488 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4489 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 4490 | && |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4491 | (t = star_target_rule(p)) // star_target |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4492 | && |
| 4493 | _PyPegen_lookahead(1, _tmp_47_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4494 | ) |
| 4495 | { |
Batuhan Taskaya | 48f305f | 2020-10-09 12:56:48 +0300 | [diff] [blame] | 4496 | 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] | 4497 | _res = _Py_withitem ( e , t , p -> arena ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4498 | if (_res == NULL && PyErr_Occurred()) { |
| 4499 | p->error_indicator = 1; |
| 4500 | D(p->level--); |
| 4501 | return NULL; |
| 4502 | } |
| 4503 | goto done; |
| 4504 | } |
| 4505 | p->mark = _mark; |
| 4506 | 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] | 4507 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4508 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 4509 | if (p->call_invalid_rules) { // invalid_with_item |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4510 | if (p->error_indicator) { |
| 4511 | D(p->level--); |
| 4512 | return NULL; |
| 4513 | } |
| 4514 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item")); |
| 4515 | void *invalid_with_item_var; |
| 4516 | if ( |
| 4517 | (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item |
| 4518 | ) |
| 4519 | { |
| 4520 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item")); |
| 4521 | _res = invalid_with_item_var; |
| 4522 | goto done; |
| 4523 | } |
| 4524 | p->mark = _mark; |
| 4525 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
| 4526 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item")); |
| 4527 | } |
| 4528 | { // expression |
| 4529 | if (p->error_indicator) { |
| 4530 | D(p->level--); |
| 4531 | return NULL; |
| 4532 | } |
| 4533 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
| 4534 | expr_ty e; |
| 4535 | if ( |
| 4536 | (e = expression_rule(p)) // expression |
| 4537 | ) |
| 4538 | { |
| 4539 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
| 4540 | _res = _Py_withitem ( e , NULL , p -> arena ); |
| 4541 | if (_res == NULL && PyErr_Occurred()) { |
| 4542 | p->error_indicator = 1; |
| 4543 | D(p->level--); |
| 4544 | return NULL; |
| 4545 | } |
| 4546 | goto done; |
| 4547 | } |
| 4548 | p->mark = _mark; |
| 4549 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
| 4550 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4551 | } |
| 4552 | _res = NULL; |
| 4553 | done: |
| 4554 | D(p->level--); |
| 4555 | return _res; |
| 4556 | } |
| 4557 | |
| 4558 | // try_stmt: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4559 | // | 'try' &&':' block finally_block |
| 4560 | // | 'try' &&':' block except_block+ else_block? finally_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4561 | static stmt_ty |
| 4562 | try_stmt_rule(Parser *p) |
| 4563 | { |
| 4564 | D(p->level++); |
| 4565 | if (p->error_indicator) { |
| 4566 | D(p->level--); |
| 4567 | return NULL; |
| 4568 | } |
| 4569 | stmt_ty _res = NULL; |
| 4570 | int _mark = p->mark; |
| 4571 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4572 | p->error_indicator = 1; |
| 4573 | D(p->level--); |
| 4574 | return NULL; |
| 4575 | } |
| 4576 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4577 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4578 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4579 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4580 | { // 'try' &&':' block finally_block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4581 | if (p->error_indicator) { |
| 4582 | D(p->level--); |
| 4583 | return NULL; |
| 4584 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4585 | 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] | 4586 | Token * _keyword; |
| 4587 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4588 | asdl_stmt_seq* b; |
| 4589 | asdl_stmt_seq* f; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4590 | if ( |
| 4591 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
| 4592 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4593 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4594 | && |
| 4595 | (b = block_rule(p)) // block |
| 4596 | && |
| 4597 | (f = finally_block_rule(p)) // finally_block |
| 4598 | ) |
| 4599 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4600 | 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] | 4601 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4602 | if (_token == NULL) { |
| 4603 | D(p->level--); |
| 4604 | return NULL; |
| 4605 | } |
| 4606 | int _end_lineno = _token->end_lineno; |
| 4607 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4608 | int _end_col_offset = _token->end_col_offset; |
| 4609 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4610 | _res = _Py_Try ( b , NULL , NULL , f , EXTRA ); |
| 4611 | if (_res == NULL && PyErr_Occurred()) { |
| 4612 | p->error_indicator = 1; |
| 4613 | D(p->level--); |
| 4614 | return NULL; |
| 4615 | } |
| 4616 | goto done; |
| 4617 | } |
| 4618 | p->mark = _mark; |
| 4619 | 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] | 4620 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block finally_block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4621 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4622 | { // 'try' &&':' block except_block+ else_block? finally_block? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4623 | if (p->error_indicator) { |
| 4624 | D(p->level--); |
| 4625 | return NULL; |
| 4626 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4627 | 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] | 4628 | Token * _keyword; |
| 4629 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4630 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4631 | void *el; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4632 | asdl_excepthandler_seq* ex; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4633 | void *f; |
| 4634 | if ( |
| 4635 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
| 4636 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4637 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4638 | && |
| 4639 | (b = block_rule(p)) // block |
| 4640 | && |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4641 | (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p)) // except_block+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4642 | && |
| 4643 | (el = else_block_rule(p), 1) // else_block? |
| 4644 | && |
| 4645 | (f = finally_block_rule(p), 1) // finally_block? |
| 4646 | ) |
| 4647 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 4648 | 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] | 4649 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4650 | if (_token == NULL) { |
| 4651 | D(p->level--); |
| 4652 | return NULL; |
| 4653 | } |
| 4654 | int _end_lineno = _token->end_lineno; |
| 4655 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4656 | int _end_col_offset = _token->end_col_offset; |
| 4657 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4658 | _res = _Py_Try ( b , ex , el , f , EXTRA ); |
| 4659 | if (_res == NULL && PyErr_Occurred()) { |
| 4660 | p->error_indicator = 1; |
| 4661 | D(p->level--); |
| 4662 | return NULL; |
| 4663 | } |
| 4664 | goto done; |
| 4665 | } |
| 4666 | p->mark = _mark; |
| 4667 | 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] | 4668 | 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] | 4669 | } |
| 4670 | _res = NULL; |
| 4671 | done: |
| 4672 | D(p->level--); |
| 4673 | return _res; |
| 4674 | } |
| 4675 | |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4676 | // except_block: |
| 4677 | // | 'except' expression ['as' NAME] ':' block |
| 4678 | // | 'except' ':' block |
| 4679 | // | invalid_except_block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4680 | static excepthandler_ty |
| 4681 | except_block_rule(Parser *p) |
| 4682 | { |
| 4683 | D(p->level++); |
| 4684 | if (p->error_indicator) { |
| 4685 | D(p->level--); |
| 4686 | return NULL; |
| 4687 | } |
| 4688 | excepthandler_ty _res = NULL; |
| 4689 | int _mark = p->mark; |
| 4690 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4691 | p->error_indicator = 1; |
| 4692 | D(p->level--); |
| 4693 | return NULL; |
| 4694 | } |
| 4695 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4696 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4697 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4698 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4699 | { // 'except' expression ['as' NAME] ':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4700 | if (p->error_indicator) { |
| 4701 | D(p->level--); |
| 4702 | return NULL; |
| 4703 | } |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4704 | 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] | 4705 | Token * _keyword; |
| 4706 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4707 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4708 | expr_ty e; |
| 4709 | void *t; |
| 4710 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4711 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4712 | && |
| 4713 | (e = expression_rule(p)) // expression |
| 4714 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4715 | (t = _tmp_49_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4716 | && |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4717 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4718 | && |
| 4719 | (b = block_rule(p)) // block |
| 4720 | ) |
| 4721 | { |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4722 | 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] | 4723 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4724 | if (_token == NULL) { |
| 4725 | D(p->level--); |
| 4726 | return NULL; |
| 4727 | } |
| 4728 | int _end_lineno = _token->end_lineno; |
| 4729 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4730 | int _end_col_offset = _token->end_col_offset; |
| 4731 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4732 | _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA ); |
| 4733 | if (_res == NULL && PyErr_Occurred()) { |
| 4734 | p->error_indicator = 1; |
| 4735 | D(p->level--); |
| 4736 | return NULL; |
| 4737 | } |
| 4738 | goto done; |
| 4739 | } |
| 4740 | p->mark = _mark; |
| 4741 | 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] | 4742 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4743 | } |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4744 | { // 'except' ':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4745 | if (p->error_indicator) { |
| 4746 | D(p->level--); |
| 4747 | return NULL; |
| 4748 | } |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4749 | 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] | 4750 | Token * _keyword; |
| 4751 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4752 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4753 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4754 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4755 | && |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4756 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4757 | && |
| 4758 | (b = block_rule(p)) // block |
| 4759 | ) |
| 4760 | { |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 4761 | 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] | 4762 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4763 | if (_token == NULL) { |
| 4764 | D(p->level--); |
| 4765 | return NULL; |
| 4766 | } |
| 4767 | int _end_lineno = _token->end_lineno; |
| 4768 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4769 | int _end_col_offset = _token->end_col_offset; |
| 4770 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4771 | _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA ); |
| 4772 | if (_res == NULL && PyErr_Occurred()) { |
| 4773 | p->error_indicator = 1; |
| 4774 | D(p->level--); |
| 4775 | return NULL; |
| 4776 | } |
| 4777 | goto done; |
| 4778 | } |
| 4779 | p->mark = _mark; |
| 4780 | 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] | 4781 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block")); |
| 4782 | } |
| 4783 | if (p->call_invalid_rules) { // invalid_except_block |
| 4784 | if (p->error_indicator) { |
| 4785 | D(p->level--); |
| 4786 | return NULL; |
| 4787 | } |
| 4788 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_block")); |
| 4789 | void *invalid_except_block_var; |
| 4790 | if ( |
| 4791 | (invalid_except_block_var = invalid_except_block_rule(p)) // invalid_except_block |
| 4792 | ) |
| 4793 | { |
| 4794 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_block")); |
| 4795 | _res = invalid_except_block_var; |
| 4796 | goto done; |
| 4797 | } |
| 4798 | p->mark = _mark; |
| 4799 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4800 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4801 | } |
| 4802 | _res = NULL; |
| 4803 | done: |
| 4804 | D(p->level--); |
| 4805 | return _res; |
| 4806 | } |
| 4807 | |
| 4808 | // finally_block: 'finally' ':' block |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4809 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4810 | finally_block_rule(Parser *p) |
| 4811 | { |
| 4812 | D(p->level++); |
| 4813 | if (p->error_indicator) { |
| 4814 | D(p->level--); |
| 4815 | return NULL; |
| 4816 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4817 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4818 | int _mark = p->mark; |
| 4819 | { // 'finally' ':' block |
| 4820 | if (p->error_indicator) { |
| 4821 | D(p->level--); |
| 4822 | return NULL; |
| 4823 | } |
| 4824 | D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block")); |
| 4825 | Token * _keyword; |
| 4826 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 4827 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4828 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 4829 | (_keyword = _PyPegen_expect_token(p, 522)) // token='finally' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 4830 | && |
| 4831 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 4832 | && |
| 4833 | (a = block_rule(p)) // block |
| 4834 | ) |
| 4835 | { |
| 4836 | D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block")); |
| 4837 | _res = a; |
| 4838 | if (_res == NULL && PyErr_Occurred()) { |
| 4839 | p->error_indicator = 1; |
| 4840 | D(p->level--); |
| 4841 | return NULL; |
| 4842 | } |
| 4843 | goto done; |
| 4844 | } |
| 4845 | p->mark = _mark; |
| 4846 | D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4847 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block")); |
| 4848 | } |
| 4849 | _res = NULL; |
| 4850 | done: |
| 4851 | D(p->level--); |
| 4852 | return _res; |
| 4853 | } |
| 4854 | |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 4855 | // match_stmt: |
| 4856 | // | "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT |
| 4857 | // | invalid_match_stmt |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 4858 | static stmt_ty |
| 4859 | match_stmt_rule(Parser *p) |
| 4860 | { |
| 4861 | D(p->level++); |
| 4862 | if (p->error_indicator) { |
| 4863 | D(p->level--); |
| 4864 | return NULL; |
| 4865 | } |
| 4866 | stmt_ty _res = NULL; |
| 4867 | int _mark = p->mark; |
| 4868 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4869 | p->error_indicator = 1; |
| 4870 | D(p->level--); |
| 4871 | return NULL; |
| 4872 | } |
| 4873 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4874 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4875 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4876 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 4877 | { // "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT |
| 4878 | if (p->error_indicator) { |
| 4879 | D(p->level--); |
| 4880 | return NULL; |
| 4881 | } |
| 4882 | D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
| 4883 | expr_ty _keyword; |
| 4884 | Token * _literal; |
| 4885 | asdl_match_case_seq* cases; |
| 4886 | Token * dedent_var; |
| 4887 | Token * indent_var; |
| 4888 | Token * newline_var; |
| 4889 | expr_ty subject; |
| 4890 | if ( |
| 4891 | (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' |
| 4892 | && |
| 4893 | (subject = subject_expr_rule(p)) // subject_expr |
| 4894 | && |
| 4895 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 4896 | && |
| 4897 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 4898 | && |
| 4899 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
| 4900 | && |
| 4901 | (cases = (asdl_match_case_seq*)_loop1_50_rule(p)) // case_block+ |
| 4902 | && |
| 4903 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
| 4904 | ) |
| 4905 | { |
| 4906 | D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
| 4907 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4908 | if (_token == NULL) { |
| 4909 | D(p->level--); |
| 4910 | return NULL; |
| 4911 | } |
| 4912 | int _end_lineno = _token->end_lineno; |
| 4913 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4914 | int _end_col_offset = _token->end_col_offset; |
| 4915 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4916 | _res = CHECK_VERSION ( stmt_ty , 10 , "Pattern matching is" , _Py_Match ( subject , cases , EXTRA ) ); |
| 4917 | if (_res == NULL && PyErr_Occurred()) { |
| 4918 | p->error_indicator = 1; |
| 4919 | D(p->level--); |
| 4920 | return NULL; |
| 4921 | } |
| 4922 | goto done; |
| 4923 | } |
| 4924 | p->mark = _mark; |
| 4925 | D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4926 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
| 4927 | } |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 4928 | if (p->call_invalid_rules) { // invalid_match_stmt |
| 4929 | if (p->error_indicator) { |
| 4930 | D(p->level--); |
| 4931 | return NULL; |
| 4932 | } |
| 4933 | D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt")); |
| 4934 | void *invalid_match_stmt_var; |
| 4935 | if ( |
| 4936 | (invalid_match_stmt_var = invalid_match_stmt_rule(p)) // invalid_match_stmt |
| 4937 | ) |
| 4938 | { |
| 4939 | D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt")); |
| 4940 | _res = invalid_match_stmt_var; |
| 4941 | goto done; |
| 4942 | } |
| 4943 | p->mark = _mark; |
| 4944 | D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4945 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_match_stmt")); |
| 4946 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 4947 | _res = NULL; |
| 4948 | done: |
| 4949 | D(p->level--); |
| 4950 | return _res; |
| 4951 | } |
| 4952 | |
| 4953 | // subject_expr: star_named_expression ',' star_named_expressions? | named_expression |
| 4954 | static expr_ty |
| 4955 | subject_expr_rule(Parser *p) |
| 4956 | { |
| 4957 | D(p->level++); |
| 4958 | if (p->error_indicator) { |
| 4959 | D(p->level--); |
| 4960 | return NULL; |
| 4961 | } |
| 4962 | expr_ty _res = NULL; |
| 4963 | int _mark = p->mark; |
| 4964 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4965 | p->error_indicator = 1; |
| 4966 | D(p->level--); |
| 4967 | return NULL; |
| 4968 | } |
| 4969 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4970 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4971 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4972 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 4973 | { // star_named_expression ',' star_named_expressions? |
| 4974 | if (p->error_indicator) { |
| 4975 | D(p->level--); |
| 4976 | return NULL; |
| 4977 | } |
| 4978 | D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
| 4979 | Token * _literal; |
| 4980 | expr_ty value; |
| 4981 | void *values; |
| 4982 | if ( |
| 4983 | (value = star_named_expression_rule(p)) // star_named_expression |
| 4984 | && |
| 4985 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 4986 | && |
| 4987 | (values = star_named_expressions_rule(p), 1) // star_named_expressions? |
| 4988 | ) |
| 4989 | { |
| 4990 | D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
| 4991 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4992 | if (_token == NULL) { |
| 4993 | D(p->level--); |
| 4994 | return NULL; |
| 4995 | } |
| 4996 | int _end_lineno = _token->end_lineno; |
| 4997 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4998 | int _end_col_offset = _token->end_col_offset; |
| 4999 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5000 | _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); |
| 5001 | if (_res == NULL && PyErr_Occurred()) { |
| 5002 | p->error_indicator = 1; |
| 5003 | D(p->level--); |
| 5004 | return NULL; |
| 5005 | } |
| 5006 | goto done; |
| 5007 | } |
| 5008 | p->mark = _mark; |
| 5009 | D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 5010 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
| 5011 | } |
| 5012 | { // named_expression |
| 5013 | if (p->error_indicator) { |
| 5014 | D(p->level--); |
| 5015 | return NULL; |
| 5016 | } |
| 5017 | D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
| 5018 | expr_ty named_expression_var; |
| 5019 | if ( |
| 5020 | (named_expression_var = named_expression_rule(p)) // named_expression |
| 5021 | ) |
| 5022 | { |
| 5023 | D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
| 5024 | _res = named_expression_var; |
| 5025 | goto done; |
| 5026 | } |
| 5027 | p->mark = _mark; |
| 5028 | D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 5029 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
| 5030 | } |
| 5031 | _res = NULL; |
| 5032 | done: |
| 5033 | D(p->level--); |
| 5034 | return _res; |
| 5035 | } |
| 5036 | |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 5037 | // case_block: "case" patterns guard? ':' block | invalid_case_block |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 5038 | static match_case_ty |
| 5039 | case_block_rule(Parser *p) |
| 5040 | { |
| 5041 | D(p->level++); |
| 5042 | if (p->error_indicator) { |
| 5043 | D(p->level--); |
| 5044 | return NULL; |
| 5045 | } |
| 5046 | match_case_ty _res = NULL; |
| 5047 | int _mark = p->mark; |
| 5048 | { // "case" patterns guard? ':' block |
| 5049 | if (p->error_indicator) { |
| 5050 | D(p->level--); |
| 5051 | return NULL; |
| 5052 | } |
| 5053 | D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); |
| 5054 | expr_ty _keyword; |
| 5055 | Token * _literal; |
| 5056 | asdl_stmt_seq* body; |
| 5057 | void *guard; |
| 5058 | expr_ty pattern; |
| 5059 | if ( |
| 5060 | (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' |
| 5061 | && |
| 5062 | (pattern = patterns_rule(p)) // patterns |
| 5063 | && |
| 5064 | (guard = guard_rule(p), 1) // guard? |
| 5065 | && |
| 5066 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 5067 | && |
| 5068 | (body = block_rule(p)) // block |
| 5069 | ) |
| 5070 | { |
| 5071 | D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); |
| 5072 | _res = _Py_match_case ( pattern , guard , body , p -> arena ); |
| 5073 | if (_res == NULL && PyErr_Occurred()) { |
| 5074 | p->error_indicator = 1; |
| 5075 | D(p->level--); |
| 5076 | return NULL; |
| 5077 | } |
| 5078 | goto done; |
| 5079 | } |
| 5080 | p->mark = _mark; |
| 5081 | D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 5082 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' block")); |
| 5083 | } |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 5084 | if (p->call_invalid_rules) { // invalid_case_block |
| 5085 | if (p->error_indicator) { |
| 5086 | D(p->level--); |
| 5087 | return NULL; |
| 5088 | } |
| 5089 | D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_case_block")); |
| 5090 | void *invalid_case_block_var; |
| 5091 | if ( |
| 5092 | (invalid_case_block_var = invalid_case_block_rule(p)) // invalid_case_block |
| 5093 | ) |
| 5094 | { |
| 5095 | D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_case_block")); |
| 5096 | _res = invalid_case_block_var; |
| 5097 | goto done; |
| 5098 | } |
| 5099 | p->mark = _mark; |
| 5100 | D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 5101 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_case_block")); |
| 5102 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 5103 | _res = NULL; |
| 5104 | done: |
| 5105 | D(p->level--); |
| 5106 | return _res; |
| 5107 | } |
| 5108 | |
| 5109 | // guard: 'if' named_expression |
| 5110 | static expr_ty |
| 5111 | guard_rule(Parser *p) |
| 5112 | { |
| 5113 | D(p->level++); |
| 5114 | if (p->error_indicator) { |
| 5115 | D(p->level--); |
| 5116 | return NULL; |
| 5117 | } |
| 5118 | expr_ty _res = NULL; |
| 5119 | int _mark = p->mark; |
| 5120 | { // 'if' named_expression |
| 5121 | if (p->error_indicator) { |
| 5122 | D(p->level--); |
| 5123 | return NULL; |
| 5124 | } |
| 5125 | D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); |
| 5126 | Token * _keyword; |
| 5127 | expr_ty guard; |
| 5128 | if ( |
| 5129 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 5130 | && |
| 5131 | (guard = named_expression_rule(p)) // named_expression |
| 5132 | ) |
| 5133 | { |
| 5134 | D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); |
| 5135 | _res = guard; |
| 5136 | if (_res == NULL && PyErr_Occurred()) { |
| 5137 | p->error_indicator = 1; |
| 5138 | D(p->level--); |
| 5139 | return NULL; |
| 5140 | } |
| 5141 | goto done; |
| 5142 | } |
| 5143 | p->mark = _mark; |
| 5144 | D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ', |
| 5145 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression")); |
| 5146 | } |
| 5147 | _res = NULL; |
| 5148 | done: |
| 5149 | D(p->level--); |
| 5150 | return _res; |
| 5151 | } |
| 5152 | |
| 5153 | // patterns: open_sequence_pattern | pattern |
| 5154 | static expr_ty |
| 5155 | patterns_rule(Parser *p) |
| 5156 | { |
| 5157 | D(p->level++); |
| 5158 | if (p->error_indicator) { |
| 5159 | D(p->level--); |
| 5160 | return NULL; |
| 5161 | } |
| 5162 | expr_ty _res = NULL; |
| 5163 | int _mark = p->mark; |
| 5164 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5165 | p->error_indicator = 1; |
| 5166 | D(p->level--); |
| 5167 | return NULL; |
| 5168 | } |
| 5169 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5170 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5171 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5172 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5173 | { // open_sequence_pattern |
| 5174 | if (p->error_indicator) { |
| 5175 | D(p->level--); |
| 5176 | return NULL; |
| 5177 | } |
| 5178 | D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); |
| 5179 | asdl_expr_seq* values; |
| 5180 | if ( |
| 5181 | (values = (asdl_expr_seq*)open_sequence_pattern_rule(p)) // open_sequence_pattern |
| 5182 | ) |
| 5183 | { |
| 5184 | D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); |
| 5185 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5186 | if (_token == NULL) { |
| 5187 | D(p->level--); |
| 5188 | return NULL; |
| 5189 | } |
| 5190 | int _end_lineno = _token->end_lineno; |
| 5191 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5192 | int _end_col_offset = _token->end_col_offset; |
| 5193 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5194 | _res = _Py_Tuple ( values , Load , EXTRA ); |
| 5195 | if (_res == NULL && PyErr_Occurred()) { |
| 5196 | p->error_indicator = 1; |
| 5197 | D(p->level--); |
| 5198 | return NULL; |
| 5199 | } |
| 5200 | goto done; |
| 5201 | } |
| 5202 | p->mark = _mark; |
| 5203 | D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', |
| 5204 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "open_sequence_pattern")); |
| 5205 | } |
| 5206 | { // pattern |
| 5207 | if (p->error_indicator) { |
| 5208 | D(p->level--); |
| 5209 | return NULL; |
| 5210 | } |
| 5211 | D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); |
| 5212 | expr_ty pattern_var; |
| 5213 | if ( |
| 5214 | (pattern_var = pattern_rule(p)) // pattern |
| 5215 | ) |
| 5216 | { |
| 5217 | D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); |
| 5218 | _res = pattern_var; |
| 5219 | goto done; |
| 5220 | } |
| 5221 | p->mark = _mark; |
| 5222 | D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', |
| 5223 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); |
| 5224 | } |
| 5225 | _res = NULL; |
| 5226 | done: |
| 5227 | D(p->level--); |
| 5228 | return _res; |
| 5229 | } |
| 5230 | |
| 5231 | // pattern: as_pattern | or_pattern |
| 5232 | static expr_ty |
| 5233 | pattern_rule(Parser *p) |
| 5234 | { |
| 5235 | D(p->level++); |
| 5236 | if (p->error_indicator) { |
| 5237 | D(p->level--); |
| 5238 | return NULL; |
| 5239 | } |
| 5240 | expr_ty _res = NULL; |
| 5241 | int _mark = p->mark; |
| 5242 | { // as_pattern |
| 5243 | if (p->error_indicator) { |
| 5244 | D(p->level--); |
| 5245 | return NULL; |
| 5246 | } |
| 5247 | D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "as_pattern")); |
| 5248 | expr_ty as_pattern_var; |
| 5249 | if ( |
| 5250 | (as_pattern_var = as_pattern_rule(p)) // as_pattern |
| 5251 | ) |
| 5252 | { |
| 5253 | D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "as_pattern")); |
| 5254 | _res = as_pattern_var; |
| 5255 | goto done; |
| 5256 | } |
| 5257 | p->mark = _mark; |
| 5258 | D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5259 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "as_pattern")); |
| 5260 | } |
| 5261 | { // or_pattern |
| 5262 | if (p->error_indicator) { |
| 5263 | D(p->level--); |
| 5264 | return NULL; |
| 5265 | } |
| 5266 | D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern")); |
| 5267 | expr_ty or_pattern_var; |
| 5268 | if ( |
| 5269 | (or_pattern_var = or_pattern_rule(p)) // or_pattern |
| 5270 | ) |
| 5271 | { |
| 5272 | D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern")); |
| 5273 | _res = or_pattern_var; |
| 5274 | goto done; |
| 5275 | } |
| 5276 | p->mark = _mark; |
| 5277 | D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5278 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern")); |
| 5279 | } |
| 5280 | _res = NULL; |
| 5281 | done: |
| 5282 | D(p->level--); |
| 5283 | return _res; |
| 5284 | } |
| 5285 | |
| 5286 | // as_pattern: or_pattern 'as' capture_pattern |
| 5287 | static expr_ty |
| 5288 | as_pattern_rule(Parser *p) |
| 5289 | { |
| 5290 | D(p->level++); |
| 5291 | if (p->error_indicator) { |
| 5292 | D(p->level--); |
| 5293 | return NULL; |
| 5294 | } |
| 5295 | expr_ty _res = NULL; |
| 5296 | int _mark = p->mark; |
| 5297 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5298 | p->error_indicator = 1; |
| 5299 | D(p->level--); |
| 5300 | return NULL; |
| 5301 | } |
| 5302 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5303 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5304 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5305 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5306 | { // or_pattern 'as' capture_pattern |
| 5307 | if (p->error_indicator) { |
| 5308 | D(p->level--); |
| 5309 | return NULL; |
| 5310 | } |
| 5311 | D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' capture_pattern")); |
| 5312 | Token * _keyword; |
| 5313 | expr_ty pattern; |
| 5314 | expr_ty target; |
| 5315 | if ( |
| 5316 | (pattern = or_pattern_rule(p)) // or_pattern |
| 5317 | && |
| 5318 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 5319 | && |
| 5320 | (target = capture_pattern_rule(p)) // capture_pattern |
| 5321 | ) |
| 5322 | { |
| 5323 | D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' capture_pattern")); |
| 5324 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5325 | if (_token == NULL) { |
| 5326 | D(p->level--); |
| 5327 | return NULL; |
| 5328 | } |
| 5329 | int _end_lineno = _token->end_lineno; |
| 5330 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5331 | int _end_col_offset = _token->end_col_offset; |
| 5332 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5333 | _res = _Py_MatchAs ( pattern , target -> v . Name . id , EXTRA ); |
| 5334 | if (_res == NULL && PyErr_Occurred()) { |
| 5335 | p->error_indicator = 1; |
| 5336 | D(p->level--); |
| 5337 | return NULL; |
| 5338 | } |
| 5339 | goto done; |
| 5340 | } |
| 5341 | p->mark = _mark; |
| 5342 | D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5343 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' capture_pattern")); |
| 5344 | } |
| 5345 | _res = NULL; |
| 5346 | done: |
| 5347 | D(p->level--); |
| 5348 | return _res; |
| 5349 | } |
| 5350 | |
| 5351 | // or_pattern: '|'.closed_pattern+ |
| 5352 | static expr_ty |
| 5353 | or_pattern_rule(Parser *p) |
| 5354 | { |
| 5355 | D(p->level++); |
| 5356 | if (p->error_indicator) { |
| 5357 | D(p->level--); |
| 5358 | return NULL; |
| 5359 | } |
| 5360 | expr_ty _res = NULL; |
| 5361 | int _mark = p->mark; |
| 5362 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5363 | p->error_indicator = 1; |
| 5364 | D(p->level--); |
| 5365 | return NULL; |
| 5366 | } |
| 5367 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5368 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5369 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5370 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5371 | { // '|'.closed_pattern+ |
| 5372 | if (p->error_indicator) { |
| 5373 | D(p->level--); |
| 5374 | return NULL; |
| 5375 | } |
| 5376 | D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); |
| 5377 | asdl_expr_seq* patterns; |
| 5378 | if ( |
| 5379 | (patterns = (asdl_expr_seq*)_gather_51_rule(p)) // '|'.closed_pattern+ |
| 5380 | ) |
| 5381 | { |
| 5382 | D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); |
| 5383 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5384 | if (_token == NULL) { |
| 5385 | D(p->level--); |
| 5386 | return NULL; |
| 5387 | } |
| 5388 | int _end_lineno = _token->end_lineno; |
| 5389 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5390 | int _end_col_offset = _token->end_col_offset; |
| 5391 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5392 | _res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _Py_MatchOr ( patterns , EXTRA ); |
| 5393 | if (_res == NULL && PyErr_Occurred()) { |
| 5394 | p->error_indicator = 1; |
| 5395 | D(p->level--); |
| 5396 | return NULL; |
| 5397 | } |
| 5398 | goto done; |
| 5399 | } |
| 5400 | p->mark = _mark; |
| 5401 | D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5402 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+")); |
| 5403 | } |
| 5404 | _res = NULL; |
| 5405 | done: |
| 5406 | D(p->level--); |
| 5407 | return _res; |
| 5408 | } |
| 5409 | |
| 5410 | // closed_pattern: |
| 5411 | // | literal_pattern |
| 5412 | // | capture_pattern |
| 5413 | // | wildcard_pattern |
| 5414 | // | value_pattern |
| 5415 | // | group_pattern |
| 5416 | // | sequence_pattern |
| 5417 | // | mapping_pattern |
| 5418 | // | class_pattern |
| 5419 | static expr_ty |
| 5420 | closed_pattern_rule(Parser *p) |
| 5421 | { |
| 5422 | D(p->level++); |
| 5423 | if (p->error_indicator) { |
| 5424 | D(p->level--); |
| 5425 | return NULL; |
| 5426 | } |
| 5427 | expr_ty _res = NULL; |
| 5428 | int _mark = p->mark; |
| 5429 | { // literal_pattern |
| 5430 | if (p->error_indicator) { |
| 5431 | D(p->level--); |
| 5432 | return NULL; |
| 5433 | } |
| 5434 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
| 5435 | expr_ty literal_pattern_var; |
| 5436 | if ( |
| 5437 | (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern |
| 5438 | ) |
| 5439 | { |
| 5440 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
| 5441 | _res = literal_pattern_var; |
| 5442 | goto done; |
| 5443 | } |
| 5444 | p->mark = _mark; |
| 5445 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5446 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); |
| 5447 | } |
| 5448 | { // capture_pattern |
| 5449 | if (p->error_indicator) { |
| 5450 | D(p->level--); |
| 5451 | return NULL; |
| 5452 | } |
| 5453 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
| 5454 | expr_ty capture_pattern_var; |
| 5455 | if ( |
| 5456 | (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern |
| 5457 | ) |
| 5458 | { |
| 5459 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
| 5460 | _res = capture_pattern_var; |
| 5461 | goto done; |
| 5462 | } |
| 5463 | p->mark = _mark; |
| 5464 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5465 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern")); |
| 5466 | } |
| 5467 | { // wildcard_pattern |
| 5468 | if (p->error_indicator) { |
| 5469 | D(p->level--); |
| 5470 | return NULL; |
| 5471 | } |
| 5472 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
| 5473 | expr_ty wildcard_pattern_var; |
| 5474 | if ( |
| 5475 | (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern |
| 5476 | ) |
| 5477 | { |
| 5478 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
| 5479 | _res = wildcard_pattern_var; |
| 5480 | goto done; |
| 5481 | } |
| 5482 | p->mark = _mark; |
| 5483 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5484 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern")); |
| 5485 | } |
| 5486 | { // value_pattern |
| 5487 | if (p->error_indicator) { |
| 5488 | D(p->level--); |
| 5489 | return NULL; |
| 5490 | } |
| 5491 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
| 5492 | expr_ty value_pattern_var; |
| 5493 | if ( |
| 5494 | (value_pattern_var = value_pattern_rule(p)) // value_pattern |
| 5495 | ) |
| 5496 | { |
| 5497 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
| 5498 | _res = value_pattern_var; |
| 5499 | goto done; |
| 5500 | } |
| 5501 | p->mark = _mark; |
| 5502 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5503 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern")); |
| 5504 | } |
| 5505 | { // group_pattern |
| 5506 | if (p->error_indicator) { |
| 5507 | D(p->level--); |
| 5508 | return NULL; |
| 5509 | } |
| 5510 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group_pattern")); |
| 5511 | expr_ty group_pattern_var; |
| 5512 | if ( |
| 5513 | (group_pattern_var = group_pattern_rule(p)) // group_pattern |
| 5514 | ) |
| 5515 | { |
| 5516 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group_pattern")); |
| 5517 | _res = group_pattern_var; |
| 5518 | goto done; |
| 5519 | } |
| 5520 | p->mark = _mark; |
| 5521 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5522 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group_pattern")); |
| 5523 | } |
| 5524 | { // sequence_pattern |
| 5525 | if (p->error_indicator) { |
| 5526 | D(p->level--); |
| 5527 | return NULL; |
| 5528 | } |
| 5529 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); |
| 5530 | expr_ty sequence_pattern_var; |
| 5531 | if ( |
| 5532 | (sequence_pattern_var = sequence_pattern_rule(p)) // sequence_pattern |
| 5533 | ) |
| 5534 | { |
| 5535 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); |
| 5536 | _res = sequence_pattern_var; |
| 5537 | goto done; |
| 5538 | } |
| 5539 | p->mark = _mark; |
| 5540 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5541 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sequence_pattern")); |
| 5542 | } |
| 5543 | { // mapping_pattern |
| 5544 | if (p->error_indicator) { |
| 5545 | D(p->level--); |
| 5546 | return NULL; |
| 5547 | } |
| 5548 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); |
| 5549 | expr_ty mapping_pattern_var; |
| 5550 | if ( |
| 5551 | (mapping_pattern_var = mapping_pattern_rule(p)) // mapping_pattern |
| 5552 | ) |
| 5553 | { |
| 5554 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); |
| 5555 | _res = mapping_pattern_var; |
| 5556 | goto done; |
| 5557 | } |
| 5558 | p->mark = _mark; |
| 5559 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5560 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "mapping_pattern")); |
| 5561 | } |
| 5562 | { // class_pattern |
| 5563 | if (p->error_indicator) { |
| 5564 | D(p->level--); |
| 5565 | return NULL; |
| 5566 | } |
| 5567 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_pattern")); |
| 5568 | expr_ty class_pattern_var; |
| 5569 | if ( |
| 5570 | (class_pattern_var = class_pattern_rule(p)) // class_pattern |
| 5571 | ) |
| 5572 | { |
| 5573 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_pattern")); |
| 5574 | _res = class_pattern_var; |
| 5575 | goto done; |
| 5576 | } |
| 5577 | p->mark = _mark; |
| 5578 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5579 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_pattern")); |
| 5580 | } |
| 5581 | _res = NULL; |
| 5582 | done: |
| 5583 | D(p->level--); |
| 5584 | return _res; |
| 5585 | } |
| 5586 | |
| 5587 | // literal_pattern: |
| 5588 | // | signed_number !('+' | '-') |
| 5589 | // | signed_number '+' NUMBER |
| 5590 | // | signed_number '-' NUMBER |
| 5591 | // | strings |
| 5592 | // | 'None' |
| 5593 | // | 'True' |
| 5594 | // | 'False' |
| 5595 | static expr_ty |
| 5596 | literal_pattern_rule(Parser *p) |
| 5597 | { |
| 5598 | D(p->level++); |
| 5599 | if (p->error_indicator) { |
| 5600 | D(p->level--); |
| 5601 | return NULL; |
| 5602 | } |
| 5603 | expr_ty _res = NULL; |
| 5604 | int _mark = p->mark; |
| 5605 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5606 | p->error_indicator = 1; |
| 5607 | D(p->level--); |
| 5608 | return NULL; |
| 5609 | } |
| 5610 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5611 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5612 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5613 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5614 | { // signed_number !('+' | '-') |
| 5615 | if (p->error_indicator) { |
| 5616 | D(p->level--); |
| 5617 | return NULL; |
| 5618 | } |
| 5619 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); |
| 5620 | expr_ty signed_number_var; |
| 5621 | if ( |
| 5622 | (signed_number_var = signed_number_rule(p)) // signed_number |
| 5623 | && |
| 5624 | _PyPegen_lookahead(0, _tmp_53_rule, p) |
| 5625 | ) |
| 5626 | { |
| 5627 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); |
| 5628 | _res = signed_number_var; |
| 5629 | goto done; |
| 5630 | } |
| 5631 | p->mark = _mark; |
| 5632 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5633 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')")); |
| 5634 | } |
| 5635 | { // signed_number '+' NUMBER |
| 5636 | if (p->error_indicator) { |
| 5637 | D(p->level--); |
| 5638 | return NULL; |
| 5639 | } |
| 5640 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number '+' NUMBER")); |
| 5641 | Token * _literal; |
| 5642 | expr_ty imag; |
| 5643 | expr_ty real; |
| 5644 | if ( |
| 5645 | (real = signed_number_rule(p)) // signed_number |
| 5646 | && |
| 5647 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
| 5648 | && |
| 5649 | (imag = _PyPegen_number_token(p)) // NUMBER |
| 5650 | ) |
| 5651 | { |
| 5652 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number '+' NUMBER")); |
| 5653 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5654 | if (_token == NULL) { |
| 5655 | D(p->level--); |
| 5656 | return NULL; |
| 5657 | } |
| 5658 | int _end_lineno = _token->end_lineno; |
| 5659 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5660 | int _end_col_offset = _token->end_col_offset; |
| 5661 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5662 | _res = _Py_BinOp ( real , Add , imag , EXTRA ); |
| 5663 | if (_res == NULL && PyErr_Occurred()) { |
| 5664 | p->error_indicator = 1; |
| 5665 | D(p->level--); |
| 5666 | return NULL; |
| 5667 | } |
| 5668 | goto done; |
| 5669 | } |
| 5670 | p->mark = _mark; |
| 5671 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5672 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number '+' NUMBER")); |
| 5673 | } |
| 5674 | { // signed_number '-' NUMBER |
| 5675 | if (p->error_indicator) { |
| 5676 | D(p->level--); |
| 5677 | return NULL; |
| 5678 | } |
| 5679 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number '-' NUMBER")); |
| 5680 | Token * _literal; |
| 5681 | expr_ty imag; |
| 5682 | expr_ty real; |
| 5683 | if ( |
| 5684 | (real = signed_number_rule(p)) // signed_number |
| 5685 | && |
| 5686 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 5687 | && |
| 5688 | (imag = _PyPegen_number_token(p)) // NUMBER |
| 5689 | ) |
| 5690 | { |
| 5691 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number '-' NUMBER")); |
| 5692 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5693 | if (_token == NULL) { |
| 5694 | D(p->level--); |
| 5695 | return NULL; |
| 5696 | } |
| 5697 | int _end_lineno = _token->end_lineno; |
| 5698 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5699 | int _end_col_offset = _token->end_col_offset; |
| 5700 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5701 | _res = _Py_BinOp ( real , Sub , imag , EXTRA ); |
| 5702 | if (_res == NULL && PyErr_Occurred()) { |
| 5703 | p->error_indicator = 1; |
| 5704 | D(p->level--); |
| 5705 | return NULL; |
| 5706 | } |
| 5707 | goto done; |
| 5708 | } |
| 5709 | p->mark = _mark; |
| 5710 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5711 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number '-' NUMBER")); |
| 5712 | } |
| 5713 | { // strings |
| 5714 | if (p->error_indicator) { |
| 5715 | D(p->level--); |
| 5716 | return NULL; |
| 5717 | } |
| 5718 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings")); |
| 5719 | expr_ty strings_var; |
| 5720 | if ( |
| 5721 | (strings_var = strings_rule(p)) // strings |
| 5722 | ) |
| 5723 | { |
| 5724 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings")); |
| 5725 | _res = strings_var; |
| 5726 | goto done; |
| 5727 | } |
| 5728 | p->mark = _mark; |
| 5729 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5730 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings")); |
| 5731 | } |
| 5732 | { // 'None' |
| 5733 | if (p->error_indicator) { |
| 5734 | D(p->level--); |
| 5735 | return NULL; |
| 5736 | } |
| 5737 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
| 5738 | Token * _keyword; |
| 5739 | if ( |
| 5740 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
| 5741 | ) |
| 5742 | { |
| 5743 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
| 5744 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5745 | if (_token == NULL) { |
| 5746 | D(p->level--); |
| 5747 | return NULL; |
| 5748 | } |
| 5749 | int _end_lineno = _token->end_lineno; |
| 5750 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5751 | int _end_col_offset = _token->end_col_offset; |
| 5752 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5753 | _res = _Py_Constant ( Py_None , NULL , EXTRA ); |
| 5754 | if (_res == NULL && PyErr_Occurred()) { |
| 5755 | p->error_indicator = 1; |
| 5756 | D(p->level--); |
| 5757 | return NULL; |
| 5758 | } |
| 5759 | goto done; |
| 5760 | } |
| 5761 | p->mark = _mark; |
| 5762 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5763 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
| 5764 | } |
| 5765 | { // 'True' |
| 5766 | if (p->error_indicator) { |
| 5767 | D(p->level--); |
| 5768 | return NULL; |
| 5769 | } |
| 5770 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
| 5771 | Token * _keyword; |
| 5772 | if ( |
| 5773 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
| 5774 | ) |
| 5775 | { |
| 5776 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
| 5777 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5778 | if (_token == NULL) { |
| 5779 | D(p->level--); |
| 5780 | return NULL; |
| 5781 | } |
| 5782 | int _end_lineno = _token->end_lineno; |
| 5783 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5784 | int _end_col_offset = _token->end_col_offset; |
| 5785 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5786 | _res = _Py_Constant ( Py_True , NULL , EXTRA ); |
| 5787 | if (_res == NULL && PyErr_Occurred()) { |
| 5788 | p->error_indicator = 1; |
| 5789 | D(p->level--); |
| 5790 | return NULL; |
| 5791 | } |
| 5792 | goto done; |
| 5793 | } |
| 5794 | p->mark = _mark; |
| 5795 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5796 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
| 5797 | } |
| 5798 | { // 'False' |
| 5799 | if (p->error_indicator) { |
| 5800 | D(p->level--); |
| 5801 | return NULL; |
| 5802 | } |
| 5803 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
| 5804 | Token * _keyword; |
| 5805 | if ( |
| 5806 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
| 5807 | ) |
| 5808 | { |
| 5809 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
| 5810 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5811 | if (_token == NULL) { |
| 5812 | D(p->level--); |
| 5813 | return NULL; |
| 5814 | } |
| 5815 | int _end_lineno = _token->end_lineno; |
| 5816 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5817 | int _end_col_offset = _token->end_col_offset; |
| 5818 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5819 | _res = _Py_Constant ( Py_False , NULL , EXTRA ); |
| 5820 | if (_res == NULL && PyErr_Occurred()) { |
| 5821 | p->error_indicator = 1; |
| 5822 | D(p->level--); |
| 5823 | return NULL; |
| 5824 | } |
| 5825 | goto done; |
| 5826 | } |
| 5827 | p->mark = _mark; |
| 5828 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5829 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
| 5830 | } |
| 5831 | _res = NULL; |
| 5832 | done: |
| 5833 | D(p->level--); |
| 5834 | return _res; |
| 5835 | } |
| 5836 | |
| 5837 | // signed_number: NUMBER | '-' NUMBER |
| 5838 | static expr_ty |
| 5839 | signed_number_rule(Parser *p) |
| 5840 | { |
| 5841 | D(p->level++); |
| 5842 | if (p->error_indicator) { |
| 5843 | D(p->level--); |
| 5844 | return NULL; |
| 5845 | } |
| 5846 | expr_ty _res = NULL; |
| 5847 | int _mark = p->mark; |
| 5848 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5849 | p->error_indicator = 1; |
| 5850 | D(p->level--); |
| 5851 | return NULL; |
| 5852 | } |
| 5853 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5854 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5855 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5856 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5857 | { // NUMBER |
| 5858 | if (p->error_indicator) { |
| 5859 | D(p->level--); |
| 5860 | return NULL; |
| 5861 | } |
| 5862 | D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
| 5863 | expr_ty number_var; |
| 5864 | if ( |
| 5865 | (number_var = _PyPegen_number_token(p)) // NUMBER |
| 5866 | ) |
| 5867 | { |
| 5868 | D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
| 5869 | _res = number_var; |
| 5870 | goto done; |
| 5871 | } |
| 5872 | p->mark = _mark; |
| 5873 | D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', |
| 5874 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
| 5875 | } |
| 5876 | { // '-' NUMBER |
| 5877 | if (p->error_indicator) { |
| 5878 | D(p->level--); |
| 5879 | return NULL; |
| 5880 | } |
| 5881 | D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); |
| 5882 | Token * _literal; |
| 5883 | expr_ty number; |
| 5884 | if ( |
| 5885 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 5886 | && |
| 5887 | (number = _PyPegen_number_token(p)) // NUMBER |
| 5888 | ) |
| 5889 | { |
| 5890 | D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); |
| 5891 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5892 | if (_token == NULL) { |
| 5893 | D(p->level--); |
| 5894 | return NULL; |
| 5895 | } |
| 5896 | int _end_lineno = _token->end_lineno; |
| 5897 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5898 | int _end_col_offset = _token->end_col_offset; |
| 5899 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5900 | _res = _Py_UnaryOp ( USub , number , EXTRA ); |
| 5901 | if (_res == NULL && PyErr_Occurred()) { |
| 5902 | p->error_indicator = 1; |
| 5903 | D(p->level--); |
| 5904 | return NULL; |
| 5905 | } |
| 5906 | goto done; |
| 5907 | } |
| 5908 | p->mark = _mark; |
| 5909 | D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', |
| 5910 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER")); |
| 5911 | } |
| 5912 | _res = NULL; |
| 5913 | done: |
| 5914 | D(p->level--); |
| 5915 | return _res; |
| 5916 | } |
| 5917 | |
| 5918 | // capture_pattern: !"_" NAME !('.' | '(' | '=') |
| 5919 | static expr_ty |
| 5920 | capture_pattern_rule(Parser *p) |
| 5921 | { |
| 5922 | D(p->level++); |
| 5923 | if (p->error_indicator) { |
| 5924 | D(p->level--); |
| 5925 | return NULL; |
| 5926 | } |
| 5927 | expr_ty _res = NULL; |
| 5928 | int _mark = p->mark; |
| 5929 | { // !"_" NAME !('.' | '(' | '=') |
| 5930 | if (p->error_indicator) { |
| 5931 | D(p->level--); |
| 5932 | return NULL; |
| 5933 | } |
| 5934 | D(fprintf(stderr, "%*c> capture_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
| 5935 | expr_ty name; |
| 5936 | if ( |
| 5937 | _PyPegen_lookahead_with_string(0, _PyPegen_expect_soft_keyword, p, "_") |
| 5938 | && |
| 5939 | (name = _PyPegen_name_token(p)) // NAME |
| 5940 | && |
| 5941 | _PyPegen_lookahead(0, _tmp_54_rule, p) |
| 5942 | ) |
| 5943 | { |
| 5944 | D(fprintf(stderr, "%*c+ capture_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
| 5945 | _res = _PyPegen_set_expr_context ( p , name , Store ); |
| 5946 | if (_res == NULL && PyErr_Occurred()) { |
| 5947 | p->error_indicator = 1; |
| 5948 | D(p->level--); |
| 5949 | return NULL; |
| 5950 | } |
| 5951 | goto done; |
| 5952 | } |
| 5953 | p->mark = _mark; |
| 5954 | D(fprintf(stderr, "%*c%s capture_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 5955 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
| 5956 | } |
| 5957 | _res = NULL; |
| 5958 | done: |
| 5959 | D(p->level--); |
| 5960 | return _res; |
| 5961 | } |
| 5962 | |
| 5963 | // wildcard_pattern: "_" |
| 5964 | static expr_ty |
| 5965 | wildcard_pattern_rule(Parser *p) |
| 5966 | { |
| 5967 | D(p->level++); |
| 5968 | if (p->error_indicator) { |
| 5969 | D(p->level--); |
| 5970 | return NULL; |
| 5971 | } |
| 5972 | expr_ty _res = NULL; |
| 5973 | int _mark = p->mark; |
| 5974 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5975 | p->error_indicator = 1; |
| 5976 | D(p->level--); |
| 5977 | return NULL; |
| 5978 | } |
| 5979 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5980 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5981 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5982 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 5983 | { // "_" |
| 5984 | if (p->error_indicator) { |
| 5985 | D(p->level--); |
| 5986 | return NULL; |
| 5987 | } |
| 5988 | D(fprintf(stderr, "%*c> wildcard_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"_\"")); |
| 5989 | expr_ty _keyword; |
| 5990 | if ( |
| 5991 | (_keyword = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"' |
| 5992 | ) |
| 5993 | { |
| 5994 | D(fprintf(stderr, "%*c+ wildcard_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"_\"")); |
| 5995 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5996 | if (_token == NULL) { |
| 5997 | D(p->level--); |
| 5998 | return NULL; |
| 5999 | } |
| 6000 | int _end_lineno = _token->end_lineno; |
| 6001 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6002 | int _end_col_offset = _token->end_col_offset; |
| 6003 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6004 | _res = _Py_Name ( CHECK ( PyObject * , _PyPegen_new_identifier ( p , "_" ) ) , Store , EXTRA ); |
| 6005 | if (_res == NULL && PyErr_Occurred()) { |
| 6006 | p->error_indicator = 1; |
| 6007 | D(p->level--); |
| 6008 | return NULL; |
| 6009 | } |
| 6010 | goto done; |
| 6011 | } |
| 6012 | p->mark = _mark; |
| 6013 | D(fprintf(stderr, "%*c%s wildcard_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6014 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"_\"")); |
| 6015 | } |
| 6016 | _res = NULL; |
| 6017 | done: |
| 6018 | D(p->level--); |
| 6019 | return _res; |
| 6020 | } |
| 6021 | |
| 6022 | // value_pattern: attr !('.' | '(' | '=') |
| 6023 | static expr_ty |
| 6024 | value_pattern_rule(Parser *p) |
| 6025 | { |
| 6026 | D(p->level++); |
| 6027 | if (p->error_indicator) { |
| 6028 | D(p->level--); |
| 6029 | return NULL; |
| 6030 | } |
| 6031 | expr_ty _res = NULL; |
| 6032 | int _mark = p->mark; |
| 6033 | { // attr !('.' | '(' | '=') |
| 6034 | if (p->error_indicator) { |
| 6035 | D(p->level--); |
| 6036 | return NULL; |
| 6037 | } |
| 6038 | D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); |
| 6039 | expr_ty attr; |
| 6040 | if ( |
| 6041 | (attr = attr_rule(p)) // attr |
| 6042 | && |
| 6043 | _PyPegen_lookahead(0, _tmp_55_rule, p) |
| 6044 | ) |
| 6045 | { |
| 6046 | D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); |
| 6047 | _res = attr; |
| 6048 | if (_res == NULL && PyErr_Occurred()) { |
| 6049 | p->error_indicator = 1; |
| 6050 | D(p->level--); |
| 6051 | return NULL; |
| 6052 | } |
| 6053 | goto done; |
| 6054 | } |
| 6055 | p->mark = _mark; |
| 6056 | D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6057 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')")); |
| 6058 | } |
| 6059 | _res = NULL; |
| 6060 | done: |
| 6061 | D(p->level--); |
| 6062 | return _res; |
| 6063 | } |
| 6064 | |
| 6065 | // Left-recursive |
| 6066 | // attr: name_or_attr '.' NAME |
| 6067 | static expr_ty attr_raw(Parser *); |
| 6068 | static expr_ty |
| 6069 | attr_rule(Parser *p) |
| 6070 | { |
| 6071 | D(p->level++); |
| 6072 | expr_ty _res = NULL; |
| 6073 | if (_PyPegen_is_memoized(p, attr_type, &_res)) { |
| 6074 | D(p->level--); |
| 6075 | return _res; |
| 6076 | } |
| 6077 | int _mark = p->mark; |
| 6078 | int _resmark = p->mark; |
| 6079 | while (1) { |
| 6080 | int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res); |
| 6081 | if (tmpvar_1) { |
| 6082 | D(p->level--); |
| 6083 | return _res; |
| 6084 | } |
| 6085 | p->mark = _mark; |
| 6086 | void *_raw = attr_raw(p); |
| 6087 | if (p->error_indicator) |
| 6088 | return NULL; |
| 6089 | if (_raw == NULL || p->mark <= _resmark) |
| 6090 | break; |
| 6091 | _resmark = p->mark; |
| 6092 | _res = _raw; |
| 6093 | } |
| 6094 | p->mark = _resmark; |
| 6095 | D(p->level--); |
| 6096 | return _res; |
| 6097 | } |
| 6098 | static expr_ty |
| 6099 | attr_raw(Parser *p) |
| 6100 | { |
| 6101 | D(p->level++); |
| 6102 | if (p->error_indicator) { |
| 6103 | D(p->level--); |
| 6104 | return NULL; |
| 6105 | } |
| 6106 | expr_ty _res = NULL; |
| 6107 | int _mark = p->mark; |
| 6108 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6109 | p->error_indicator = 1; |
| 6110 | D(p->level--); |
| 6111 | return NULL; |
| 6112 | } |
| 6113 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6114 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6115 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6116 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6117 | { // name_or_attr '.' NAME |
| 6118 | if (p->error_indicator) { |
| 6119 | D(p->level--); |
| 6120 | return NULL; |
| 6121 | } |
| 6122 | D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); |
| 6123 | Token * _literal; |
| 6124 | expr_ty attr; |
| 6125 | expr_ty value; |
| 6126 | if ( |
| 6127 | (value = name_or_attr_rule(p)) // name_or_attr |
| 6128 | && |
| 6129 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 6130 | && |
| 6131 | (attr = _PyPegen_name_token(p)) // NAME |
| 6132 | ) |
| 6133 | { |
| 6134 | D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); |
| 6135 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6136 | if (_token == NULL) { |
| 6137 | D(p->level--); |
| 6138 | return NULL; |
| 6139 | } |
| 6140 | int _end_lineno = _token->end_lineno; |
| 6141 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6142 | int _end_col_offset = _token->end_col_offset; |
| 6143 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6144 | _res = _Py_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); |
| 6145 | if (_res == NULL && PyErr_Occurred()) { |
| 6146 | p->error_indicator = 1; |
| 6147 | D(p->level--); |
| 6148 | return NULL; |
| 6149 | } |
| 6150 | goto done; |
| 6151 | } |
| 6152 | p->mark = _mark; |
| 6153 | D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ', |
| 6154 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME")); |
| 6155 | } |
| 6156 | _res = NULL; |
| 6157 | done: |
| 6158 | D(p->level--); |
| 6159 | return _res; |
| 6160 | } |
| 6161 | |
| 6162 | // Left-recursive |
| 6163 | // name_or_attr: attr | NAME |
| 6164 | static expr_ty |
| 6165 | name_or_attr_rule(Parser *p) |
| 6166 | { |
| 6167 | D(p->level++); |
| 6168 | if (p->error_indicator) { |
| 6169 | D(p->level--); |
| 6170 | return NULL; |
| 6171 | } |
| 6172 | expr_ty _res = NULL; |
| 6173 | int _mark = p->mark; |
| 6174 | { // attr |
| 6175 | if (p->error_indicator) { |
| 6176 | D(p->level--); |
| 6177 | return NULL; |
| 6178 | } |
| 6179 | D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); |
| 6180 | expr_ty attr_var; |
| 6181 | if ( |
| 6182 | (attr_var = attr_rule(p)) // attr |
| 6183 | ) |
| 6184 | { |
| 6185 | D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr")); |
| 6186 | _res = attr_var; |
| 6187 | goto done; |
| 6188 | } |
| 6189 | p->mark = _mark; |
| 6190 | D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', |
| 6191 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr")); |
| 6192 | } |
| 6193 | { // NAME |
| 6194 | if (p->error_indicator) { |
| 6195 | D(p->level--); |
| 6196 | return NULL; |
| 6197 | } |
| 6198 | D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 6199 | expr_ty name_var; |
| 6200 | if ( |
| 6201 | (name_var = _PyPegen_name_token(p)) // NAME |
| 6202 | ) |
| 6203 | { |
| 6204 | D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 6205 | _res = name_var; |
| 6206 | goto done; |
| 6207 | } |
| 6208 | p->mark = _mark; |
| 6209 | D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', |
| 6210 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 6211 | } |
| 6212 | _res = NULL; |
| 6213 | done: |
| 6214 | D(p->level--); |
| 6215 | return _res; |
| 6216 | } |
| 6217 | |
| 6218 | // group_pattern: '(' pattern ')' |
| 6219 | static expr_ty |
| 6220 | group_pattern_rule(Parser *p) |
| 6221 | { |
| 6222 | D(p->level++); |
| 6223 | if (p->error_indicator) { |
| 6224 | D(p->level--); |
| 6225 | return NULL; |
| 6226 | } |
| 6227 | expr_ty _res = NULL; |
| 6228 | int _mark = p->mark; |
| 6229 | { // '(' pattern ')' |
| 6230 | if (p->error_indicator) { |
| 6231 | D(p->level--); |
| 6232 | return NULL; |
| 6233 | } |
| 6234 | D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); |
| 6235 | Token * _literal; |
| 6236 | Token * _literal_1; |
| 6237 | expr_ty pattern; |
| 6238 | if ( |
| 6239 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6240 | && |
| 6241 | (pattern = pattern_rule(p)) // pattern |
| 6242 | && |
| 6243 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6244 | ) |
| 6245 | { |
| 6246 | D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); |
| 6247 | _res = pattern; |
| 6248 | if (_res == NULL && PyErr_Occurred()) { |
| 6249 | p->error_indicator = 1; |
| 6250 | D(p->level--); |
| 6251 | return NULL; |
| 6252 | } |
| 6253 | goto done; |
| 6254 | } |
| 6255 | p->mark = _mark; |
| 6256 | D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6257 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'")); |
| 6258 | } |
| 6259 | _res = NULL; |
| 6260 | done: |
| 6261 | D(p->level--); |
| 6262 | return _res; |
| 6263 | } |
| 6264 | |
| 6265 | // sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')' |
| 6266 | static expr_ty |
| 6267 | sequence_pattern_rule(Parser *p) |
| 6268 | { |
| 6269 | D(p->level++); |
| 6270 | if (p->error_indicator) { |
| 6271 | D(p->level--); |
| 6272 | return NULL; |
| 6273 | } |
| 6274 | expr_ty _res = NULL; |
| 6275 | int _mark = p->mark; |
| 6276 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6277 | p->error_indicator = 1; |
| 6278 | D(p->level--); |
| 6279 | return NULL; |
| 6280 | } |
| 6281 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6282 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6283 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6284 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6285 | { // '[' maybe_sequence_pattern? ']' |
| 6286 | if (p->error_indicator) { |
| 6287 | D(p->level--); |
| 6288 | return NULL; |
| 6289 | } |
| 6290 | D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
| 6291 | Token * _literal; |
| 6292 | Token * _literal_1; |
| 6293 | void *values; |
| 6294 | if ( |
| 6295 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 6296 | && |
| 6297 | (values = maybe_sequence_pattern_rule(p), 1) // maybe_sequence_pattern? |
| 6298 | && |
| 6299 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 6300 | ) |
| 6301 | { |
| 6302 | D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
| 6303 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6304 | if (_token == NULL) { |
| 6305 | D(p->level--); |
| 6306 | return NULL; |
| 6307 | } |
| 6308 | int _end_lineno = _token->end_lineno; |
| 6309 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6310 | int _end_col_offset = _token->end_col_offset; |
| 6311 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6312 | _res = _Py_List ( values , Load , EXTRA ); |
| 6313 | if (_res == NULL && PyErr_Occurred()) { |
| 6314 | p->error_indicator = 1; |
| 6315 | D(p->level--); |
| 6316 | return NULL; |
| 6317 | } |
| 6318 | goto done; |
| 6319 | } |
| 6320 | p->mark = _mark; |
| 6321 | D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6322 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
| 6323 | } |
| 6324 | { // '(' open_sequence_pattern? ')' |
| 6325 | if (p->error_indicator) { |
| 6326 | D(p->level--); |
| 6327 | return NULL; |
| 6328 | } |
| 6329 | D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
| 6330 | Token * _literal; |
| 6331 | Token * _literal_1; |
| 6332 | void *values; |
| 6333 | if ( |
| 6334 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6335 | && |
| 6336 | (values = open_sequence_pattern_rule(p), 1) // open_sequence_pattern? |
| 6337 | && |
| 6338 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6339 | ) |
| 6340 | { |
| 6341 | D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
| 6342 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6343 | if (_token == NULL) { |
| 6344 | D(p->level--); |
| 6345 | return NULL; |
| 6346 | } |
| 6347 | int _end_lineno = _token->end_lineno; |
| 6348 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6349 | int _end_col_offset = _token->end_col_offset; |
| 6350 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6351 | _res = _Py_Tuple ( values , Load , EXTRA ); |
| 6352 | if (_res == NULL && PyErr_Occurred()) { |
| 6353 | p->error_indicator = 1; |
| 6354 | D(p->level--); |
| 6355 | return NULL; |
| 6356 | } |
| 6357 | goto done; |
| 6358 | } |
| 6359 | p->mark = _mark; |
| 6360 | D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6361 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
| 6362 | } |
| 6363 | _res = NULL; |
| 6364 | done: |
| 6365 | D(p->level--); |
| 6366 | return _res; |
| 6367 | } |
| 6368 | |
| 6369 | // open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern? |
| 6370 | static asdl_seq* |
| 6371 | open_sequence_pattern_rule(Parser *p) |
| 6372 | { |
| 6373 | D(p->level++); |
| 6374 | if (p->error_indicator) { |
| 6375 | D(p->level--); |
| 6376 | return NULL; |
| 6377 | } |
| 6378 | asdl_seq* _res = NULL; |
| 6379 | int _mark = p->mark; |
| 6380 | { // maybe_star_pattern ',' maybe_sequence_pattern? |
| 6381 | if (p->error_indicator) { |
| 6382 | D(p->level--); |
| 6383 | return NULL; |
| 6384 | } |
| 6385 | D(fprintf(stderr, "%*c> open_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
| 6386 | Token * _literal; |
| 6387 | expr_ty value; |
| 6388 | void *values; |
| 6389 | if ( |
| 6390 | (value = maybe_star_pattern_rule(p)) // maybe_star_pattern |
| 6391 | && |
| 6392 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 6393 | && |
| 6394 | (values = maybe_sequence_pattern_rule(p), 1) // maybe_sequence_pattern? |
| 6395 | ) |
| 6396 | { |
| 6397 | D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
| 6398 | _res = _PyPegen_seq_insert_in_front ( p , value , values ); |
| 6399 | if (_res == NULL && PyErr_Occurred()) { |
| 6400 | p->error_indicator = 1; |
| 6401 | D(p->level--); |
| 6402 | return NULL; |
| 6403 | } |
| 6404 | goto done; |
| 6405 | } |
| 6406 | p->mark = _mark; |
| 6407 | D(fprintf(stderr, "%*c%s open_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6408 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
| 6409 | } |
| 6410 | _res = NULL; |
| 6411 | done: |
| 6412 | D(p->level--); |
| 6413 | return _res; |
| 6414 | } |
| 6415 | |
| 6416 | // maybe_sequence_pattern: ','.maybe_star_pattern+ ','? |
| 6417 | static asdl_seq* |
| 6418 | maybe_sequence_pattern_rule(Parser *p) |
| 6419 | { |
| 6420 | D(p->level++); |
| 6421 | if (p->error_indicator) { |
| 6422 | D(p->level--); |
| 6423 | return NULL; |
| 6424 | } |
| 6425 | asdl_seq* _res = NULL; |
| 6426 | int _mark = p->mark; |
| 6427 | { // ','.maybe_star_pattern+ ','? |
| 6428 | if (p->error_indicator) { |
| 6429 | D(p->level--); |
| 6430 | return NULL; |
| 6431 | } |
| 6432 | D(fprintf(stderr, "%*c> maybe_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
| 6433 | void *_opt_var; |
| 6434 | UNUSED(_opt_var); // Silence compiler warnings |
| 6435 | asdl_seq * values; |
| 6436 | if ( |
| 6437 | (values = _gather_56_rule(p)) // ','.maybe_star_pattern+ |
| 6438 | && |
| 6439 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6440 | ) |
| 6441 | { |
| 6442 | D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
| 6443 | _res = values; |
| 6444 | if (_res == NULL && PyErr_Occurred()) { |
| 6445 | p->error_indicator = 1; |
| 6446 | D(p->level--); |
| 6447 | return NULL; |
| 6448 | } |
| 6449 | goto done; |
| 6450 | } |
| 6451 | p->mark = _mark; |
| 6452 | D(fprintf(stderr, "%*c%s maybe_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6453 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
| 6454 | } |
| 6455 | _res = NULL; |
| 6456 | done: |
| 6457 | D(p->level--); |
| 6458 | return _res; |
| 6459 | } |
| 6460 | |
| 6461 | // maybe_star_pattern: star_pattern | pattern |
| 6462 | static expr_ty |
| 6463 | maybe_star_pattern_rule(Parser *p) |
| 6464 | { |
| 6465 | D(p->level++); |
| 6466 | if (p->error_indicator) { |
| 6467 | D(p->level--); |
| 6468 | return NULL; |
| 6469 | } |
| 6470 | expr_ty _res = NULL; |
| 6471 | int _mark = p->mark; |
| 6472 | { // star_pattern |
| 6473 | if (p->error_indicator) { |
| 6474 | D(p->level--); |
| 6475 | return NULL; |
| 6476 | } |
| 6477 | D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_pattern")); |
| 6478 | expr_ty star_pattern_var; |
| 6479 | if ( |
| 6480 | (star_pattern_var = star_pattern_rule(p)) // star_pattern |
| 6481 | ) |
| 6482 | { |
| 6483 | D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_pattern")); |
| 6484 | _res = star_pattern_var; |
| 6485 | goto done; |
| 6486 | } |
| 6487 | p->mark = _mark; |
| 6488 | D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6489 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_pattern")); |
| 6490 | } |
| 6491 | { // pattern |
| 6492 | if (p->error_indicator) { |
| 6493 | D(p->level--); |
| 6494 | return NULL; |
| 6495 | } |
| 6496 | D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); |
| 6497 | expr_ty pattern_var; |
| 6498 | if ( |
| 6499 | (pattern_var = pattern_rule(p)) // pattern |
| 6500 | ) |
| 6501 | { |
| 6502 | D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); |
| 6503 | _res = pattern_var; |
| 6504 | goto done; |
| 6505 | } |
| 6506 | p->mark = _mark; |
| 6507 | D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6508 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); |
| 6509 | } |
| 6510 | _res = NULL; |
| 6511 | done: |
| 6512 | D(p->level--); |
| 6513 | return _res; |
| 6514 | } |
| 6515 | |
| 6516 | // star_pattern: '*' (capture_pattern | wildcard_pattern) |
| 6517 | static expr_ty |
| 6518 | star_pattern_rule(Parser *p) |
| 6519 | { |
| 6520 | D(p->level++); |
| 6521 | if (p->error_indicator) { |
| 6522 | D(p->level--); |
| 6523 | return NULL; |
| 6524 | } |
| 6525 | expr_ty _res = NULL; |
| 6526 | int _mark = p->mark; |
| 6527 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6528 | p->error_indicator = 1; |
| 6529 | D(p->level--); |
| 6530 | return NULL; |
| 6531 | } |
| 6532 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6533 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6534 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6535 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6536 | { // '*' (capture_pattern | wildcard_pattern) |
| 6537 | if (p->error_indicator) { |
| 6538 | D(p->level--); |
| 6539 | return NULL; |
| 6540 | } |
| 6541 | D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); |
| 6542 | Token * _literal; |
| 6543 | void *value; |
| 6544 | if ( |
| 6545 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 6546 | && |
| 6547 | (value = _tmp_58_rule(p)) // capture_pattern | wildcard_pattern |
| 6548 | ) |
| 6549 | { |
| 6550 | D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); |
| 6551 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6552 | if (_token == NULL) { |
| 6553 | D(p->level--); |
| 6554 | return NULL; |
| 6555 | } |
| 6556 | int _end_lineno = _token->end_lineno; |
| 6557 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6558 | int _end_col_offset = _token->end_col_offset; |
| 6559 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6560 | _res = _Py_Starred ( value , Store , EXTRA ); |
| 6561 | if (_res == NULL && PyErr_Occurred()) { |
| 6562 | p->error_indicator = 1; |
| 6563 | D(p->level--); |
| 6564 | return NULL; |
| 6565 | } |
| 6566 | goto done; |
| 6567 | } |
| 6568 | p->mark = _mark; |
| 6569 | D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6570 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); |
| 6571 | } |
| 6572 | _res = NULL; |
| 6573 | done: |
| 6574 | D(p->level--); |
| 6575 | return _res; |
| 6576 | } |
| 6577 | |
| 6578 | // mapping_pattern: '{' items_pattern? '}' |
| 6579 | static expr_ty |
| 6580 | mapping_pattern_rule(Parser *p) |
| 6581 | { |
| 6582 | D(p->level++); |
| 6583 | if (p->error_indicator) { |
| 6584 | D(p->level--); |
| 6585 | return NULL; |
| 6586 | } |
| 6587 | expr_ty _res = NULL; |
| 6588 | int _mark = p->mark; |
| 6589 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6590 | p->error_indicator = 1; |
| 6591 | D(p->level--); |
| 6592 | return NULL; |
| 6593 | } |
| 6594 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6595 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6596 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6597 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6598 | { // '{' items_pattern? '}' |
| 6599 | if (p->error_indicator) { |
| 6600 | D(p->level--); |
| 6601 | return NULL; |
| 6602 | } |
| 6603 | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); |
| 6604 | Token * _literal; |
| 6605 | Token * _literal_1; |
| 6606 | void *items; |
| 6607 | if ( |
| 6608 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 6609 | && |
| 6610 | (items = items_pattern_rule(p), 1) // items_pattern? |
| 6611 | && |
| 6612 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 6613 | ) |
| 6614 | { |
| 6615 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); |
| 6616 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6617 | if (_token == NULL) { |
| 6618 | D(p->level--); |
| 6619 | return NULL; |
| 6620 | } |
| 6621 | int _end_lineno = _token->end_lineno; |
| 6622 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6623 | int _end_col_offset = _token->end_col_offset; |
| 6624 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6625 | _res = _Py_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , items ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , items ) ) , EXTRA ); |
| 6626 | if (_res == NULL && PyErr_Occurred()) { |
| 6627 | p->error_indicator = 1; |
| 6628 | D(p->level--); |
| 6629 | return NULL; |
| 6630 | } |
| 6631 | goto done; |
| 6632 | } |
| 6633 | p->mark = _mark; |
| 6634 | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6635 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern? '}'")); |
| 6636 | } |
| 6637 | _res = NULL; |
| 6638 | done: |
| 6639 | D(p->level--); |
| 6640 | return _res; |
| 6641 | } |
| 6642 | |
| 6643 | // items_pattern: ','.key_value_pattern+ ','? |
| 6644 | static asdl_seq* |
| 6645 | items_pattern_rule(Parser *p) |
| 6646 | { |
| 6647 | D(p->level++); |
| 6648 | if (p->error_indicator) { |
| 6649 | D(p->level--); |
| 6650 | return NULL; |
| 6651 | } |
| 6652 | asdl_seq* _res = NULL; |
| 6653 | int _mark = p->mark; |
| 6654 | { // ','.key_value_pattern+ ','? |
| 6655 | if (p->error_indicator) { |
| 6656 | D(p->level--); |
| 6657 | return NULL; |
| 6658 | } |
| 6659 | D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+ ','?")); |
| 6660 | void *_opt_var; |
| 6661 | UNUSED(_opt_var); // Silence compiler warnings |
| 6662 | asdl_seq * items; |
| 6663 | if ( |
| 6664 | (items = _gather_59_rule(p)) // ','.key_value_pattern+ |
| 6665 | && |
| 6666 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6667 | ) |
| 6668 | { |
| 6669 | D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+ ','?")); |
| 6670 | _res = items; |
| 6671 | if (_res == NULL && PyErr_Occurred()) { |
| 6672 | p->error_indicator = 1; |
| 6673 | D(p->level--); |
| 6674 | return NULL; |
| 6675 | } |
| 6676 | goto done; |
| 6677 | } |
| 6678 | p->mark = _mark; |
| 6679 | D(fprintf(stderr, "%*c%s items_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6680 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.key_value_pattern+ ','?")); |
| 6681 | } |
| 6682 | _res = NULL; |
| 6683 | done: |
| 6684 | D(p->level--); |
| 6685 | return _res; |
| 6686 | } |
| 6687 | |
| 6688 | // key_value_pattern: (literal_pattern | value_pattern) ':' pattern | double_star_pattern |
| 6689 | static KeyValuePair* |
| 6690 | key_value_pattern_rule(Parser *p) |
| 6691 | { |
| 6692 | D(p->level++); |
| 6693 | if (p->error_indicator) { |
| 6694 | D(p->level--); |
| 6695 | return NULL; |
| 6696 | } |
| 6697 | KeyValuePair* _res = NULL; |
| 6698 | int _mark = p->mark; |
| 6699 | { // (literal_pattern | value_pattern) ':' pattern |
| 6700 | if (p->error_indicator) { |
| 6701 | D(p->level--); |
| 6702 | return NULL; |
| 6703 | } |
| 6704 | D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); |
| 6705 | Token * _literal; |
| 6706 | void *key; |
| 6707 | expr_ty value; |
| 6708 | if ( |
| 6709 | (key = _tmp_61_rule(p)) // literal_pattern | value_pattern |
| 6710 | && |
| 6711 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 6712 | && |
| 6713 | (value = pattern_rule(p)) // pattern |
| 6714 | ) |
| 6715 | { |
| 6716 | D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); |
| 6717 | _res = _PyPegen_key_value_pair ( p , key , value ); |
| 6718 | if (_res == NULL && PyErr_Occurred()) { |
| 6719 | p->error_indicator = 1; |
| 6720 | D(p->level--); |
| 6721 | return NULL; |
| 6722 | } |
| 6723 | goto done; |
| 6724 | } |
| 6725 | p->mark = _mark; |
| 6726 | D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6727 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); |
| 6728 | } |
| 6729 | { // double_star_pattern |
| 6730 | if (p->error_indicator) { |
| 6731 | D(p->level--); |
| 6732 | return NULL; |
| 6733 | } |
| 6734 | D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_star_pattern")); |
| 6735 | KeyValuePair* double_star_pattern_var; |
| 6736 | if ( |
| 6737 | (double_star_pattern_var = double_star_pattern_rule(p)) // double_star_pattern |
| 6738 | ) |
| 6739 | { |
| 6740 | D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_star_pattern")); |
| 6741 | _res = double_star_pattern_var; |
| 6742 | goto done; |
| 6743 | } |
| 6744 | p->mark = _mark; |
| 6745 | D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6746 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_star_pattern")); |
| 6747 | } |
| 6748 | _res = NULL; |
| 6749 | done: |
| 6750 | D(p->level--); |
| 6751 | return _res; |
| 6752 | } |
| 6753 | |
| 6754 | // double_star_pattern: '**' capture_pattern |
| 6755 | static KeyValuePair* |
| 6756 | double_star_pattern_rule(Parser *p) |
| 6757 | { |
| 6758 | D(p->level++); |
| 6759 | if (p->error_indicator) { |
| 6760 | D(p->level--); |
| 6761 | return NULL; |
| 6762 | } |
| 6763 | KeyValuePair* _res = NULL; |
| 6764 | int _mark = p->mark; |
| 6765 | { // '**' capture_pattern |
| 6766 | if (p->error_indicator) { |
| 6767 | D(p->level--); |
| 6768 | return NULL; |
| 6769 | } |
| 6770 | D(fprintf(stderr, "%*c> double_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' capture_pattern")); |
| 6771 | Token * _literal; |
| 6772 | expr_ty value; |
| 6773 | if ( |
| 6774 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 6775 | && |
| 6776 | (value = capture_pattern_rule(p)) // capture_pattern |
| 6777 | ) |
| 6778 | { |
| 6779 | D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' capture_pattern")); |
| 6780 | _res = _PyPegen_key_value_pair ( p , NULL , value ); |
| 6781 | if (_res == NULL && PyErr_Occurred()) { |
| 6782 | p->error_indicator = 1; |
| 6783 | D(p->level--); |
| 6784 | return NULL; |
| 6785 | } |
| 6786 | goto done; |
| 6787 | } |
| 6788 | p->mark = _mark; |
| 6789 | D(fprintf(stderr, "%*c%s double_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6790 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' capture_pattern")); |
| 6791 | } |
| 6792 | _res = NULL; |
| 6793 | done: |
| 6794 | D(p->level--); |
| 6795 | return _res; |
| 6796 | } |
| 6797 | |
| 6798 | // class_pattern: |
| 6799 | // | name_or_attr '(' ')' |
| 6800 | // | name_or_attr '(' positional_patterns ','? ')' |
| 6801 | // | name_or_attr '(' keyword_patterns ','? ')' |
| 6802 | // | name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' |
| 6803 | static expr_ty |
| 6804 | class_pattern_rule(Parser *p) |
| 6805 | { |
| 6806 | D(p->level++); |
| 6807 | if (p->error_indicator) { |
| 6808 | D(p->level--); |
| 6809 | return NULL; |
| 6810 | } |
| 6811 | expr_ty _res = NULL; |
| 6812 | int _mark = p->mark; |
| 6813 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6814 | p->error_indicator = 1; |
| 6815 | D(p->level--); |
| 6816 | return NULL; |
| 6817 | } |
| 6818 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6819 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6820 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6821 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 6822 | { // name_or_attr '(' ')' |
| 6823 | if (p->error_indicator) { |
| 6824 | D(p->level--); |
| 6825 | return NULL; |
| 6826 | } |
| 6827 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); |
| 6828 | Token * _literal; |
| 6829 | Token * _literal_1; |
| 6830 | expr_ty func; |
| 6831 | if ( |
| 6832 | (func = name_or_attr_rule(p)) // name_or_attr |
| 6833 | && |
| 6834 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6835 | && |
| 6836 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6837 | ) |
| 6838 | { |
| 6839 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); |
| 6840 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6841 | if (_token == NULL) { |
| 6842 | D(p->level--); |
| 6843 | return NULL; |
| 6844 | } |
| 6845 | int _end_lineno = _token->end_lineno; |
| 6846 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6847 | int _end_col_offset = _token->end_col_offset; |
| 6848 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6849 | _res = _Py_Call ( func , NULL , NULL , EXTRA ); |
| 6850 | if (_res == NULL && PyErr_Occurred()) { |
| 6851 | p->error_indicator = 1; |
| 6852 | D(p->level--); |
| 6853 | return NULL; |
| 6854 | } |
| 6855 | goto done; |
| 6856 | } |
| 6857 | p->mark = _mark; |
| 6858 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6859 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'")); |
| 6860 | } |
| 6861 | { // name_or_attr '(' positional_patterns ','? ')' |
| 6862 | if (p->error_indicator) { |
| 6863 | D(p->level--); |
| 6864 | return NULL; |
| 6865 | } |
| 6866 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
| 6867 | Token * _literal; |
| 6868 | Token * _literal_1; |
| 6869 | void *_opt_var; |
| 6870 | UNUSED(_opt_var); // Silence compiler warnings |
| 6871 | asdl_expr_seq* args; |
| 6872 | expr_ty func; |
| 6873 | if ( |
| 6874 | (func = name_or_attr_rule(p)) // name_or_attr |
| 6875 | && |
| 6876 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6877 | && |
| 6878 | (args = positional_patterns_rule(p)) // positional_patterns |
| 6879 | && |
| 6880 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6881 | && |
| 6882 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6883 | ) |
| 6884 | { |
| 6885 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
| 6886 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6887 | if (_token == NULL) { |
| 6888 | D(p->level--); |
| 6889 | return NULL; |
| 6890 | } |
| 6891 | int _end_lineno = _token->end_lineno; |
| 6892 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6893 | int _end_col_offset = _token->end_col_offset; |
| 6894 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6895 | _res = _Py_Call ( func , args , NULL , EXTRA ); |
| 6896 | if (_res == NULL && PyErr_Occurred()) { |
| 6897 | p->error_indicator = 1; |
| 6898 | D(p->level--); |
| 6899 | return NULL; |
| 6900 | } |
| 6901 | goto done; |
| 6902 | } |
| 6903 | p->mark = _mark; |
| 6904 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6905 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
| 6906 | } |
| 6907 | { // name_or_attr '(' keyword_patterns ','? ')' |
| 6908 | if (p->error_indicator) { |
| 6909 | D(p->level--); |
| 6910 | return NULL; |
| 6911 | } |
| 6912 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
| 6913 | Token * _literal; |
| 6914 | Token * _literal_1; |
| 6915 | void *_opt_var; |
| 6916 | UNUSED(_opt_var); // Silence compiler warnings |
| 6917 | expr_ty func; |
| 6918 | asdl_keyword_seq* keywords; |
| 6919 | if ( |
| 6920 | (func = name_or_attr_rule(p)) // name_or_attr |
| 6921 | && |
| 6922 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6923 | && |
| 6924 | (keywords = keyword_patterns_rule(p)) // keyword_patterns |
| 6925 | && |
| 6926 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6927 | && |
| 6928 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6929 | ) |
| 6930 | { |
| 6931 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
| 6932 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6933 | if (_token == NULL) { |
| 6934 | D(p->level--); |
| 6935 | return NULL; |
| 6936 | } |
| 6937 | int _end_lineno = _token->end_lineno; |
| 6938 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6939 | int _end_col_offset = _token->end_col_offset; |
| 6940 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6941 | _res = _Py_Call ( func , NULL , keywords , EXTRA ); |
| 6942 | if (_res == NULL && PyErr_Occurred()) { |
| 6943 | p->error_indicator = 1; |
| 6944 | D(p->level--); |
| 6945 | return NULL; |
| 6946 | } |
| 6947 | goto done; |
| 6948 | } |
| 6949 | p->mark = _mark; |
| 6950 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 6951 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
| 6952 | } |
| 6953 | { // name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' |
| 6954 | if (p->error_indicator) { |
| 6955 | D(p->level--); |
| 6956 | return NULL; |
| 6957 | } |
| 6958 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
| 6959 | Token * _literal; |
| 6960 | Token * _literal_1; |
| 6961 | Token * _literal_2; |
| 6962 | void *_opt_var; |
| 6963 | UNUSED(_opt_var); // Silence compiler warnings |
| 6964 | asdl_expr_seq* args; |
| 6965 | expr_ty func; |
| 6966 | asdl_keyword_seq* keywords; |
| 6967 | if ( |
| 6968 | (func = name_or_attr_rule(p)) // name_or_attr |
| 6969 | && |
| 6970 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 6971 | && |
| 6972 | (args = positional_patterns_rule(p)) // positional_patterns |
| 6973 | && |
| 6974 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 6975 | && |
| 6976 | (keywords = keyword_patterns_rule(p)) // keyword_patterns |
| 6977 | && |
| 6978 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 6979 | && |
| 6980 | (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' |
| 6981 | ) |
| 6982 | { |
| 6983 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
| 6984 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6985 | if (_token == NULL) { |
| 6986 | D(p->level--); |
| 6987 | return NULL; |
| 6988 | } |
| 6989 | int _end_lineno = _token->end_lineno; |
| 6990 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6991 | int _end_col_offset = _token->end_col_offset; |
| 6992 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6993 | _res = _Py_Call ( func , args , keywords , EXTRA ); |
| 6994 | if (_res == NULL && PyErr_Occurred()) { |
| 6995 | p->error_indicator = 1; |
| 6996 | D(p->level--); |
| 6997 | return NULL; |
| 6998 | } |
| 6999 | goto done; |
| 7000 | } |
| 7001 | p->mark = _mark; |
| 7002 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 7003 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
| 7004 | } |
| 7005 | _res = NULL; |
| 7006 | done: |
| 7007 | D(p->level--); |
| 7008 | return _res; |
| 7009 | } |
| 7010 | |
| 7011 | // positional_patterns: ','.pattern+ |
| 7012 | static asdl_expr_seq* |
| 7013 | positional_patterns_rule(Parser *p) |
| 7014 | { |
| 7015 | D(p->level++); |
| 7016 | if (p->error_indicator) { |
| 7017 | D(p->level--); |
| 7018 | return NULL; |
| 7019 | } |
| 7020 | asdl_expr_seq* _res = NULL; |
| 7021 | int _mark = p->mark; |
| 7022 | { // ','.pattern+ |
| 7023 | if (p->error_indicator) { |
| 7024 | D(p->level--); |
| 7025 | return NULL; |
| 7026 | } |
| 7027 | D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+")); |
| 7028 | asdl_expr_seq* args; |
| 7029 | if ( |
| 7030 | (args = (asdl_expr_seq*)_gather_62_rule(p)) // ','.pattern+ |
| 7031 | ) |
| 7032 | { |
| 7033 | D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+")); |
| 7034 | _res = args; |
| 7035 | if (_res == NULL && PyErr_Occurred()) { |
| 7036 | p->error_indicator = 1; |
| 7037 | D(p->level--); |
| 7038 | return NULL; |
| 7039 | } |
| 7040 | goto done; |
| 7041 | } |
| 7042 | p->mark = _mark; |
| 7043 | D(fprintf(stderr, "%*c%s positional_patterns[%d-%d]: %s failed!\n", p->level, ' ', |
| 7044 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+")); |
| 7045 | } |
| 7046 | _res = NULL; |
| 7047 | done: |
| 7048 | D(p->level--); |
| 7049 | return _res; |
| 7050 | } |
| 7051 | |
| 7052 | // keyword_patterns: ','.keyword_pattern+ |
| 7053 | static asdl_keyword_seq* |
| 7054 | keyword_patterns_rule(Parser *p) |
| 7055 | { |
| 7056 | D(p->level++); |
| 7057 | if (p->error_indicator) { |
| 7058 | D(p->level--); |
| 7059 | return NULL; |
| 7060 | } |
| 7061 | asdl_keyword_seq* _res = NULL; |
| 7062 | int _mark = p->mark; |
| 7063 | { // ','.keyword_pattern+ |
| 7064 | if (p->error_indicator) { |
| 7065 | D(p->level--); |
| 7066 | return NULL; |
| 7067 | } |
| 7068 | D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); |
| 7069 | asdl_keyword_seq* keywords; |
| 7070 | if ( |
| 7071 | (keywords = (asdl_keyword_seq*)_gather_64_rule(p)) // ','.keyword_pattern+ |
| 7072 | ) |
| 7073 | { |
| 7074 | D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); |
| 7075 | _res = keywords; |
| 7076 | if (_res == NULL && PyErr_Occurred()) { |
| 7077 | p->error_indicator = 1; |
| 7078 | D(p->level--); |
| 7079 | return NULL; |
| 7080 | } |
| 7081 | goto done; |
| 7082 | } |
| 7083 | p->mark = _mark; |
| 7084 | D(fprintf(stderr, "%*c%s keyword_patterns[%d-%d]: %s failed!\n", p->level, ' ', |
| 7085 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.keyword_pattern+")); |
| 7086 | } |
| 7087 | _res = NULL; |
| 7088 | done: |
| 7089 | D(p->level--); |
| 7090 | return _res; |
| 7091 | } |
| 7092 | |
| 7093 | // keyword_pattern: NAME '=' pattern |
| 7094 | static keyword_ty |
| 7095 | keyword_pattern_rule(Parser *p) |
| 7096 | { |
| 7097 | D(p->level++); |
| 7098 | if (p->error_indicator) { |
| 7099 | D(p->level--); |
| 7100 | return NULL; |
| 7101 | } |
| 7102 | keyword_ty _res = NULL; |
| 7103 | int _mark = p->mark; |
| 7104 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7105 | p->error_indicator = 1; |
| 7106 | D(p->level--); |
| 7107 | return NULL; |
| 7108 | } |
| 7109 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7110 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7111 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7112 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 7113 | { // NAME '=' pattern |
| 7114 | if (p->error_indicator) { |
| 7115 | D(p->level--); |
| 7116 | return NULL; |
| 7117 | } |
| 7118 | D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); |
| 7119 | Token * _literal; |
| 7120 | expr_ty arg; |
| 7121 | expr_ty value; |
| 7122 | if ( |
| 7123 | (arg = _PyPegen_name_token(p)) // NAME |
| 7124 | && |
| 7125 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 7126 | && |
| 7127 | (value = pattern_rule(p)) // pattern |
| 7128 | ) |
| 7129 | { |
| 7130 | D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); |
| 7131 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7132 | if (_token == NULL) { |
| 7133 | D(p->level--); |
| 7134 | return NULL; |
| 7135 | } |
| 7136 | int _end_lineno = _token->end_lineno; |
| 7137 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7138 | int _end_col_offset = _token->end_col_offset; |
| 7139 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7140 | _res = _Py_keyword ( arg -> v . Name . id , value , EXTRA ); |
| 7141 | if (_res == NULL && PyErr_Occurred()) { |
| 7142 | p->error_indicator = 1; |
| 7143 | D(p->level--); |
| 7144 | return NULL; |
| 7145 | } |
| 7146 | goto done; |
| 7147 | } |
| 7148 | p->mark = _mark; |
| 7149 | D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
| 7150 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern")); |
| 7151 | } |
| 7152 | _res = NULL; |
| 7153 | done: |
| 7154 | D(p->level--); |
| 7155 | return _res; |
| 7156 | } |
| 7157 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7158 | // return_stmt: 'return' star_expressions? |
| 7159 | static stmt_ty |
| 7160 | return_stmt_rule(Parser *p) |
| 7161 | { |
| 7162 | D(p->level++); |
| 7163 | if (p->error_indicator) { |
| 7164 | D(p->level--); |
| 7165 | return NULL; |
| 7166 | } |
| 7167 | stmt_ty _res = NULL; |
| 7168 | int _mark = p->mark; |
| 7169 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7170 | p->error_indicator = 1; |
| 7171 | D(p->level--); |
| 7172 | return NULL; |
| 7173 | } |
| 7174 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7175 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7176 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7177 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 7178 | { // 'return' star_expressions? |
| 7179 | if (p->error_indicator) { |
| 7180 | D(p->level--); |
| 7181 | return NULL; |
| 7182 | } |
| 7183 | D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); |
| 7184 | Token * _keyword; |
| 7185 | void *a; |
| 7186 | if ( |
| 7187 | (_keyword = _PyPegen_expect_token(p, 500)) // token='return' |
| 7188 | && |
| 7189 | (a = star_expressions_rule(p), 1) // star_expressions? |
| 7190 | ) |
| 7191 | { |
| 7192 | D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); |
| 7193 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7194 | if (_token == NULL) { |
| 7195 | D(p->level--); |
| 7196 | return NULL; |
| 7197 | } |
| 7198 | int _end_lineno = _token->end_lineno; |
| 7199 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7200 | int _end_col_offset = _token->end_col_offset; |
| 7201 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7202 | _res = _Py_Return ( a , EXTRA ); |
| 7203 | if (_res == NULL && PyErr_Occurred()) { |
| 7204 | p->error_indicator = 1; |
| 7205 | D(p->level--); |
| 7206 | return NULL; |
| 7207 | } |
| 7208 | goto done; |
| 7209 | } |
| 7210 | p->mark = _mark; |
| 7211 | D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 7212 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); |
| 7213 | } |
| 7214 | _res = NULL; |
| 7215 | done: |
| 7216 | D(p->level--); |
| 7217 | return _res; |
| 7218 | } |
| 7219 | |
| 7220 | // raise_stmt: 'raise' expression ['from' expression] | 'raise' |
| 7221 | static stmt_ty |
| 7222 | raise_stmt_rule(Parser *p) |
| 7223 | { |
| 7224 | D(p->level++); |
| 7225 | if (p->error_indicator) { |
| 7226 | D(p->level--); |
| 7227 | return NULL; |
| 7228 | } |
| 7229 | stmt_ty _res = NULL; |
| 7230 | int _mark = p->mark; |
| 7231 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7232 | p->error_indicator = 1; |
| 7233 | D(p->level--); |
| 7234 | return NULL; |
| 7235 | } |
| 7236 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7237 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7238 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7239 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 7240 | { // 'raise' expression ['from' expression] |
| 7241 | if (p->error_indicator) { |
| 7242 | D(p->level--); |
| 7243 | return NULL; |
| 7244 | } |
| 7245 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); |
| 7246 | Token * _keyword; |
| 7247 | expr_ty a; |
| 7248 | void *b; |
| 7249 | if ( |
| 7250 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
| 7251 | && |
| 7252 | (a = expression_rule(p)) // expression |
| 7253 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7254 | (b = _tmp_66_rule(p), 1) // ['from' expression] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7255 | ) |
| 7256 | { |
| 7257 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); |
| 7258 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7259 | if (_token == NULL) { |
| 7260 | D(p->level--); |
| 7261 | return NULL; |
| 7262 | } |
| 7263 | int _end_lineno = _token->end_lineno; |
| 7264 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7265 | int _end_col_offset = _token->end_col_offset; |
| 7266 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7267 | _res = _Py_Raise ( a , b , EXTRA ); |
| 7268 | if (_res == NULL && PyErr_Occurred()) { |
| 7269 | p->error_indicator = 1; |
| 7270 | D(p->level--); |
| 7271 | return NULL; |
| 7272 | } |
| 7273 | goto done; |
| 7274 | } |
| 7275 | p->mark = _mark; |
| 7276 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 7277 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]")); |
| 7278 | } |
| 7279 | { // 'raise' |
| 7280 | if (p->error_indicator) { |
| 7281 | D(p->level--); |
| 7282 | return NULL; |
| 7283 | } |
| 7284 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'")); |
| 7285 | Token * _keyword; |
| 7286 | if ( |
| 7287 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
| 7288 | ) |
| 7289 | { |
| 7290 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'")); |
| 7291 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7292 | if (_token == NULL) { |
| 7293 | D(p->level--); |
| 7294 | return NULL; |
| 7295 | } |
| 7296 | int _end_lineno = _token->end_lineno; |
| 7297 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7298 | int _end_col_offset = _token->end_col_offset; |
| 7299 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7300 | _res = _Py_Raise ( NULL , NULL , EXTRA ); |
| 7301 | if (_res == NULL && PyErr_Occurred()) { |
| 7302 | p->error_indicator = 1; |
| 7303 | D(p->level--); |
| 7304 | return NULL; |
| 7305 | } |
| 7306 | goto done; |
| 7307 | } |
| 7308 | p->mark = _mark; |
| 7309 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 7310 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); |
| 7311 | } |
| 7312 | _res = NULL; |
| 7313 | done: |
| 7314 | D(p->level--); |
| 7315 | return _res; |
| 7316 | } |
| 7317 | |
| 7318 | // function_def: decorators function_def_raw | function_def_raw |
| 7319 | static stmt_ty |
| 7320 | function_def_rule(Parser *p) |
| 7321 | { |
| 7322 | D(p->level++); |
| 7323 | if (p->error_indicator) { |
| 7324 | D(p->level--); |
| 7325 | return NULL; |
| 7326 | } |
| 7327 | stmt_ty _res = NULL; |
| 7328 | int _mark = p->mark; |
| 7329 | { // decorators function_def_raw |
| 7330 | if (p->error_indicator) { |
| 7331 | D(p->level--); |
| 7332 | return NULL; |
| 7333 | } |
| 7334 | 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] | 7335 | asdl_expr_seq* d; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7336 | stmt_ty f; |
| 7337 | if ( |
| 7338 | (d = decorators_rule(p)) // decorators |
| 7339 | && |
| 7340 | (f = function_def_raw_rule(p)) // function_def_raw |
| 7341 | ) |
| 7342 | { |
| 7343 | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); |
| 7344 | _res = _PyPegen_function_def_decorators ( p , d , f ); |
| 7345 | if (_res == NULL && PyErr_Occurred()) { |
| 7346 | p->error_indicator = 1; |
| 7347 | D(p->level--); |
| 7348 | return NULL; |
| 7349 | } |
| 7350 | goto done; |
| 7351 | } |
| 7352 | p->mark = _mark; |
| 7353 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 7354 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw")); |
| 7355 | } |
| 7356 | { // function_def_raw |
| 7357 | if (p->error_indicator) { |
| 7358 | D(p->level--); |
| 7359 | return NULL; |
| 7360 | } |
| 7361 | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw")); |
| 7362 | stmt_ty function_def_raw_var; |
| 7363 | if ( |
| 7364 | (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw |
| 7365 | ) |
| 7366 | { |
| 7367 | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw")); |
| 7368 | _res = function_def_raw_var; |
| 7369 | goto done; |
| 7370 | } |
| 7371 | p->mark = _mark; |
| 7372 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 7373 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw")); |
| 7374 | } |
| 7375 | _res = NULL; |
| 7376 | done: |
| 7377 | D(p->level--); |
| 7378 | return _res; |
| 7379 | } |
| 7380 | |
| 7381 | // function_def_raw: |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7382 | // | 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
| 7383 | // | ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7384 | static stmt_ty |
| 7385 | function_def_raw_rule(Parser *p) |
| 7386 | { |
| 7387 | D(p->level++); |
| 7388 | if (p->error_indicator) { |
| 7389 | D(p->level--); |
| 7390 | return NULL; |
| 7391 | } |
| 7392 | stmt_ty _res = NULL; |
| 7393 | int _mark = p->mark; |
| 7394 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7395 | p->error_indicator = 1; |
| 7396 | D(p->level--); |
| 7397 | return NULL; |
| 7398 | } |
| 7399 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7400 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7401 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7402 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7403 | { // 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7404 | if (p->error_indicator) { |
| 7405 | D(p->level--); |
| 7406 | return NULL; |
| 7407 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7408 | 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] | 7409 | Token * _keyword; |
| 7410 | Token * _literal; |
| 7411 | Token * _literal_1; |
| 7412 | Token * _literal_2; |
| 7413 | void *a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7414 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7415 | expr_ty n; |
| 7416 | void *params; |
| 7417 | void *tc; |
| 7418 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7419 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7420 | && |
| 7421 | (n = _PyPegen_name_token(p)) // NAME |
| 7422 | && |
| 7423 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 7424 | && |
| 7425 | (params = params_rule(p), 1) // params? |
| 7426 | && |
| 7427 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 7428 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7429 | (a = _tmp_67_rule(p), 1) // ['->' expression] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7430 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7431 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7432 | && |
| 7433 | (tc = func_type_comment_rule(p), 1) // func_type_comment? |
| 7434 | && |
| 7435 | (b = block_rule(p)) // block |
| 7436 | ) |
| 7437 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7438 | 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] | 7439 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7440 | if (_token == NULL) { |
| 7441 | D(p->level--); |
| 7442 | return NULL; |
| 7443 | } |
| 7444 | int _end_lineno = _token->end_lineno; |
| 7445 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7446 | int _end_col_offset = _token->end_col_offset; |
| 7447 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 7448 | _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] | 7449 | if (_res == NULL && PyErr_Occurred()) { |
| 7450 | p->error_indicator = 1; |
| 7451 | D(p->level--); |
| 7452 | return NULL; |
| 7453 | } |
| 7454 | goto done; |
| 7455 | } |
| 7456 | p->mark = _mark; |
| 7457 | 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] | 7458 | 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] | 7459 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7460 | { // ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7461 | if (p->error_indicator) { |
| 7462 | D(p->level--); |
| 7463 | return NULL; |
| 7464 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7465 | 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] | 7466 | Token * _keyword; |
| 7467 | Token * _literal; |
| 7468 | Token * _literal_1; |
| 7469 | Token * _literal_2; |
| 7470 | void *a; |
| 7471 | Token * async_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7472 | asdl_stmt_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7473 | expr_ty n; |
| 7474 | void *params; |
| 7475 | void *tc; |
| 7476 | if ( |
| 7477 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 7478 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7479 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7480 | && |
| 7481 | (n = _PyPegen_name_token(p)) // NAME |
| 7482 | && |
| 7483 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 7484 | && |
| 7485 | (params = params_rule(p), 1) // params? |
| 7486 | && |
| 7487 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 7488 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7489 | (a = _tmp_68_rule(p), 1) // ['->' expression] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7490 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7491 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7492 | && |
| 7493 | (tc = func_type_comment_rule(p), 1) // func_type_comment? |
| 7494 | && |
| 7495 | (b = block_rule(p)) // block |
| 7496 | ) |
| 7497 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 7498 | 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] | 7499 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7500 | if (_token == NULL) { |
| 7501 | D(p->level--); |
| 7502 | return NULL; |
| 7503 | } |
| 7504 | int _end_lineno = _token->end_lineno; |
| 7505 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7506 | int _end_col_offset = _token->end_col_offset; |
| 7507 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 7508 | _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] | 7509 | if (_res == NULL && PyErr_Occurred()) { |
| 7510 | p->error_indicator = 1; |
| 7511 | D(p->level--); |
| 7512 | return NULL; |
| 7513 | } |
| 7514 | goto done; |
| 7515 | } |
| 7516 | p->mark = _mark; |
| 7517 | 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] | 7518 | 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] | 7519 | } |
| 7520 | _res = NULL; |
| 7521 | done: |
| 7522 | D(p->level--); |
| 7523 | return _res; |
| 7524 | } |
| 7525 | |
| 7526 | // func_type_comment: |
| 7527 | // | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
| 7528 | // | invalid_double_type_comments |
| 7529 | // | TYPE_COMMENT |
| 7530 | static Token* |
| 7531 | func_type_comment_rule(Parser *p) |
| 7532 | { |
| 7533 | D(p->level++); |
| 7534 | if (p->error_indicator) { |
| 7535 | D(p->level--); |
| 7536 | return NULL; |
| 7537 | } |
| 7538 | Token* _res = NULL; |
| 7539 | int _mark = p->mark; |
| 7540 | { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
| 7541 | if (p->error_indicator) { |
| 7542 | D(p->level--); |
| 7543 | return NULL; |
| 7544 | } |
| 7545 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
| 7546 | Token * newline_var; |
| 7547 | Token * t; |
| 7548 | if ( |
| 7549 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 7550 | && |
| 7551 | (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 7552 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7553 | _PyPegen_lookahead(1, _tmp_69_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7554 | ) |
| 7555 | { |
| 7556 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
| 7557 | _res = t; |
| 7558 | if (_res == NULL && PyErr_Occurred()) { |
| 7559 | p->error_indicator = 1; |
| 7560 | D(p->level--); |
| 7561 | return NULL; |
| 7562 | } |
| 7563 | goto done; |
| 7564 | } |
| 7565 | p->mark = _mark; |
| 7566 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 7567 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
| 7568 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 7569 | if (p->call_invalid_rules) { // invalid_double_type_comments |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7570 | if (p->error_indicator) { |
| 7571 | D(p->level--); |
| 7572 | return NULL; |
| 7573 | } |
| 7574 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); |
| 7575 | void *invalid_double_type_comments_var; |
| 7576 | if ( |
| 7577 | (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments |
| 7578 | ) |
| 7579 | { |
| 7580 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); |
| 7581 | _res = invalid_double_type_comments_var; |
| 7582 | goto done; |
| 7583 | } |
| 7584 | p->mark = _mark; |
| 7585 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 7586 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments")); |
| 7587 | } |
| 7588 | { // TYPE_COMMENT |
| 7589 | if (p->error_indicator) { |
| 7590 | D(p->level--); |
| 7591 | return NULL; |
| 7592 | } |
| 7593 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); |
| 7594 | Token * type_comment_var; |
| 7595 | if ( |
| 7596 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 7597 | ) |
| 7598 | { |
| 7599 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); |
| 7600 | _res = type_comment_var; |
| 7601 | goto done; |
| 7602 | } |
| 7603 | p->mark = _mark; |
| 7604 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 7605 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT")); |
| 7606 | } |
| 7607 | _res = NULL; |
| 7608 | done: |
| 7609 | D(p->level--); |
| 7610 | return _res; |
| 7611 | } |
| 7612 | |
| 7613 | // params: invalid_parameters | parameters |
| 7614 | static arguments_ty |
| 7615 | params_rule(Parser *p) |
| 7616 | { |
| 7617 | D(p->level++); |
| 7618 | if (p->error_indicator) { |
| 7619 | D(p->level--); |
| 7620 | return NULL; |
| 7621 | } |
| 7622 | arguments_ty _res = NULL; |
| 7623 | int _mark = p->mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 7624 | if (p->call_invalid_rules) { // invalid_parameters |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7625 | if (p->error_indicator) { |
| 7626 | D(p->level--); |
| 7627 | return NULL; |
| 7628 | } |
| 7629 | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); |
| 7630 | void *invalid_parameters_var; |
| 7631 | if ( |
| 7632 | (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters |
| 7633 | ) |
| 7634 | { |
| 7635 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); |
| 7636 | _res = invalid_parameters_var; |
| 7637 | goto done; |
| 7638 | } |
| 7639 | p->mark = _mark; |
| 7640 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
| 7641 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters")); |
| 7642 | } |
| 7643 | { // parameters |
| 7644 | if (p->error_indicator) { |
| 7645 | D(p->level--); |
| 7646 | return NULL; |
| 7647 | } |
| 7648 | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters")); |
| 7649 | arguments_ty parameters_var; |
| 7650 | if ( |
| 7651 | (parameters_var = parameters_rule(p)) // parameters |
| 7652 | ) |
| 7653 | { |
| 7654 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters")); |
| 7655 | _res = parameters_var; |
| 7656 | goto done; |
| 7657 | } |
| 7658 | p->mark = _mark; |
| 7659 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
| 7660 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters")); |
| 7661 | } |
| 7662 | _res = NULL; |
| 7663 | done: |
| 7664 | D(p->level--); |
| 7665 | return _res; |
| 7666 | } |
| 7667 | |
| 7668 | // parameters: |
| 7669 | // | slash_no_default param_no_default* param_with_default* star_etc? |
| 7670 | // | slash_with_default param_with_default* star_etc? |
| 7671 | // | param_no_default+ param_with_default* star_etc? |
| 7672 | // | param_with_default+ star_etc? |
| 7673 | // | star_etc |
| 7674 | static arguments_ty |
| 7675 | parameters_rule(Parser *p) |
| 7676 | { |
| 7677 | D(p->level++); |
| 7678 | if (p->error_indicator) { |
| 7679 | D(p->level--); |
| 7680 | return NULL; |
| 7681 | } |
| 7682 | arguments_ty _res = NULL; |
| 7683 | int _mark = p->mark; |
| 7684 | { // slash_no_default param_no_default* param_with_default* star_etc? |
| 7685 | if (p->error_indicator) { |
| 7686 | D(p->level--); |
| 7687 | return NULL; |
| 7688 | } |
| 7689 | 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] | 7690 | asdl_arg_seq* a; |
| 7691 | asdl_arg_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7692 | asdl_seq * c; |
| 7693 | void *d; |
| 7694 | if ( |
| 7695 | (a = slash_no_default_rule(p)) // slash_no_default |
| 7696 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7697 | (b = (asdl_arg_seq*)_loop0_70_rule(p)) // param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7698 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7699 | (c = _loop0_71_rule(p)) // param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7700 | && |
| 7701 | (d = star_etc_rule(p), 1) // star_etc? |
| 7702 | ) |
| 7703 | { |
| 7704 | 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?")); |
| 7705 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
| 7706 | if (_res == NULL && PyErr_Occurred()) { |
| 7707 | p->error_indicator = 1; |
| 7708 | D(p->level--); |
| 7709 | return NULL; |
| 7710 | } |
| 7711 | goto done; |
| 7712 | } |
| 7713 | p->mark = _mark; |
| 7714 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7715 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); |
| 7716 | } |
| 7717 | { // slash_with_default param_with_default* star_etc? |
| 7718 | if (p->error_indicator) { |
| 7719 | D(p->level--); |
| 7720 | return NULL; |
| 7721 | } |
| 7722 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
| 7723 | SlashWithDefault* a; |
| 7724 | asdl_seq * b; |
| 7725 | void *c; |
| 7726 | if ( |
| 7727 | (a = slash_with_default_rule(p)) // slash_with_default |
| 7728 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7729 | (b = _loop0_72_rule(p)) // param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7730 | && |
| 7731 | (c = star_etc_rule(p), 1) // star_etc? |
| 7732 | ) |
| 7733 | { |
| 7734 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
| 7735 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
| 7736 | if (_res == NULL && PyErr_Occurred()) { |
| 7737 | p->error_indicator = 1; |
| 7738 | D(p->level--); |
| 7739 | return NULL; |
| 7740 | } |
| 7741 | goto done; |
| 7742 | } |
| 7743 | p->mark = _mark; |
| 7744 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7745 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
| 7746 | } |
| 7747 | { // param_no_default+ param_with_default* star_etc? |
| 7748 | if (p->error_indicator) { |
| 7749 | D(p->level--); |
| 7750 | return NULL; |
| 7751 | } |
| 7752 | 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] | 7753 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7754 | asdl_seq * b; |
| 7755 | void *c; |
| 7756 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7757 | (a = (asdl_arg_seq*)_loop1_73_rule(p)) // param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7758 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7759 | (b = _loop0_74_rule(p)) // param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7760 | && |
| 7761 | (c = star_etc_rule(p), 1) // star_etc? |
| 7762 | ) |
| 7763 | { |
| 7764 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
| 7765 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
| 7766 | if (_res == NULL && PyErr_Occurred()) { |
| 7767 | p->error_indicator = 1; |
| 7768 | D(p->level--); |
| 7769 | return NULL; |
| 7770 | } |
| 7771 | goto done; |
| 7772 | } |
| 7773 | p->mark = _mark; |
| 7774 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7775 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
| 7776 | } |
| 7777 | { // param_with_default+ star_etc? |
| 7778 | if (p->error_indicator) { |
| 7779 | D(p->level--); |
| 7780 | return NULL; |
| 7781 | } |
| 7782 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); |
| 7783 | asdl_seq * a; |
| 7784 | void *b; |
| 7785 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7786 | (a = _loop1_75_rule(p)) // param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7787 | && |
| 7788 | (b = star_etc_rule(p), 1) // star_etc? |
| 7789 | ) |
| 7790 | { |
| 7791 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); |
| 7792 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
| 7793 | if (_res == NULL && PyErr_Occurred()) { |
| 7794 | p->error_indicator = 1; |
| 7795 | D(p->level--); |
| 7796 | return NULL; |
| 7797 | } |
| 7798 | goto done; |
| 7799 | } |
| 7800 | p->mark = _mark; |
| 7801 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7802 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?")); |
| 7803 | } |
| 7804 | { // star_etc |
| 7805 | if (p->error_indicator) { |
| 7806 | D(p->level--); |
| 7807 | return NULL; |
| 7808 | } |
| 7809 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc")); |
| 7810 | StarEtc* a; |
| 7811 | if ( |
| 7812 | (a = star_etc_rule(p)) // star_etc |
| 7813 | ) |
| 7814 | { |
| 7815 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc")); |
| 7816 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
| 7817 | if (_res == NULL && PyErr_Occurred()) { |
| 7818 | p->error_indicator = 1; |
| 7819 | D(p->level--); |
| 7820 | return NULL; |
| 7821 | } |
| 7822 | goto done; |
| 7823 | } |
| 7824 | p->mark = _mark; |
| 7825 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7826 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc")); |
| 7827 | } |
| 7828 | _res = NULL; |
| 7829 | done: |
| 7830 | D(p->level--); |
| 7831 | return _res; |
| 7832 | } |
| 7833 | |
| 7834 | // slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')' |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7835 | static asdl_arg_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7836 | slash_no_default_rule(Parser *p) |
| 7837 | { |
| 7838 | D(p->level++); |
| 7839 | if (p->error_indicator) { |
| 7840 | D(p->level--); |
| 7841 | return NULL; |
| 7842 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7843 | asdl_arg_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7844 | int _mark = p->mark; |
| 7845 | { // param_no_default+ '/' ',' |
| 7846 | if (p->error_indicator) { |
| 7847 | D(p->level--); |
| 7848 | return NULL; |
| 7849 | } |
| 7850 | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); |
| 7851 | Token * _literal; |
| 7852 | Token * _literal_1; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7853 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7854 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7855 | (a = (asdl_arg_seq*)_loop1_76_rule(p)) // param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7856 | && |
| 7857 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 7858 | && |
| 7859 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 7860 | ) |
| 7861 | { |
| 7862 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); |
| 7863 | _res = a; |
| 7864 | if (_res == NULL && PyErr_Occurred()) { |
| 7865 | p->error_indicator = 1; |
| 7866 | D(p->level--); |
| 7867 | return NULL; |
| 7868 | } |
| 7869 | goto done; |
| 7870 | } |
| 7871 | p->mark = _mark; |
| 7872 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7873 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','")); |
| 7874 | } |
| 7875 | { // param_no_default+ '/' &')' |
| 7876 | if (p->error_indicator) { |
| 7877 | D(p->level--); |
| 7878 | return NULL; |
| 7879 | } |
| 7880 | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); |
| 7881 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 7882 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7883 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7884 | (a = (asdl_arg_seq*)_loop1_77_rule(p)) // param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7885 | && |
| 7886 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 7887 | && |
| 7888 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 7889 | ) |
| 7890 | { |
| 7891 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); |
| 7892 | _res = a; |
| 7893 | if (_res == NULL && PyErr_Occurred()) { |
| 7894 | p->error_indicator = 1; |
| 7895 | D(p->level--); |
| 7896 | return NULL; |
| 7897 | } |
| 7898 | goto done; |
| 7899 | } |
| 7900 | p->mark = _mark; |
| 7901 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7902 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'")); |
| 7903 | } |
| 7904 | _res = NULL; |
| 7905 | done: |
| 7906 | D(p->level--); |
| 7907 | return _res; |
| 7908 | } |
| 7909 | |
| 7910 | // slash_with_default: |
| 7911 | // | param_no_default* param_with_default+ '/' ',' |
| 7912 | // | param_no_default* param_with_default+ '/' &')' |
| 7913 | static SlashWithDefault* |
| 7914 | slash_with_default_rule(Parser *p) |
| 7915 | { |
| 7916 | D(p->level++); |
| 7917 | if (p->error_indicator) { |
| 7918 | D(p->level--); |
| 7919 | return NULL; |
| 7920 | } |
| 7921 | SlashWithDefault* _res = NULL; |
| 7922 | int _mark = p->mark; |
| 7923 | { // param_no_default* param_with_default+ '/' ',' |
| 7924 | if (p->error_indicator) { |
| 7925 | D(p->level--); |
| 7926 | return NULL; |
| 7927 | } |
| 7928 | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
| 7929 | Token * _literal; |
| 7930 | Token * _literal_1; |
| 7931 | asdl_seq * a; |
| 7932 | asdl_seq * b; |
| 7933 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7934 | (a = _loop0_78_rule(p)) // param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7935 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7936 | (b = _loop1_79_rule(p)) // param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7937 | && |
| 7938 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 7939 | && |
| 7940 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 7941 | ) |
| 7942 | { |
| 7943 | 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] | 7944 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7945 | if (_res == NULL && PyErr_Occurred()) { |
| 7946 | p->error_indicator = 1; |
| 7947 | D(p->level--); |
| 7948 | return NULL; |
| 7949 | } |
| 7950 | goto done; |
| 7951 | } |
| 7952 | p->mark = _mark; |
| 7953 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7954 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
| 7955 | } |
| 7956 | { // param_no_default* param_with_default+ '/' &')' |
| 7957 | if (p->error_indicator) { |
| 7958 | D(p->level--); |
| 7959 | return NULL; |
| 7960 | } |
| 7961 | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
| 7962 | Token * _literal; |
| 7963 | asdl_seq * a; |
| 7964 | asdl_seq * b; |
| 7965 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7966 | (a = _loop0_80_rule(p)) // param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7967 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 7968 | (b = _loop1_81_rule(p)) // param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7969 | && |
| 7970 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 7971 | && |
| 7972 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 7973 | ) |
| 7974 | { |
| 7975 | 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] | 7976 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 7977 | if (_res == NULL && PyErr_Occurred()) { |
| 7978 | p->error_indicator = 1; |
| 7979 | D(p->level--); |
| 7980 | return NULL; |
| 7981 | } |
| 7982 | goto done; |
| 7983 | } |
| 7984 | p->mark = _mark; |
| 7985 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7986 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
| 7987 | } |
| 7988 | _res = NULL; |
| 7989 | done: |
| 7990 | D(p->level--); |
| 7991 | return _res; |
| 7992 | } |
| 7993 | |
| 7994 | // star_etc: |
| 7995 | // | '*' param_no_default param_maybe_default* kwds? |
| 7996 | // | '*' ',' param_maybe_default+ kwds? |
| 7997 | // | kwds |
| 7998 | // | invalid_star_etc |
| 7999 | static StarEtc* |
| 8000 | star_etc_rule(Parser *p) |
| 8001 | { |
| 8002 | D(p->level++); |
| 8003 | if (p->error_indicator) { |
| 8004 | D(p->level--); |
| 8005 | return NULL; |
| 8006 | } |
| 8007 | StarEtc* _res = NULL; |
| 8008 | int _mark = p->mark; |
| 8009 | { // '*' param_no_default param_maybe_default* kwds? |
| 8010 | if (p->error_indicator) { |
| 8011 | D(p->level--); |
| 8012 | return NULL; |
| 8013 | } |
| 8014 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
| 8015 | Token * _literal; |
| 8016 | arg_ty a; |
| 8017 | asdl_seq * b; |
| 8018 | void *c; |
| 8019 | if ( |
| 8020 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 8021 | && |
| 8022 | (a = param_no_default_rule(p)) // param_no_default |
| 8023 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8024 | (b = _loop0_82_rule(p)) // param_maybe_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8025 | && |
| 8026 | (c = kwds_rule(p), 1) // kwds? |
| 8027 | ) |
| 8028 | { |
| 8029 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
| 8030 | _res = _PyPegen_star_etc ( p , a , b , c ); |
| 8031 | if (_res == NULL && PyErr_Occurred()) { |
| 8032 | p->error_indicator = 1; |
| 8033 | D(p->level--); |
| 8034 | return NULL; |
| 8035 | } |
| 8036 | goto done; |
| 8037 | } |
| 8038 | p->mark = _mark; |
| 8039 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 8040 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
| 8041 | } |
| 8042 | { // '*' ',' param_maybe_default+ kwds? |
| 8043 | if (p->error_indicator) { |
| 8044 | D(p->level--); |
| 8045 | return NULL; |
| 8046 | } |
| 8047 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
| 8048 | Token * _literal; |
| 8049 | Token * _literal_1; |
| 8050 | asdl_seq * b; |
| 8051 | void *c; |
| 8052 | if ( |
| 8053 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 8054 | && |
| 8055 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 8056 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8057 | (b = _loop1_83_rule(p)) // param_maybe_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8058 | && |
| 8059 | (c = kwds_rule(p), 1) // kwds? |
| 8060 | ) |
| 8061 | { |
| 8062 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
| 8063 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
| 8064 | if (_res == NULL && PyErr_Occurred()) { |
| 8065 | p->error_indicator = 1; |
| 8066 | D(p->level--); |
| 8067 | return NULL; |
| 8068 | } |
| 8069 | goto done; |
| 8070 | } |
| 8071 | p->mark = _mark; |
| 8072 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 8073 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
| 8074 | } |
| 8075 | { // kwds |
| 8076 | if (p->error_indicator) { |
| 8077 | D(p->level--); |
| 8078 | return NULL; |
| 8079 | } |
| 8080 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds")); |
| 8081 | arg_ty a; |
| 8082 | if ( |
| 8083 | (a = kwds_rule(p)) // kwds |
| 8084 | ) |
| 8085 | { |
| 8086 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds")); |
| 8087 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
| 8088 | if (_res == NULL && PyErr_Occurred()) { |
| 8089 | p->error_indicator = 1; |
| 8090 | D(p->level--); |
| 8091 | return NULL; |
| 8092 | } |
| 8093 | goto done; |
| 8094 | } |
| 8095 | p->mark = _mark; |
| 8096 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 8097 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds")); |
| 8098 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 8099 | if (p->call_invalid_rules) { // invalid_star_etc |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8100 | if (p->error_indicator) { |
| 8101 | D(p->level--); |
| 8102 | return NULL; |
| 8103 | } |
| 8104 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); |
| 8105 | void *invalid_star_etc_var; |
| 8106 | if ( |
| 8107 | (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc |
| 8108 | ) |
| 8109 | { |
| 8110 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); |
| 8111 | _res = invalid_star_etc_var; |
| 8112 | goto done; |
| 8113 | } |
| 8114 | p->mark = _mark; |
| 8115 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 8116 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc")); |
| 8117 | } |
| 8118 | _res = NULL; |
| 8119 | done: |
| 8120 | D(p->level--); |
| 8121 | return _res; |
| 8122 | } |
| 8123 | |
| 8124 | // kwds: '**' param_no_default |
| 8125 | static arg_ty |
| 8126 | kwds_rule(Parser *p) |
| 8127 | { |
| 8128 | D(p->level++); |
| 8129 | if (p->error_indicator) { |
| 8130 | D(p->level--); |
| 8131 | return NULL; |
| 8132 | } |
| 8133 | arg_ty _res = NULL; |
| 8134 | int _mark = p->mark; |
| 8135 | { // '**' param_no_default |
| 8136 | if (p->error_indicator) { |
| 8137 | D(p->level--); |
| 8138 | return NULL; |
| 8139 | } |
| 8140 | D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); |
| 8141 | Token * _literal; |
| 8142 | arg_ty a; |
| 8143 | if ( |
| 8144 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 8145 | && |
| 8146 | (a = param_no_default_rule(p)) // param_no_default |
| 8147 | ) |
| 8148 | { |
| 8149 | D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); |
| 8150 | _res = a; |
| 8151 | if (_res == NULL && PyErr_Occurred()) { |
| 8152 | p->error_indicator = 1; |
| 8153 | D(p->level--); |
| 8154 | return NULL; |
| 8155 | } |
| 8156 | goto done; |
| 8157 | } |
| 8158 | p->mark = _mark; |
| 8159 | D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ', |
| 8160 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default")); |
| 8161 | } |
| 8162 | _res = NULL; |
| 8163 | done: |
| 8164 | D(p->level--); |
| 8165 | return _res; |
| 8166 | } |
| 8167 | |
| 8168 | // param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')' |
| 8169 | static arg_ty |
| 8170 | param_no_default_rule(Parser *p) |
| 8171 | { |
| 8172 | D(p->level++); |
| 8173 | if (p->error_indicator) { |
| 8174 | D(p->level--); |
| 8175 | return NULL; |
| 8176 | } |
| 8177 | arg_ty _res = NULL; |
| 8178 | int _mark = p->mark; |
| 8179 | { // param ',' TYPE_COMMENT? |
| 8180 | if (p->error_indicator) { |
| 8181 | D(p->level--); |
| 8182 | return NULL; |
| 8183 | } |
| 8184 | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); |
| 8185 | Token * _literal; |
| 8186 | arg_ty a; |
| 8187 | void *tc; |
| 8188 | if ( |
| 8189 | (a = param_rule(p)) // param |
| 8190 | && |
| 8191 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 8192 | && |
| 8193 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8194 | ) |
| 8195 | { |
| 8196 | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); |
| 8197 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
| 8198 | if (_res == NULL && PyErr_Occurred()) { |
| 8199 | p->error_indicator = 1; |
| 8200 | D(p->level--); |
| 8201 | return NULL; |
| 8202 | } |
| 8203 | goto done; |
| 8204 | } |
| 8205 | p->mark = _mark; |
| 8206 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8207 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?")); |
| 8208 | } |
| 8209 | { // param TYPE_COMMENT? &')' |
| 8210 | if (p->error_indicator) { |
| 8211 | D(p->level--); |
| 8212 | return NULL; |
| 8213 | } |
| 8214 | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); |
| 8215 | arg_ty a; |
| 8216 | void *tc; |
| 8217 | if ( |
| 8218 | (a = param_rule(p)) // param |
| 8219 | && |
| 8220 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8221 | && |
| 8222 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 8223 | ) |
| 8224 | { |
| 8225 | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); |
| 8226 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
| 8227 | if (_res == NULL && PyErr_Occurred()) { |
| 8228 | p->error_indicator = 1; |
| 8229 | D(p->level--); |
| 8230 | return NULL; |
| 8231 | } |
| 8232 | goto done; |
| 8233 | } |
| 8234 | p->mark = _mark; |
| 8235 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8236 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'")); |
| 8237 | } |
| 8238 | _res = NULL; |
| 8239 | done: |
| 8240 | D(p->level--); |
| 8241 | return _res; |
| 8242 | } |
| 8243 | |
| 8244 | // param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')' |
| 8245 | static NameDefaultPair* |
| 8246 | param_with_default_rule(Parser *p) |
| 8247 | { |
| 8248 | D(p->level++); |
| 8249 | if (p->error_indicator) { |
| 8250 | D(p->level--); |
| 8251 | return NULL; |
| 8252 | } |
| 8253 | NameDefaultPair* _res = NULL; |
| 8254 | int _mark = p->mark; |
| 8255 | { // param default ',' TYPE_COMMENT? |
| 8256 | if (p->error_indicator) { |
| 8257 | D(p->level--); |
| 8258 | return NULL; |
| 8259 | } |
| 8260 | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
| 8261 | Token * _literal; |
| 8262 | arg_ty a; |
| 8263 | expr_ty c; |
| 8264 | void *tc; |
| 8265 | if ( |
| 8266 | (a = param_rule(p)) // param |
| 8267 | && |
| 8268 | (c = default_rule(p)) // default |
| 8269 | && |
| 8270 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 8271 | && |
| 8272 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8273 | ) |
| 8274 | { |
| 8275 | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
| 8276 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 8277 | if (_res == NULL && PyErr_Occurred()) { |
| 8278 | p->error_indicator = 1; |
| 8279 | D(p->level--); |
| 8280 | return NULL; |
| 8281 | } |
| 8282 | goto done; |
| 8283 | } |
| 8284 | p->mark = _mark; |
| 8285 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8286 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
| 8287 | } |
| 8288 | { // param default TYPE_COMMENT? &')' |
| 8289 | if (p->error_indicator) { |
| 8290 | D(p->level--); |
| 8291 | return NULL; |
| 8292 | } |
| 8293 | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
| 8294 | arg_ty a; |
| 8295 | expr_ty c; |
| 8296 | void *tc; |
| 8297 | if ( |
| 8298 | (a = param_rule(p)) // param |
| 8299 | && |
| 8300 | (c = default_rule(p)) // default |
| 8301 | && |
| 8302 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8303 | && |
| 8304 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 8305 | ) |
| 8306 | { |
| 8307 | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
| 8308 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 8309 | if (_res == NULL && PyErr_Occurred()) { |
| 8310 | p->error_indicator = 1; |
| 8311 | D(p->level--); |
| 8312 | return NULL; |
| 8313 | } |
| 8314 | goto done; |
| 8315 | } |
| 8316 | p->mark = _mark; |
| 8317 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8318 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
| 8319 | } |
| 8320 | _res = NULL; |
| 8321 | done: |
| 8322 | D(p->level--); |
| 8323 | return _res; |
| 8324 | } |
| 8325 | |
| 8326 | // param_maybe_default: |
| 8327 | // | param default? ',' TYPE_COMMENT? |
| 8328 | // | param default? TYPE_COMMENT? &')' |
| 8329 | static NameDefaultPair* |
| 8330 | param_maybe_default_rule(Parser *p) |
| 8331 | { |
| 8332 | D(p->level++); |
| 8333 | if (p->error_indicator) { |
| 8334 | D(p->level--); |
| 8335 | return NULL; |
| 8336 | } |
| 8337 | NameDefaultPair* _res = NULL; |
| 8338 | int _mark = p->mark; |
| 8339 | { // param default? ',' TYPE_COMMENT? |
| 8340 | if (p->error_indicator) { |
| 8341 | D(p->level--); |
| 8342 | return NULL; |
| 8343 | } |
| 8344 | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
| 8345 | Token * _literal; |
| 8346 | arg_ty a; |
| 8347 | void *c; |
| 8348 | void *tc; |
| 8349 | if ( |
| 8350 | (a = param_rule(p)) // param |
| 8351 | && |
| 8352 | (c = default_rule(p), 1) // default? |
| 8353 | && |
| 8354 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 8355 | && |
| 8356 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8357 | ) |
| 8358 | { |
| 8359 | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
| 8360 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 8361 | if (_res == NULL && PyErr_Occurred()) { |
| 8362 | p->error_indicator = 1; |
| 8363 | D(p->level--); |
| 8364 | return NULL; |
| 8365 | } |
| 8366 | goto done; |
| 8367 | } |
| 8368 | p->mark = _mark; |
| 8369 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8370 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
| 8371 | } |
| 8372 | { // param default? TYPE_COMMENT? &')' |
| 8373 | if (p->error_indicator) { |
| 8374 | D(p->level--); |
| 8375 | return NULL; |
| 8376 | } |
| 8377 | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
| 8378 | arg_ty a; |
| 8379 | void *c; |
| 8380 | void *tc; |
| 8381 | if ( |
| 8382 | (a = param_rule(p)) // param |
| 8383 | && |
| 8384 | (c = default_rule(p), 1) // default? |
| 8385 | && |
| 8386 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
| 8387 | && |
| 8388 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 8389 | ) |
| 8390 | { |
| 8391 | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
| 8392 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 8393 | if (_res == NULL && PyErr_Occurred()) { |
| 8394 | p->error_indicator = 1; |
| 8395 | D(p->level--); |
| 8396 | return NULL; |
| 8397 | } |
| 8398 | goto done; |
| 8399 | } |
| 8400 | p->mark = _mark; |
| 8401 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8402 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
| 8403 | } |
| 8404 | _res = NULL; |
| 8405 | done: |
| 8406 | D(p->level--); |
| 8407 | return _res; |
| 8408 | } |
| 8409 | |
| 8410 | // param: NAME annotation? |
| 8411 | static arg_ty |
| 8412 | param_rule(Parser *p) |
| 8413 | { |
| 8414 | D(p->level++); |
| 8415 | if (p->error_indicator) { |
| 8416 | D(p->level--); |
| 8417 | return NULL; |
| 8418 | } |
| 8419 | arg_ty _res = NULL; |
| 8420 | int _mark = p->mark; |
| 8421 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8422 | p->error_indicator = 1; |
| 8423 | D(p->level--); |
| 8424 | return NULL; |
| 8425 | } |
| 8426 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8427 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8428 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8429 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 8430 | { // NAME annotation? |
| 8431 | if (p->error_indicator) { |
| 8432 | D(p->level--); |
| 8433 | return NULL; |
| 8434 | } |
| 8435 | D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); |
| 8436 | expr_ty a; |
| 8437 | void *b; |
| 8438 | if ( |
| 8439 | (a = _PyPegen_name_token(p)) // NAME |
| 8440 | && |
| 8441 | (b = annotation_rule(p), 1) // annotation? |
| 8442 | ) |
| 8443 | { |
| 8444 | D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); |
| 8445 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8446 | if (_token == NULL) { |
| 8447 | D(p->level--); |
| 8448 | return NULL; |
| 8449 | } |
| 8450 | int _end_lineno = _token->end_lineno; |
| 8451 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8452 | int _end_col_offset = _token->end_col_offset; |
| 8453 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8454 | _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA ); |
| 8455 | if (_res == NULL && PyErr_Occurred()) { |
| 8456 | p->error_indicator = 1; |
| 8457 | D(p->level--); |
| 8458 | return NULL; |
| 8459 | } |
| 8460 | goto done; |
| 8461 | } |
| 8462 | p->mark = _mark; |
| 8463 | D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ', |
| 8464 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?")); |
| 8465 | } |
| 8466 | _res = NULL; |
| 8467 | done: |
| 8468 | D(p->level--); |
| 8469 | return _res; |
| 8470 | } |
| 8471 | |
| 8472 | // annotation: ':' expression |
| 8473 | static expr_ty |
| 8474 | annotation_rule(Parser *p) |
| 8475 | { |
| 8476 | D(p->level++); |
| 8477 | if (p->error_indicator) { |
| 8478 | D(p->level--); |
| 8479 | return NULL; |
| 8480 | } |
| 8481 | expr_ty _res = NULL; |
| 8482 | int _mark = p->mark; |
| 8483 | { // ':' expression |
| 8484 | if (p->error_indicator) { |
| 8485 | D(p->level--); |
| 8486 | return NULL; |
| 8487 | } |
| 8488 | D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression")); |
| 8489 | Token * _literal; |
| 8490 | expr_ty a; |
| 8491 | if ( |
| 8492 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 8493 | && |
| 8494 | (a = expression_rule(p)) // expression |
| 8495 | ) |
| 8496 | { |
| 8497 | D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression")); |
| 8498 | _res = a; |
| 8499 | if (_res == NULL && PyErr_Occurred()) { |
| 8500 | p->error_indicator = 1; |
| 8501 | D(p->level--); |
| 8502 | return NULL; |
| 8503 | } |
| 8504 | goto done; |
| 8505 | } |
| 8506 | p->mark = _mark; |
| 8507 | D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ', |
| 8508 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression")); |
| 8509 | } |
| 8510 | _res = NULL; |
| 8511 | done: |
| 8512 | D(p->level--); |
| 8513 | return _res; |
| 8514 | } |
| 8515 | |
| 8516 | // default: '=' expression |
| 8517 | static expr_ty |
| 8518 | default_rule(Parser *p) |
| 8519 | { |
| 8520 | D(p->level++); |
| 8521 | if (p->error_indicator) { |
| 8522 | D(p->level--); |
| 8523 | return NULL; |
| 8524 | } |
| 8525 | expr_ty _res = NULL; |
| 8526 | int _mark = p->mark; |
| 8527 | { // '=' expression |
| 8528 | if (p->error_indicator) { |
| 8529 | D(p->level--); |
| 8530 | return NULL; |
| 8531 | } |
| 8532 | D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
| 8533 | Token * _literal; |
| 8534 | expr_ty a; |
| 8535 | if ( |
| 8536 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 8537 | && |
| 8538 | (a = expression_rule(p)) // expression |
| 8539 | ) |
| 8540 | { |
| 8541 | D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
| 8542 | _res = a; |
| 8543 | if (_res == NULL && PyErr_Occurred()) { |
| 8544 | p->error_indicator = 1; |
| 8545 | D(p->level--); |
| 8546 | return NULL; |
| 8547 | } |
| 8548 | goto done; |
| 8549 | } |
| 8550 | p->mark = _mark; |
| 8551 | D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ', |
| 8552 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression")); |
| 8553 | } |
| 8554 | _res = NULL; |
| 8555 | done: |
| 8556 | D(p->level--); |
| 8557 | return _res; |
| 8558 | } |
| 8559 | |
| 8560 | // decorators: (('@' named_expression NEWLINE))+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8561 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8562 | decorators_rule(Parser *p) |
| 8563 | { |
| 8564 | D(p->level++); |
| 8565 | if (p->error_indicator) { |
| 8566 | D(p->level--); |
| 8567 | return NULL; |
| 8568 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8569 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8570 | int _mark = p->mark; |
| 8571 | { // (('@' named_expression NEWLINE))+ |
| 8572 | if (p->error_indicator) { |
| 8573 | D(p->level--); |
| 8574 | return NULL; |
| 8575 | } |
| 8576 | 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] | 8577 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8578 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8579 | (a = (asdl_expr_seq*)_loop1_84_rule(p)) // (('@' named_expression NEWLINE))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8580 | ) |
| 8581 | { |
| 8582 | D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
| 8583 | _res = a; |
| 8584 | if (_res == NULL && PyErr_Occurred()) { |
| 8585 | p->error_indicator = 1; |
| 8586 | D(p->level--); |
| 8587 | return NULL; |
| 8588 | } |
| 8589 | goto done; |
| 8590 | } |
| 8591 | p->mark = _mark; |
| 8592 | D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ', |
| 8593 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
| 8594 | } |
| 8595 | _res = NULL; |
| 8596 | done: |
| 8597 | D(p->level--); |
| 8598 | return _res; |
| 8599 | } |
| 8600 | |
| 8601 | // class_def: decorators class_def_raw | class_def_raw |
| 8602 | static stmt_ty |
| 8603 | class_def_rule(Parser *p) |
| 8604 | { |
| 8605 | D(p->level++); |
| 8606 | if (p->error_indicator) { |
| 8607 | D(p->level--); |
| 8608 | return NULL; |
| 8609 | } |
| 8610 | stmt_ty _res = NULL; |
| 8611 | int _mark = p->mark; |
| 8612 | { // decorators class_def_raw |
| 8613 | if (p->error_indicator) { |
| 8614 | D(p->level--); |
| 8615 | return NULL; |
| 8616 | } |
| 8617 | 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] | 8618 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8619 | stmt_ty b; |
| 8620 | if ( |
| 8621 | (a = decorators_rule(p)) // decorators |
| 8622 | && |
| 8623 | (b = class_def_raw_rule(p)) // class_def_raw |
| 8624 | ) |
| 8625 | { |
| 8626 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); |
| 8627 | _res = _PyPegen_class_def_decorators ( p , a , b ); |
| 8628 | if (_res == NULL && PyErr_Occurred()) { |
| 8629 | p->error_indicator = 1; |
| 8630 | D(p->level--); |
| 8631 | return NULL; |
| 8632 | } |
| 8633 | goto done; |
| 8634 | } |
| 8635 | p->mark = _mark; |
| 8636 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 8637 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw")); |
| 8638 | } |
| 8639 | { // class_def_raw |
| 8640 | if (p->error_indicator) { |
| 8641 | D(p->level--); |
| 8642 | return NULL; |
| 8643 | } |
| 8644 | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw")); |
| 8645 | stmt_ty class_def_raw_var; |
| 8646 | if ( |
| 8647 | (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw |
| 8648 | ) |
| 8649 | { |
| 8650 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw")); |
| 8651 | _res = class_def_raw_var; |
| 8652 | goto done; |
| 8653 | } |
| 8654 | p->mark = _mark; |
| 8655 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 8656 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw")); |
| 8657 | } |
| 8658 | _res = NULL; |
| 8659 | done: |
| 8660 | D(p->level--); |
| 8661 | return _res; |
| 8662 | } |
| 8663 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8664 | // class_def_raw: 'class' NAME ['(' arguments? ')'] &&':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8665 | static stmt_ty |
| 8666 | class_def_raw_rule(Parser *p) |
| 8667 | { |
| 8668 | D(p->level++); |
| 8669 | if (p->error_indicator) { |
| 8670 | D(p->level--); |
| 8671 | return NULL; |
| 8672 | } |
| 8673 | stmt_ty _res = NULL; |
| 8674 | int _mark = p->mark; |
| 8675 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8676 | p->error_indicator = 1; |
| 8677 | D(p->level--); |
| 8678 | return NULL; |
| 8679 | } |
| 8680 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8681 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8682 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8683 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8684 | { // 'class' NAME ['(' arguments? ')'] &&':' block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8685 | if (p->error_indicator) { |
| 8686 | D(p->level--); |
| 8687 | return NULL; |
| 8688 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8689 | 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] | 8690 | Token * _keyword; |
| 8691 | Token * _literal; |
| 8692 | expr_ty a; |
| 8693 | void *b; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8694 | asdl_stmt_seq* c; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8695 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8696 | (_keyword = _PyPegen_expect_token(p, 527)) // token='class' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8697 | && |
| 8698 | (a = _PyPegen_name_token(p)) // NAME |
| 8699 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8700 | (b = _tmp_85_rule(p), 1) // ['(' arguments? ')'] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8701 | && |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8702 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8703 | && |
| 8704 | (c = block_rule(p)) // block |
| 8705 | ) |
| 8706 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 8707 | 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] | 8708 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8709 | if (_token == NULL) { |
| 8710 | D(p->level--); |
| 8711 | return NULL; |
| 8712 | } |
| 8713 | int _end_lineno = _token->end_lineno; |
| 8714 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8715 | int _end_col_offset = _token->end_col_offset; |
| 8716 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8717 | _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 ); |
| 8718 | if (_res == NULL && PyErr_Occurred()) { |
| 8719 | p->error_indicator = 1; |
| 8720 | D(p->level--); |
| 8721 | return NULL; |
| 8722 | } |
| 8723 | goto done; |
| 8724 | } |
| 8725 | p->mark = _mark; |
| 8726 | 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] | 8727 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8728 | } |
| 8729 | _res = NULL; |
| 8730 | done: |
| 8731 | D(p->level--); |
| 8732 | return _res; |
| 8733 | } |
| 8734 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8735 | // block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8736 | static asdl_stmt_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8737 | block_rule(Parser *p) |
| 8738 | { |
| 8739 | D(p->level++); |
| 8740 | if (p->error_indicator) { |
| 8741 | D(p->level--); |
| 8742 | return NULL; |
| 8743 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 8744 | asdl_stmt_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8745 | if (_PyPegen_is_memoized(p, block_type, &_res)) { |
| 8746 | D(p->level--); |
| 8747 | return _res; |
| 8748 | } |
| 8749 | int _mark = p->mark; |
| 8750 | { // NEWLINE INDENT statements DEDENT |
| 8751 | if (p->error_indicator) { |
| 8752 | D(p->level--); |
| 8753 | return NULL; |
| 8754 | } |
| 8755 | 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] | 8756 | asdl_stmt_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8757 | Token * dedent_var; |
| 8758 | Token * indent_var; |
| 8759 | Token * newline_var; |
| 8760 | if ( |
| 8761 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 8762 | && |
| 8763 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
| 8764 | && |
| 8765 | (a = statements_rule(p)) // statements |
| 8766 | && |
| 8767 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
| 8768 | ) |
| 8769 | { |
| 8770 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
| 8771 | _res = a; |
| 8772 | if (_res == NULL && PyErr_Occurred()) { |
| 8773 | p->error_indicator = 1; |
| 8774 | D(p->level--); |
| 8775 | return NULL; |
| 8776 | } |
| 8777 | goto done; |
| 8778 | } |
| 8779 | p->mark = _mark; |
| 8780 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 8781 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
| 8782 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8783 | { // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8784 | if (p->error_indicator) { |
| 8785 | D(p->level--); |
| 8786 | return NULL; |
| 8787 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8788 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
| 8789 | asdl_stmt_seq* simple_stmts_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8790 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8791 | (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8792 | ) |
| 8793 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 8794 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
| 8795 | _res = simple_stmts_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8796 | goto done; |
| 8797 | } |
| 8798 | p->mark = _mark; |
| 8799 | 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] | 8800 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8801 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 8802 | if (p->call_invalid_rules) { // invalid_block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8803 | if (p->error_indicator) { |
| 8804 | D(p->level--); |
| 8805 | return NULL; |
| 8806 | } |
| 8807 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block")); |
| 8808 | void *invalid_block_var; |
| 8809 | if ( |
| 8810 | (invalid_block_var = invalid_block_rule(p)) // invalid_block |
| 8811 | ) |
| 8812 | { |
| 8813 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block")); |
| 8814 | _res = invalid_block_var; |
| 8815 | goto done; |
| 8816 | } |
| 8817 | p->mark = _mark; |
| 8818 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 8819 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block")); |
| 8820 | } |
| 8821 | _res = NULL; |
| 8822 | done: |
| 8823 | _PyPegen_insert_memo(p, _mark, block_type, _res); |
| 8824 | D(p->level--); |
| 8825 | return _res; |
| 8826 | } |
| 8827 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8828 | // star_expressions: |
| 8829 | // | star_expression ((',' star_expression))+ ','? |
| 8830 | // | star_expression ',' |
| 8831 | // | star_expression |
| 8832 | static expr_ty |
| 8833 | star_expressions_rule(Parser *p) |
| 8834 | { |
| 8835 | D(p->level++); |
| 8836 | if (p->error_indicator) { |
| 8837 | D(p->level--); |
| 8838 | return NULL; |
| 8839 | } |
| 8840 | expr_ty _res = NULL; |
| 8841 | int _mark = p->mark; |
| 8842 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8843 | p->error_indicator = 1; |
| 8844 | D(p->level--); |
| 8845 | return NULL; |
| 8846 | } |
| 8847 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8848 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8849 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8850 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 8851 | { // star_expression ((',' star_expression))+ ','? |
| 8852 | if (p->error_indicator) { |
| 8853 | D(p->level--); |
| 8854 | return NULL; |
| 8855 | } |
| 8856 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
| 8857 | void *_opt_var; |
| 8858 | UNUSED(_opt_var); // Silence compiler warnings |
| 8859 | expr_ty a; |
| 8860 | asdl_seq * b; |
| 8861 | if ( |
| 8862 | (a = star_expression_rule(p)) // star_expression |
| 8863 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 8864 | (b = _loop1_86_rule(p)) // ((',' star_expression))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 8865 | && |
| 8866 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 8867 | ) |
| 8868 | { |
| 8869 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
| 8870 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8871 | if (_token == NULL) { |
| 8872 | D(p->level--); |
| 8873 | return NULL; |
| 8874 | } |
| 8875 | int _end_lineno = _token->end_lineno; |
| 8876 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8877 | int _end_col_offset = _token->end_col_offset; |
| 8878 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 8879 | _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] | 8880 | if (_res == NULL && PyErr_Occurred()) { |
| 8881 | p->error_indicator = 1; |
| 8882 | D(p->level--); |
| 8883 | return NULL; |
| 8884 | } |
| 8885 | goto done; |
| 8886 | } |
| 8887 | p->mark = _mark; |
| 8888 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 8889 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
| 8890 | } |
| 8891 | { // star_expression ',' |
| 8892 | if (p->error_indicator) { |
| 8893 | D(p->level--); |
| 8894 | return NULL; |
| 8895 | } |
| 8896 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','")); |
| 8897 | Token * _literal; |
| 8898 | expr_ty a; |
| 8899 | if ( |
| 8900 | (a = star_expression_rule(p)) // star_expression |
| 8901 | && |
| 8902 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 8903 | ) |
| 8904 | { |
| 8905 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','")); |
| 8906 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8907 | if (_token == NULL) { |
| 8908 | D(p->level--); |
| 8909 | return NULL; |
| 8910 | } |
| 8911 | int _end_lineno = _token->end_lineno; |
| 8912 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8913 | int _end_col_offset = _token->end_col_offset; |
| 8914 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 8915 | _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] | 8916 | if (_res == NULL && PyErr_Occurred()) { |
| 8917 | p->error_indicator = 1; |
| 8918 | D(p->level--); |
| 8919 | return NULL; |
| 8920 | } |
| 8921 | goto done; |
| 8922 | } |
| 8923 | p->mark = _mark; |
| 8924 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 8925 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','")); |
| 8926 | } |
| 8927 | { // star_expression |
| 8928 | if (p->error_indicator) { |
| 8929 | D(p->level--); |
| 8930 | return NULL; |
| 8931 | } |
| 8932 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression")); |
| 8933 | expr_ty star_expression_var; |
| 8934 | if ( |
| 8935 | (star_expression_var = star_expression_rule(p)) // star_expression |
| 8936 | ) |
| 8937 | { |
| 8938 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression")); |
| 8939 | _res = star_expression_var; |
| 8940 | goto done; |
| 8941 | } |
| 8942 | p->mark = _mark; |
| 8943 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 8944 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression")); |
| 8945 | } |
| 8946 | _res = NULL; |
| 8947 | done: |
| 8948 | D(p->level--); |
| 8949 | return _res; |
| 8950 | } |
| 8951 | |
| 8952 | // star_expression: '*' bitwise_or | expression |
| 8953 | static expr_ty |
| 8954 | star_expression_rule(Parser *p) |
| 8955 | { |
| 8956 | D(p->level++); |
| 8957 | if (p->error_indicator) { |
| 8958 | D(p->level--); |
| 8959 | return NULL; |
| 8960 | } |
| 8961 | expr_ty _res = NULL; |
| 8962 | if (_PyPegen_is_memoized(p, star_expression_type, &_res)) { |
| 8963 | D(p->level--); |
| 8964 | return _res; |
| 8965 | } |
| 8966 | int _mark = p->mark; |
| 8967 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8968 | p->error_indicator = 1; |
| 8969 | D(p->level--); |
| 8970 | return NULL; |
| 8971 | } |
| 8972 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8973 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8974 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8975 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 8976 | { // '*' bitwise_or |
| 8977 | if (p->error_indicator) { |
| 8978 | D(p->level--); |
| 8979 | return NULL; |
| 8980 | } |
| 8981 | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
| 8982 | Token * _literal; |
| 8983 | expr_ty a; |
| 8984 | if ( |
| 8985 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 8986 | && |
| 8987 | (a = bitwise_or_rule(p)) // bitwise_or |
| 8988 | ) |
| 8989 | { |
| 8990 | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
| 8991 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8992 | if (_token == NULL) { |
| 8993 | D(p->level--); |
| 8994 | return NULL; |
| 8995 | } |
| 8996 | int _end_lineno = _token->end_lineno; |
| 8997 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8998 | int _end_col_offset = _token->end_col_offset; |
| 8999 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9000 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 9001 | if (_res == NULL && PyErr_Occurred()) { |
| 9002 | p->error_indicator = 1; |
| 9003 | D(p->level--); |
| 9004 | return NULL; |
| 9005 | } |
| 9006 | goto done; |
| 9007 | } |
| 9008 | p->mark = _mark; |
| 9009 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9010 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
| 9011 | } |
| 9012 | { // expression |
| 9013 | if (p->error_indicator) { |
| 9014 | D(p->level--); |
| 9015 | return NULL; |
| 9016 | } |
| 9017 | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
| 9018 | expr_ty expression_var; |
| 9019 | if ( |
| 9020 | (expression_var = expression_rule(p)) // expression |
| 9021 | ) |
| 9022 | { |
| 9023 | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
| 9024 | _res = expression_var; |
| 9025 | goto done; |
| 9026 | } |
| 9027 | p->mark = _mark; |
| 9028 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9029 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
| 9030 | } |
| 9031 | _res = NULL; |
| 9032 | done: |
| 9033 | _PyPegen_insert_memo(p, _mark, star_expression_type, _res); |
| 9034 | D(p->level--); |
| 9035 | return _res; |
| 9036 | } |
| 9037 | |
| 9038 | // star_named_expressions: ','.star_named_expression+ ','? |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9039 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9040 | star_named_expressions_rule(Parser *p) |
| 9041 | { |
| 9042 | D(p->level++); |
| 9043 | if (p->error_indicator) { |
| 9044 | D(p->level--); |
| 9045 | return NULL; |
| 9046 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9047 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9048 | int _mark = p->mark; |
| 9049 | { // ','.star_named_expression+ ','? |
| 9050 | if (p->error_indicator) { |
| 9051 | D(p->level--); |
| 9052 | return NULL; |
| 9053 | } |
| 9054 | D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); |
| 9055 | void *_opt_var; |
| 9056 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9057 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9058 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9059 | (a = (asdl_expr_seq*)_gather_87_rule(p)) // ','.star_named_expression+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9060 | && |
| 9061 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 9062 | ) |
| 9063 | { |
| 9064 | D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); |
| 9065 | _res = a; |
| 9066 | if (_res == NULL && PyErr_Occurred()) { |
| 9067 | p->error_indicator = 1; |
| 9068 | D(p->level--); |
| 9069 | return NULL; |
| 9070 | } |
| 9071 | goto done; |
| 9072 | } |
| 9073 | p->mark = _mark; |
| 9074 | D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 9075 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?")); |
| 9076 | } |
| 9077 | _res = NULL; |
| 9078 | done: |
| 9079 | D(p->level--); |
| 9080 | return _res; |
| 9081 | } |
| 9082 | |
| 9083 | // star_named_expression: '*' bitwise_or | named_expression |
| 9084 | static expr_ty |
| 9085 | star_named_expression_rule(Parser *p) |
| 9086 | { |
| 9087 | D(p->level++); |
| 9088 | if (p->error_indicator) { |
| 9089 | D(p->level--); |
| 9090 | return NULL; |
| 9091 | } |
| 9092 | expr_ty _res = NULL; |
| 9093 | int _mark = p->mark; |
| 9094 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9095 | p->error_indicator = 1; |
| 9096 | D(p->level--); |
| 9097 | return NULL; |
| 9098 | } |
| 9099 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9100 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9101 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9102 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 9103 | { // '*' bitwise_or |
| 9104 | if (p->error_indicator) { |
| 9105 | D(p->level--); |
| 9106 | return NULL; |
| 9107 | } |
| 9108 | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
| 9109 | Token * _literal; |
| 9110 | expr_ty a; |
| 9111 | if ( |
| 9112 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 9113 | && |
| 9114 | (a = bitwise_or_rule(p)) // bitwise_or |
| 9115 | ) |
| 9116 | { |
| 9117 | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
| 9118 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9119 | if (_token == NULL) { |
| 9120 | D(p->level--); |
| 9121 | return NULL; |
| 9122 | } |
| 9123 | int _end_lineno = _token->end_lineno; |
| 9124 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9125 | int _end_col_offset = _token->end_col_offset; |
| 9126 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9127 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 9128 | if (_res == NULL && PyErr_Occurred()) { |
| 9129 | p->error_indicator = 1; |
| 9130 | D(p->level--); |
| 9131 | return NULL; |
| 9132 | } |
| 9133 | goto done; |
| 9134 | } |
| 9135 | p->mark = _mark; |
| 9136 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9137 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
| 9138 | } |
| 9139 | { // named_expression |
| 9140 | if (p->error_indicator) { |
| 9141 | D(p->level--); |
| 9142 | return NULL; |
| 9143 | } |
| 9144 | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
| 9145 | expr_ty named_expression_var; |
| 9146 | if ( |
| 9147 | (named_expression_var = named_expression_rule(p)) // named_expression |
| 9148 | ) |
| 9149 | { |
| 9150 | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
| 9151 | _res = named_expression_var; |
| 9152 | goto done; |
| 9153 | } |
| 9154 | p->mark = _mark; |
| 9155 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9156 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
| 9157 | } |
| 9158 | _res = NULL; |
| 9159 | done: |
| 9160 | D(p->level--); |
| 9161 | return _res; |
| 9162 | } |
| 9163 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9164 | // named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9165 | static expr_ty |
| 9166 | named_expression_rule(Parser *p) |
| 9167 | { |
| 9168 | D(p->level++); |
| 9169 | if (p->error_indicator) { |
| 9170 | D(p->level--); |
| 9171 | return NULL; |
| 9172 | } |
| 9173 | expr_ty _res = NULL; |
| 9174 | int _mark = p->mark; |
| 9175 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9176 | p->error_indicator = 1; |
| 9177 | D(p->level--); |
| 9178 | return NULL; |
| 9179 | } |
| 9180 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9181 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9182 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9183 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9184 | { // NAME ':=' ~ expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9185 | if (p->error_indicator) { |
| 9186 | D(p->level--); |
| 9187 | return NULL; |
| 9188 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9189 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression")); |
| 9190 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9191 | Token * _literal; |
| 9192 | expr_ty a; |
| 9193 | expr_ty b; |
| 9194 | if ( |
| 9195 | (a = _PyPegen_name_token(p)) // NAME |
| 9196 | && |
| 9197 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
| 9198 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9199 | (_cut_var = 1) |
| 9200 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9201 | (b = expression_rule(p)) // expression |
| 9202 | ) |
| 9203 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 9204 | 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] | 9205 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9206 | if (_token == NULL) { |
| 9207 | D(p->level--); |
| 9208 | return NULL; |
| 9209 | } |
| 9210 | int _end_lineno = _token->end_lineno; |
| 9211 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9212 | int _end_col_offset = _token->end_col_offset; |
| 9213 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 9214 | _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] | 9215 | if (_res == NULL && PyErr_Occurred()) { |
| 9216 | p->error_indicator = 1; |
| 9217 | D(p->level--); |
| 9218 | return NULL; |
| 9219 | } |
| 9220 | goto done; |
| 9221 | } |
| 9222 | p->mark = _mark; |
| 9223 | 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] | 9224 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression")); |
| 9225 | if (_cut_var) { |
| 9226 | D(p->level--); |
| 9227 | return NULL; |
| 9228 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9229 | } |
| 9230 | { // expression !':=' |
| 9231 | if (p->error_indicator) { |
| 9232 | D(p->level--); |
| 9233 | return NULL; |
| 9234 | } |
| 9235 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
| 9236 | expr_ty expression_var; |
| 9237 | if ( |
| 9238 | (expression_var = expression_rule(p)) // expression |
| 9239 | && |
| 9240 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
| 9241 | ) |
| 9242 | { |
| 9243 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
| 9244 | _res = expression_var; |
| 9245 | goto done; |
| 9246 | } |
| 9247 | p->mark = _mark; |
| 9248 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9249 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); |
| 9250 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 9251 | if (p->call_invalid_rules) { // invalid_named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9252 | if (p->error_indicator) { |
| 9253 | D(p->level--); |
| 9254 | return NULL; |
| 9255 | } |
| 9256 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); |
| 9257 | void *invalid_named_expression_var; |
| 9258 | if ( |
| 9259 | (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression |
| 9260 | ) |
| 9261 | { |
| 9262 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); |
| 9263 | _res = invalid_named_expression_var; |
| 9264 | goto done; |
| 9265 | } |
| 9266 | p->mark = _mark; |
| 9267 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9268 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression")); |
| 9269 | } |
| 9270 | _res = NULL; |
| 9271 | done: |
| 9272 | D(p->level--); |
| 9273 | return _res; |
| 9274 | } |
| 9275 | |
| 9276 | // annotated_rhs: yield_expr | star_expressions |
| 9277 | static expr_ty |
| 9278 | annotated_rhs_rule(Parser *p) |
| 9279 | { |
| 9280 | D(p->level++); |
| 9281 | if (p->error_indicator) { |
| 9282 | D(p->level--); |
| 9283 | return NULL; |
| 9284 | } |
| 9285 | expr_ty _res = NULL; |
| 9286 | int _mark = p->mark; |
| 9287 | { // yield_expr |
| 9288 | if (p->error_indicator) { |
| 9289 | D(p->level--); |
| 9290 | return NULL; |
| 9291 | } |
| 9292 | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 9293 | expr_ty yield_expr_var; |
| 9294 | if ( |
| 9295 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 9296 | ) |
| 9297 | { |
| 9298 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 9299 | _res = yield_expr_var; |
| 9300 | goto done; |
| 9301 | } |
| 9302 | p->mark = _mark; |
| 9303 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
| 9304 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 9305 | } |
| 9306 | { // star_expressions |
| 9307 | if (p->error_indicator) { |
| 9308 | D(p->level--); |
| 9309 | return NULL; |
| 9310 | } |
| 9311 | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 9312 | expr_ty star_expressions_var; |
| 9313 | if ( |
| 9314 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 9315 | ) |
| 9316 | { |
| 9317 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 9318 | _res = star_expressions_var; |
| 9319 | goto done; |
| 9320 | } |
| 9321 | p->mark = _mark; |
| 9322 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
| 9323 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 9324 | } |
| 9325 | _res = NULL; |
| 9326 | done: |
| 9327 | D(p->level--); |
| 9328 | return _res; |
| 9329 | } |
| 9330 | |
| 9331 | // expressions: expression ((',' expression))+ ','? | expression ',' | expression |
| 9332 | static expr_ty |
| 9333 | expressions_rule(Parser *p) |
| 9334 | { |
| 9335 | D(p->level++); |
| 9336 | if (p->error_indicator) { |
| 9337 | D(p->level--); |
| 9338 | return NULL; |
| 9339 | } |
| 9340 | expr_ty _res = NULL; |
| 9341 | int _mark = p->mark; |
| 9342 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9343 | p->error_indicator = 1; |
| 9344 | D(p->level--); |
| 9345 | return NULL; |
| 9346 | } |
| 9347 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9348 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9349 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9350 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 9351 | { // expression ((',' expression))+ ','? |
| 9352 | if (p->error_indicator) { |
| 9353 | D(p->level--); |
| 9354 | return NULL; |
| 9355 | } |
| 9356 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); |
| 9357 | void *_opt_var; |
| 9358 | UNUSED(_opt_var); // Silence compiler warnings |
| 9359 | expr_ty a; |
| 9360 | asdl_seq * b; |
| 9361 | if ( |
| 9362 | (a = expression_rule(p)) // expression |
| 9363 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9364 | (b = _loop1_89_rule(p)) // ((',' expression))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9365 | && |
| 9366 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 9367 | ) |
| 9368 | { |
| 9369 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); |
| 9370 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9371 | if (_token == NULL) { |
| 9372 | D(p->level--); |
| 9373 | return NULL; |
| 9374 | } |
| 9375 | int _end_lineno = _token->end_lineno; |
| 9376 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9377 | int _end_col_offset = _token->end_col_offset; |
| 9378 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 9379 | _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] | 9380 | if (_res == NULL && PyErr_Occurred()) { |
| 9381 | p->error_indicator = 1; |
| 9382 | D(p->level--); |
| 9383 | return NULL; |
| 9384 | } |
| 9385 | goto done; |
| 9386 | } |
| 9387 | p->mark = _mark; |
| 9388 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 9389 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?")); |
| 9390 | } |
| 9391 | { // expression ',' |
| 9392 | if (p->error_indicator) { |
| 9393 | D(p->level--); |
| 9394 | return NULL; |
| 9395 | } |
| 9396 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','")); |
| 9397 | Token * _literal; |
| 9398 | expr_ty a; |
| 9399 | if ( |
| 9400 | (a = expression_rule(p)) // expression |
| 9401 | && |
| 9402 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 9403 | ) |
| 9404 | { |
| 9405 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','")); |
| 9406 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9407 | if (_token == NULL) { |
| 9408 | D(p->level--); |
| 9409 | return NULL; |
| 9410 | } |
| 9411 | int _end_lineno = _token->end_lineno; |
| 9412 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9413 | int _end_col_offset = _token->end_col_offset; |
| 9414 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 9415 | _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] | 9416 | if (_res == NULL && PyErr_Occurred()) { |
| 9417 | p->error_indicator = 1; |
| 9418 | D(p->level--); |
| 9419 | return NULL; |
| 9420 | } |
| 9421 | goto done; |
| 9422 | } |
| 9423 | p->mark = _mark; |
| 9424 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 9425 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','")); |
| 9426 | } |
| 9427 | { // expression |
| 9428 | if (p->error_indicator) { |
| 9429 | D(p->level--); |
| 9430 | return NULL; |
| 9431 | } |
| 9432 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
| 9433 | expr_ty expression_var; |
| 9434 | if ( |
| 9435 | (expression_var = expression_rule(p)) // expression |
| 9436 | ) |
| 9437 | { |
| 9438 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
| 9439 | _res = expression_var; |
| 9440 | goto done; |
| 9441 | } |
| 9442 | p->mark = _mark; |
| 9443 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 9444 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
| 9445 | } |
| 9446 | _res = NULL; |
| 9447 | done: |
| 9448 | D(p->level--); |
| 9449 | return _res; |
| 9450 | } |
| 9451 | |
| 9452 | // expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef |
| 9453 | static expr_ty |
| 9454 | expression_rule(Parser *p) |
| 9455 | { |
| 9456 | D(p->level++); |
| 9457 | if (p->error_indicator) { |
| 9458 | D(p->level--); |
| 9459 | return NULL; |
| 9460 | } |
| 9461 | expr_ty _res = NULL; |
| 9462 | if (_PyPegen_is_memoized(p, expression_type, &_res)) { |
| 9463 | D(p->level--); |
| 9464 | return _res; |
| 9465 | } |
| 9466 | int _mark = p->mark; |
| 9467 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9468 | p->error_indicator = 1; |
| 9469 | D(p->level--); |
| 9470 | return NULL; |
| 9471 | } |
| 9472 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9473 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9474 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9475 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 9476 | { // disjunction 'if' disjunction 'else' expression |
| 9477 | if (p->error_indicator) { |
| 9478 | D(p->level--); |
| 9479 | return NULL; |
| 9480 | } |
| 9481 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
| 9482 | Token * _keyword; |
| 9483 | Token * _keyword_1; |
| 9484 | expr_ty a; |
| 9485 | expr_ty b; |
| 9486 | expr_ty c; |
| 9487 | if ( |
| 9488 | (a = disjunction_rule(p)) // disjunction |
| 9489 | && |
| 9490 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 9491 | && |
| 9492 | (b = disjunction_rule(p)) // disjunction |
| 9493 | && |
| 9494 | (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else' |
| 9495 | && |
| 9496 | (c = expression_rule(p)) // expression |
| 9497 | ) |
| 9498 | { |
| 9499 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
| 9500 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9501 | if (_token == NULL) { |
| 9502 | D(p->level--); |
| 9503 | return NULL; |
| 9504 | } |
| 9505 | int _end_lineno = _token->end_lineno; |
| 9506 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9507 | int _end_col_offset = _token->end_col_offset; |
| 9508 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9509 | _res = _Py_IfExp ( b , a , c , EXTRA ); |
| 9510 | if (_res == NULL && PyErr_Occurred()) { |
| 9511 | p->error_indicator = 1; |
| 9512 | D(p->level--); |
| 9513 | return NULL; |
| 9514 | } |
| 9515 | goto done; |
| 9516 | } |
| 9517 | p->mark = _mark; |
| 9518 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9519 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
| 9520 | } |
| 9521 | { // disjunction |
| 9522 | if (p->error_indicator) { |
| 9523 | D(p->level--); |
| 9524 | return NULL; |
| 9525 | } |
| 9526 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction")); |
| 9527 | expr_ty disjunction_var; |
| 9528 | if ( |
| 9529 | (disjunction_var = disjunction_rule(p)) // disjunction |
| 9530 | ) |
| 9531 | { |
| 9532 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction")); |
| 9533 | _res = disjunction_var; |
| 9534 | goto done; |
| 9535 | } |
| 9536 | p->mark = _mark; |
| 9537 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9538 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction")); |
| 9539 | } |
| 9540 | { // lambdef |
| 9541 | if (p->error_indicator) { |
| 9542 | D(p->level--); |
| 9543 | return NULL; |
| 9544 | } |
| 9545 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef")); |
| 9546 | expr_ty lambdef_var; |
| 9547 | if ( |
| 9548 | (lambdef_var = lambdef_rule(p)) // lambdef |
| 9549 | ) |
| 9550 | { |
| 9551 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef")); |
| 9552 | _res = lambdef_var; |
| 9553 | goto done; |
| 9554 | } |
| 9555 | p->mark = _mark; |
| 9556 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 9557 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef")); |
| 9558 | } |
| 9559 | _res = NULL; |
| 9560 | done: |
| 9561 | _PyPegen_insert_memo(p, _mark, expression_type, _res); |
| 9562 | D(p->level--); |
| 9563 | return _res; |
| 9564 | } |
| 9565 | |
| 9566 | // lambdef: 'lambda' lambda_params? ':' expression |
| 9567 | static expr_ty |
| 9568 | lambdef_rule(Parser *p) |
| 9569 | { |
| 9570 | D(p->level++); |
| 9571 | if (p->error_indicator) { |
| 9572 | D(p->level--); |
| 9573 | return NULL; |
| 9574 | } |
| 9575 | expr_ty _res = NULL; |
| 9576 | int _mark = p->mark; |
| 9577 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9578 | p->error_indicator = 1; |
| 9579 | D(p->level--); |
| 9580 | return NULL; |
| 9581 | } |
| 9582 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9583 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9584 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9585 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 9586 | { // 'lambda' lambda_params? ':' expression |
| 9587 | if (p->error_indicator) { |
| 9588 | D(p->level--); |
| 9589 | return NULL; |
| 9590 | } |
| 9591 | D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
| 9592 | Token * _keyword; |
| 9593 | Token * _literal; |
| 9594 | void *a; |
| 9595 | expr_ty b; |
| 9596 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9597 | (_keyword = _PyPegen_expect_token(p, 528)) // token='lambda' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9598 | && |
| 9599 | (a = lambda_params_rule(p), 1) // lambda_params? |
| 9600 | && |
| 9601 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 9602 | && |
| 9603 | (b = expression_rule(p)) // expression |
| 9604 | ) |
| 9605 | { |
| 9606 | D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
| 9607 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9608 | if (_token == NULL) { |
| 9609 | D(p->level--); |
| 9610 | return NULL; |
| 9611 | } |
| 9612 | int _end_lineno = _token->end_lineno; |
| 9613 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9614 | int _end_col_offset = _token->end_col_offset; |
| 9615 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 9616 | _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] | 9617 | if (_res == NULL && PyErr_Occurred()) { |
| 9618 | p->error_indicator = 1; |
| 9619 | D(p->level--); |
| 9620 | return NULL; |
| 9621 | } |
| 9622 | goto done; |
| 9623 | } |
| 9624 | p->mark = _mark; |
| 9625 | D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ', |
| 9626 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
| 9627 | } |
| 9628 | _res = NULL; |
| 9629 | done: |
| 9630 | D(p->level--); |
| 9631 | return _res; |
| 9632 | } |
| 9633 | |
| 9634 | // lambda_params: invalid_lambda_parameters | lambda_parameters |
| 9635 | static arguments_ty |
| 9636 | lambda_params_rule(Parser *p) |
| 9637 | { |
| 9638 | D(p->level++); |
| 9639 | if (p->error_indicator) { |
| 9640 | D(p->level--); |
| 9641 | return NULL; |
| 9642 | } |
| 9643 | arguments_ty _res = NULL; |
| 9644 | int _mark = p->mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 9645 | if (p->call_invalid_rules) { // invalid_lambda_parameters |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9646 | if (p->error_indicator) { |
| 9647 | D(p->level--); |
| 9648 | return NULL; |
| 9649 | } |
| 9650 | D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters")); |
| 9651 | void *invalid_lambda_parameters_var; |
| 9652 | if ( |
| 9653 | (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters |
| 9654 | ) |
| 9655 | { |
| 9656 | D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters")); |
| 9657 | _res = invalid_lambda_parameters_var; |
| 9658 | goto done; |
| 9659 | } |
| 9660 | p->mark = _mark; |
| 9661 | D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ', |
| 9662 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters")); |
| 9663 | } |
| 9664 | { // lambda_parameters |
| 9665 | if (p->error_indicator) { |
| 9666 | D(p->level--); |
| 9667 | return NULL; |
| 9668 | } |
| 9669 | D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters")); |
| 9670 | arguments_ty lambda_parameters_var; |
| 9671 | if ( |
| 9672 | (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters |
| 9673 | ) |
| 9674 | { |
| 9675 | D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters")); |
| 9676 | _res = lambda_parameters_var; |
| 9677 | goto done; |
| 9678 | } |
| 9679 | p->mark = _mark; |
| 9680 | D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ', |
| 9681 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters")); |
| 9682 | } |
| 9683 | _res = NULL; |
| 9684 | done: |
| 9685 | D(p->level--); |
| 9686 | return _res; |
| 9687 | } |
| 9688 | |
| 9689 | // lambda_parameters: |
| 9690 | // | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
| 9691 | // | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
| 9692 | // | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
| 9693 | // | lambda_param_with_default+ lambda_star_etc? |
| 9694 | // | lambda_star_etc |
| 9695 | static arguments_ty |
| 9696 | lambda_parameters_rule(Parser *p) |
| 9697 | { |
| 9698 | D(p->level++); |
| 9699 | if (p->error_indicator) { |
| 9700 | D(p->level--); |
| 9701 | return NULL; |
| 9702 | } |
| 9703 | arguments_ty _res = NULL; |
| 9704 | int _mark = p->mark; |
| 9705 | { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
| 9706 | if (p->error_indicator) { |
| 9707 | D(p->level--); |
| 9708 | return NULL; |
| 9709 | } |
| 9710 | 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] | 9711 | asdl_arg_seq* a; |
| 9712 | asdl_arg_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9713 | asdl_seq * c; |
| 9714 | void *d; |
| 9715 | if ( |
| 9716 | (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default |
| 9717 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9718 | (b = (asdl_arg_seq*)_loop0_90_rule(p)) // lambda_param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9719 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9720 | (c = _loop0_91_rule(p)) // lambda_param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9721 | && |
| 9722 | (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
| 9723 | ) |
| 9724 | { |
| 9725 | 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?")); |
| 9726 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
| 9727 | if (_res == NULL && PyErr_Occurred()) { |
| 9728 | p->error_indicator = 1; |
| 9729 | D(p->level--); |
| 9730 | return NULL; |
| 9731 | } |
| 9732 | goto done; |
| 9733 | } |
| 9734 | p->mark = _mark; |
| 9735 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9736 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); |
| 9737 | } |
| 9738 | { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
| 9739 | if (p->error_indicator) { |
| 9740 | D(p->level--); |
| 9741 | return NULL; |
| 9742 | } |
| 9743 | 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?")); |
| 9744 | SlashWithDefault* a; |
| 9745 | asdl_seq * b; |
| 9746 | void *c; |
| 9747 | if ( |
| 9748 | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
| 9749 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9750 | (b = _loop0_92_rule(p)) // lambda_param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9751 | && |
| 9752 | (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
| 9753 | ) |
| 9754 | { |
| 9755 | 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?")); |
| 9756 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
| 9757 | if (_res == NULL && PyErr_Occurred()) { |
| 9758 | p->error_indicator = 1; |
| 9759 | D(p->level--); |
| 9760 | return NULL; |
| 9761 | } |
| 9762 | goto done; |
| 9763 | } |
| 9764 | p->mark = _mark; |
| 9765 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9766 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); |
| 9767 | } |
| 9768 | { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
| 9769 | if (p->error_indicator) { |
| 9770 | D(p->level--); |
| 9771 | return NULL; |
| 9772 | } |
| 9773 | 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] | 9774 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9775 | asdl_seq * b; |
| 9776 | void *c; |
| 9777 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9778 | (a = (asdl_arg_seq*)_loop1_93_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9779 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9780 | (b = _loop0_94_rule(p)) // lambda_param_with_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9781 | && |
| 9782 | (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
| 9783 | ) |
| 9784 | { |
| 9785 | 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?")); |
| 9786 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
| 9787 | if (_res == NULL && PyErr_Occurred()) { |
| 9788 | p->error_indicator = 1; |
| 9789 | D(p->level--); |
| 9790 | return NULL; |
| 9791 | } |
| 9792 | goto done; |
| 9793 | } |
| 9794 | p->mark = _mark; |
| 9795 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9796 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); |
| 9797 | } |
| 9798 | { // lambda_param_with_default+ lambda_star_etc? |
| 9799 | if (p->error_indicator) { |
| 9800 | D(p->level--); |
| 9801 | return NULL; |
| 9802 | } |
| 9803 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
| 9804 | asdl_seq * a; |
| 9805 | void *b; |
| 9806 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9807 | (a = _loop1_95_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9808 | && |
| 9809 | (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
| 9810 | ) |
| 9811 | { |
| 9812 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
| 9813 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
| 9814 | if (_res == NULL && PyErr_Occurred()) { |
| 9815 | p->error_indicator = 1; |
| 9816 | D(p->level--); |
| 9817 | return NULL; |
| 9818 | } |
| 9819 | goto done; |
| 9820 | } |
| 9821 | p->mark = _mark; |
| 9822 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9823 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
| 9824 | } |
| 9825 | { // lambda_star_etc |
| 9826 | if (p->error_indicator) { |
| 9827 | D(p->level--); |
| 9828 | return NULL; |
| 9829 | } |
| 9830 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); |
| 9831 | StarEtc* a; |
| 9832 | if ( |
| 9833 | (a = lambda_star_etc_rule(p)) // lambda_star_etc |
| 9834 | ) |
| 9835 | { |
| 9836 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); |
| 9837 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
| 9838 | if (_res == NULL && PyErr_Occurred()) { |
| 9839 | p->error_indicator = 1; |
| 9840 | D(p->level--); |
| 9841 | return NULL; |
| 9842 | } |
| 9843 | goto done; |
| 9844 | } |
| 9845 | p->mark = _mark; |
| 9846 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 9847 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc")); |
| 9848 | } |
| 9849 | _res = NULL; |
| 9850 | done: |
| 9851 | D(p->level--); |
| 9852 | return _res; |
| 9853 | } |
| 9854 | |
| 9855 | // lambda_slash_no_default: |
| 9856 | // | lambda_param_no_default+ '/' ',' |
| 9857 | // | lambda_param_no_default+ '/' &':' |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9858 | static asdl_arg_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9859 | lambda_slash_no_default_rule(Parser *p) |
| 9860 | { |
| 9861 | D(p->level++); |
| 9862 | if (p->error_indicator) { |
| 9863 | D(p->level--); |
| 9864 | return NULL; |
| 9865 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9866 | asdl_arg_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9867 | int _mark = p->mark; |
| 9868 | { // lambda_param_no_default+ '/' ',' |
| 9869 | if (p->error_indicator) { |
| 9870 | D(p->level--); |
| 9871 | return NULL; |
| 9872 | } |
| 9873 | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
| 9874 | Token * _literal; |
| 9875 | Token * _literal_1; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9876 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9877 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9878 | (a = (asdl_arg_seq*)_loop1_96_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9879 | && |
| 9880 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 9881 | && |
| 9882 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 9883 | ) |
| 9884 | { |
| 9885 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
| 9886 | _res = a; |
| 9887 | if (_res == NULL && PyErr_Occurred()) { |
| 9888 | p->error_indicator = 1; |
| 9889 | D(p->level--); |
| 9890 | return NULL; |
| 9891 | } |
| 9892 | goto done; |
| 9893 | } |
| 9894 | p->mark = _mark; |
| 9895 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 9896 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
| 9897 | } |
| 9898 | { // lambda_param_no_default+ '/' &':' |
| 9899 | if (p->error_indicator) { |
| 9900 | D(p->level--); |
| 9901 | return NULL; |
| 9902 | } |
| 9903 | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
| 9904 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 9905 | asdl_arg_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9906 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9907 | (a = (asdl_arg_seq*)_loop1_97_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9908 | && |
| 9909 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 9910 | && |
| 9911 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 9912 | ) |
| 9913 | { |
| 9914 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
| 9915 | _res = a; |
| 9916 | if (_res == NULL && PyErr_Occurred()) { |
| 9917 | p->error_indicator = 1; |
| 9918 | D(p->level--); |
| 9919 | return NULL; |
| 9920 | } |
| 9921 | goto done; |
| 9922 | } |
| 9923 | p->mark = _mark; |
| 9924 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 9925 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
| 9926 | } |
| 9927 | _res = NULL; |
| 9928 | done: |
| 9929 | D(p->level--); |
| 9930 | return _res; |
| 9931 | } |
| 9932 | |
| 9933 | // lambda_slash_with_default: |
| 9934 | // | lambda_param_no_default* lambda_param_with_default+ '/' ',' |
| 9935 | // | lambda_param_no_default* lambda_param_with_default+ '/' &':' |
| 9936 | static SlashWithDefault* |
| 9937 | lambda_slash_with_default_rule(Parser *p) |
| 9938 | { |
| 9939 | D(p->level++); |
| 9940 | if (p->error_indicator) { |
| 9941 | D(p->level--); |
| 9942 | return NULL; |
| 9943 | } |
| 9944 | SlashWithDefault* _res = NULL; |
| 9945 | int _mark = p->mark; |
| 9946 | { // lambda_param_no_default* lambda_param_with_default+ '/' ',' |
| 9947 | if (p->error_indicator) { |
| 9948 | D(p->level--); |
| 9949 | return NULL; |
| 9950 | } |
| 9951 | 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+ '/' ','")); |
| 9952 | Token * _literal; |
| 9953 | Token * _literal_1; |
| 9954 | asdl_seq * a; |
| 9955 | asdl_seq * b; |
| 9956 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9957 | (a = _loop0_98_rule(p)) // lambda_param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9958 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9959 | (b = _loop1_99_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9960 | && |
| 9961 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 9962 | && |
| 9963 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 9964 | ) |
| 9965 | { |
| 9966 | 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] | 9967 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9968 | if (_res == NULL && PyErr_Occurred()) { |
| 9969 | p->error_indicator = 1; |
| 9970 | D(p->level--); |
| 9971 | return NULL; |
| 9972 | } |
| 9973 | goto done; |
| 9974 | } |
| 9975 | p->mark = _mark; |
| 9976 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 9977 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); |
| 9978 | } |
| 9979 | { // lambda_param_no_default* lambda_param_with_default+ '/' &':' |
| 9980 | if (p->error_indicator) { |
| 9981 | D(p->level--); |
| 9982 | return NULL; |
| 9983 | } |
| 9984 | 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+ '/' &':'")); |
| 9985 | Token * _literal; |
| 9986 | asdl_seq * a; |
| 9987 | asdl_seq * b; |
| 9988 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9989 | (a = _loop0_100_rule(p)) // lambda_param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9990 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 9991 | (b = _loop1_101_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 9992 | && |
| 9993 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 9994 | && |
| 9995 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 9996 | ) |
| 9997 | { |
| 9998 | 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] | 9999 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10000 | if (_res == NULL && PyErr_Occurred()) { |
| 10001 | p->error_indicator = 1; |
| 10002 | D(p->level--); |
| 10003 | return NULL; |
| 10004 | } |
| 10005 | goto done; |
| 10006 | } |
| 10007 | p->mark = _mark; |
| 10008 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10009 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); |
| 10010 | } |
| 10011 | _res = NULL; |
| 10012 | done: |
| 10013 | D(p->level--); |
| 10014 | return _res; |
| 10015 | } |
| 10016 | |
| 10017 | // lambda_star_etc: |
| 10018 | // | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
| 10019 | // | '*' ',' lambda_param_maybe_default+ lambda_kwds? |
| 10020 | // | lambda_kwds |
| 10021 | // | invalid_lambda_star_etc |
| 10022 | static StarEtc* |
| 10023 | lambda_star_etc_rule(Parser *p) |
| 10024 | { |
| 10025 | D(p->level++); |
| 10026 | if (p->error_indicator) { |
| 10027 | D(p->level--); |
| 10028 | return NULL; |
| 10029 | } |
| 10030 | StarEtc* _res = NULL; |
| 10031 | int _mark = p->mark; |
| 10032 | { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
| 10033 | if (p->error_indicator) { |
| 10034 | D(p->level--); |
| 10035 | return NULL; |
| 10036 | } |
| 10037 | 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?")); |
| 10038 | Token * _literal; |
| 10039 | arg_ty a; |
| 10040 | asdl_seq * b; |
| 10041 | void *c; |
| 10042 | if ( |
| 10043 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 10044 | && |
| 10045 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 10046 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10047 | (b = _loop0_102_rule(p)) // lambda_param_maybe_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10048 | && |
| 10049 | (c = lambda_kwds_rule(p), 1) // lambda_kwds? |
| 10050 | ) |
| 10051 | { |
| 10052 | 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?")); |
| 10053 | _res = _PyPegen_star_etc ( p , a , b , c ); |
| 10054 | if (_res == NULL && PyErr_Occurred()) { |
| 10055 | p->error_indicator = 1; |
| 10056 | D(p->level--); |
| 10057 | return NULL; |
| 10058 | } |
| 10059 | goto done; |
| 10060 | } |
| 10061 | p->mark = _mark; |
| 10062 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 10063 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); |
| 10064 | } |
| 10065 | { // '*' ',' lambda_param_maybe_default+ lambda_kwds? |
| 10066 | if (p->error_indicator) { |
| 10067 | D(p->level--); |
| 10068 | return NULL; |
| 10069 | } |
| 10070 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
| 10071 | Token * _literal; |
| 10072 | Token * _literal_1; |
| 10073 | asdl_seq * b; |
| 10074 | void *c; |
| 10075 | if ( |
| 10076 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 10077 | && |
| 10078 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 10079 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10080 | (b = _loop1_103_rule(p)) // lambda_param_maybe_default+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10081 | && |
| 10082 | (c = lambda_kwds_rule(p), 1) // lambda_kwds? |
| 10083 | ) |
| 10084 | { |
| 10085 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
| 10086 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
| 10087 | if (_res == NULL && PyErr_Occurred()) { |
| 10088 | p->error_indicator = 1; |
| 10089 | D(p->level--); |
| 10090 | return NULL; |
| 10091 | } |
| 10092 | goto done; |
| 10093 | } |
| 10094 | p->mark = _mark; |
| 10095 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 10096 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
| 10097 | } |
| 10098 | { // lambda_kwds |
| 10099 | if (p->error_indicator) { |
| 10100 | D(p->level--); |
| 10101 | return NULL; |
| 10102 | } |
| 10103 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); |
| 10104 | arg_ty a; |
| 10105 | if ( |
| 10106 | (a = lambda_kwds_rule(p)) // lambda_kwds |
| 10107 | ) |
| 10108 | { |
| 10109 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); |
| 10110 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
| 10111 | if (_res == NULL && PyErr_Occurred()) { |
| 10112 | p->error_indicator = 1; |
| 10113 | D(p->level--); |
| 10114 | return NULL; |
| 10115 | } |
| 10116 | goto done; |
| 10117 | } |
| 10118 | p->mark = _mark; |
| 10119 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 10120 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds")); |
| 10121 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 10122 | if (p->call_invalid_rules) { // invalid_lambda_star_etc |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10123 | if (p->error_indicator) { |
| 10124 | D(p->level--); |
| 10125 | return NULL; |
| 10126 | } |
| 10127 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); |
| 10128 | void *invalid_lambda_star_etc_var; |
| 10129 | if ( |
| 10130 | (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc |
| 10131 | ) |
| 10132 | { |
| 10133 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); |
| 10134 | _res = invalid_lambda_star_etc_var; |
| 10135 | goto done; |
| 10136 | } |
| 10137 | p->mark = _mark; |
| 10138 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 10139 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc")); |
| 10140 | } |
| 10141 | _res = NULL; |
| 10142 | done: |
| 10143 | D(p->level--); |
| 10144 | return _res; |
| 10145 | } |
| 10146 | |
| 10147 | // lambda_kwds: '**' lambda_param_no_default |
| 10148 | static arg_ty |
| 10149 | lambda_kwds_rule(Parser *p) |
| 10150 | { |
| 10151 | D(p->level++); |
| 10152 | if (p->error_indicator) { |
| 10153 | D(p->level--); |
| 10154 | return NULL; |
| 10155 | } |
| 10156 | arg_ty _res = NULL; |
| 10157 | int _mark = p->mark; |
| 10158 | { // '**' lambda_param_no_default |
| 10159 | if (p->error_indicator) { |
| 10160 | D(p->level--); |
| 10161 | return NULL; |
| 10162 | } |
| 10163 | D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); |
| 10164 | Token * _literal; |
| 10165 | arg_ty a; |
| 10166 | if ( |
| 10167 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 10168 | && |
| 10169 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 10170 | ) |
| 10171 | { |
| 10172 | D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); |
| 10173 | _res = a; |
| 10174 | if (_res == NULL && PyErr_Occurred()) { |
| 10175 | p->error_indicator = 1; |
| 10176 | D(p->level--); |
| 10177 | return NULL; |
| 10178 | } |
| 10179 | goto done; |
| 10180 | } |
| 10181 | p->mark = _mark; |
| 10182 | D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
| 10183 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default")); |
| 10184 | } |
| 10185 | _res = NULL; |
| 10186 | done: |
| 10187 | D(p->level--); |
| 10188 | return _res; |
| 10189 | } |
| 10190 | |
| 10191 | // lambda_param_no_default: lambda_param ',' | lambda_param &':' |
| 10192 | static arg_ty |
| 10193 | lambda_param_no_default_rule(Parser *p) |
| 10194 | { |
| 10195 | D(p->level++); |
| 10196 | if (p->error_indicator) { |
| 10197 | D(p->level--); |
| 10198 | return NULL; |
| 10199 | } |
| 10200 | arg_ty _res = NULL; |
| 10201 | int _mark = p->mark; |
| 10202 | { // lambda_param ',' |
| 10203 | if (p->error_indicator) { |
| 10204 | D(p->level--); |
| 10205 | return NULL; |
| 10206 | } |
| 10207 | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); |
| 10208 | Token * _literal; |
| 10209 | arg_ty a; |
| 10210 | if ( |
| 10211 | (a = lambda_param_rule(p)) // lambda_param |
| 10212 | && |
| 10213 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 10214 | ) |
| 10215 | { |
| 10216 | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); |
| 10217 | _res = a; |
| 10218 | if (_res == NULL && PyErr_Occurred()) { |
| 10219 | p->error_indicator = 1; |
| 10220 | D(p->level--); |
| 10221 | return NULL; |
| 10222 | } |
| 10223 | goto done; |
| 10224 | } |
| 10225 | p->mark = _mark; |
| 10226 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10227 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','")); |
| 10228 | } |
| 10229 | { // lambda_param &':' |
| 10230 | if (p->error_indicator) { |
| 10231 | D(p->level--); |
| 10232 | return NULL; |
| 10233 | } |
| 10234 | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
| 10235 | arg_ty a; |
| 10236 | if ( |
| 10237 | (a = lambda_param_rule(p)) // lambda_param |
| 10238 | && |
| 10239 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 10240 | ) |
| 10241 | { |
| 10242 | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
| 10243 | _res = a; |
| 10244 | if (_res == NULL && PyErr_Occurred()) { |
| 10245 | p->error_indicator = 1; |
| 10246 | D(p->level--); |
| 10247 | return NULL; |
| 10248 | } |
| 10249 | goto done; |
| 10250 | } |
| 10251 | p->mark = _mark; |
| 10252 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10253 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'")); |
| 10254 | } |
| 10255 | _res = NULL; |
| 10256 | done: |
| 10257 | D(p->level--); |
| 10258 | return _res; |
| 10259 | } |
| 10260 | |
| 10261 | // lambda_param_with_default: lambda_param default ',' | lambda_param default &':' |
| 10262 | static NameDefaultPair* |
| 10263 | lambda_param_with_default_rule(Parser *p) |
| 10264 | { |
| 10265 | D(p->level++); |
| 10266 | if (p->error_indicator) { |
| 10267 | D(p->level--); |
| 10268 | return NULL; |
| 10269 | } |
| 10270 | NameDefaultPair* _res = NULL; |
| 10271 | int _mark = p->mark; |
| 10272 | { // lambda_param default ',' |
| 10273 | if (p->error_indicator) { |
| 10274 | D(p->level--); |
| 10275 | return NULL; |
| 10276 | } |
| 10277 | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); |
| 10278 | Token * _literal; |
| 10279 | arg_ty a; |
| 10280 | expr_ty c; |
| 10281 | if ( |
| 10282 | (a = lambda_param_rule(p)) // lambda_param |
| 10283 | && |
| 10284 | (c = default_rule(p)) // default |
| 10285 | && |
| 10286 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 10287 | ) |
| 10288 | { |
| 10289 | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); |
| 10290 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 10291 | if (_res == NULL && PyErr_Occurred()) { |
| 10292 | p->error_indicator = 1; |
| 10293 | D(p->level--); |
| 10294 | return NULL; |
| 10295 | } |
| 10296 | goto done; |
| 10297 | } |
| 10298 | p->mark = _mark; |
| 10299 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10300 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','")); |
| 10301 | } |
| 10302 | { // lambda_param default &':' |
| 10303 | if (p->error_indicator) { |
| 10304 | D(p->level--); |
| 10305 | return NULL; |
| 10306 | } |
| 10307 | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); |
| 10308 | arg_ty a; |
| 10309 | expr_ty c; |
| 10310 | if ( |
| 10311 | (a = lambda_param_rule(p)) // lambda_param |
| 10312 | && |
| 10313 | (c = default_rule(p)) // default |
| 10314 | && |
| 10315 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 10316 | ) |
| 10317 | { |
| 10318 | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); |
| 10319 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 10320 | if (_res == NULL && PyErr_Occurred()) { |
| 10321 | p->error_indicator = 1; |
| 10322 | D(p->level--); |
| 10323 | return NULL; |
| 10324 | } |
| 10325 | goto done; |
| 10326 | } |
| 10327 | p->mark = _mark; |
| 10328 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10329 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'")); |
| 10330 | } |
| 10331 | _res = NULL; |
| 10332 | done: |
| 10333 | D(p->level--); |
| 10334 | return _res; |
| 10335 | } |
| 10336 | |
| 10337 | // lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' |
| 10338 | static NameDefaultPair* |
| 10339 | lambda_param_maybe_default_rule(Parser *p) |
| 10340 | { |
| 10341 | D(p->level++); |
| 10342 | if (p->error_indicator) { |
| 10343 | D(p->level--); |
| 10344 | return NULL; |
| 10345 | } |
| 10346 | NameDefaultPair* _res = NULL; |
| 10347 | int _mark = p->mark; |
| 10348 | { // lambda_param default? ',' |
| 10349 | if (p->error_indicator) { |
| 10350 | D(p->level--); |
| 10351 | return NULL; |
| 10352 | } |
| 10353 | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); |
| 10354 | Token * _literal; |
| 10355 | arg_ty a; |
| 10356 | void *c; |
| 10357 | if ( |
| 10358 | (a = lambda_param_rule(p)) // lambda_param |
| 10359 | && |
| 10360 | (c = default_rule(p), 1) // default? |
| 10361 | && |
| 10362 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 10363 | ) |
| 10364 | { |
| 10365 | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); |
| 10366 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 10367 | if (_res == NULL && PyErr_Occurred()) { |
| 10368 | p->error_indicator = 1; |
| 10369 | D(p->level--); |
| 10370 | return NULL; |
| 10371 | } |
| 10372 | goto done; |
| 10373 | } |
| 10374 | p->mark = _mark; |
| 10375 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10376 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','")); |
| 10377 | } |
| 10378 | { // lambda_param default? &':' |
| 10379 | if (p->error_indicator) { |
| 10380 | D(p->level--); |
| 10381 | return NULL; |
| 10382 | } |
| 10383 | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); |
| 10384 | arg_ty a; |
| 10385 | void *c; |
| 10386 | if ( |
| 10387 | (a = lambda_param_rule(p)) // lambda_param |
| 10388 | && |
| 10389 | (c = default_rule(p), 1) // default? |
| 10390 | && |
| 10391 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
| 10392 | ) |
| 10393 | { |
| 10394 | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); |
| 10395 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 10396 | if (_res == NULL && PyErr_Occurred()) { |
| 10397 | p->error_indicator = 1; |
| 10398 | D(p->level--); |
| 10399 | return NULL; |
| 10400 | } |
| 10401 | goto done; |
| 10402 | } |
| 10403 | p->mark = _mark; |
| 10404 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 10405 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'")); |
| 10406 | } |
| 10407 | _res = NULL; |
| 10408 | done: |
| 10409 | D(p->level--); |
| 10410 | return _res; |
| 10411 | } |
| 10412 | |
| 10413 | // lambda_param: NAME |
| 10414 | static arg_ty |
| 10415 | lambda_param_rule(Parser *p) |
| 10416 | { |
| 10417 | D(p->level++); |
| 10418 | if (p->error_indicator) { |
| 10419 | D(p->level--); |
| 10420 | return NULL; |
| 10421 | } |
| 10422 | arg_ty _res = NULL; |
| 10423 | int _mark = p->mark; |
| 10424 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10425 | p->error_indicator = 1; |
| 10426 | D(p->level--); |
| 10427 | return NULL; |
| 10428 | } |
| 10429 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10430 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10431 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10432 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10433 | { // NAME |
| 10434 | if (p->error_indicator) { |
| 10435 | D(p->level--); |
| 10436 | return NULL; |
| 10437 | } |
| 10438 | D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 10439 | expr_ty a; |
| 10440 | if ( |
| 10441 | (a = _PyPegen_name_token(p)) // NAME |
| 10442 | ) |
| 10443 | { |
| 10444 | D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 10445 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10446 | if (_token == NULL) { |
| 10447 | D(p->level--); |
| 10448 | return NULL; |
| 10449 | } |
| 10450 | int _end_lineno = _token->end_lineno; |
| 10451 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10452 | int _end_col_offset = _token->end_col_offset; |
| 10453 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10454 | _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA ); |
| 10455 | if (_res == NULL && PyErr_Occurred()) { |
| 10456 | p->error_indicator = 1; |
| 10457 | D(p->level--); |
| 10458 | return NULL; |
| 10459 | } |
| 10460 | goto done; |
| 10461 | } |
| 10462 | p->mark = _mark; |
| 10463 | D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ', |
| 10464 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 10465 | } |
| 10466 | _res = NULL; |
| 10467 | done: |
| 10468 | D(p->level--); |
| 10469 | return _res; |
| 10470 | } |
| 10471 | |
| 10472 | // disjunction: conjunction (('or' conjunction))+ | conjunction |
| 10473 | static expr_ty |
| 10474 | disjunction_rule(Parser *p) |
| 10475 | { |
| 10476 | D(p->level++); |
| 10477 | if (p->error_indicator) { |
| 10478 | D(p->level--); |
| 10479 | return NULL; |
| 10480 | } |
| 10481 | expr_ty _res = NULL; |
| 10482 | if (_PyPegen_is_memoized(p, disjunction_type, &_res)) { |
| 10483 | D(p->level--); |
| 10484 | return _res; |
| 10485 | } |
| 10486 | int _mark = p->mark; |
| 10487 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10488 | p->error_indicator = 1; |
| 10489 | D(p->level--); |
| 10490 | return NULL; |
| 10491 | } |
| 10492 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10493 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10494 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10495 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10496 | { // conjunction (('or' conjunction))+ |
| 10497 | if (p->error_indicator) { |
| 10498 | D(p->level--); |
| 10499 | return NULL; |
| 10500 | } |
| 10501 | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); |
| 10502 | expr_ty a; |
| 10503 | asdl_seq * b; |
| 10504 | if ( |
| 10505 | (a = conjunction_rule(p)) // conjunction |
| 10506 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10507 | (b = _loop1_104_rule(p)) // (('or' conjunction))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10508 | ) |
| 10509 | { |
| 10510 | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); |
| 10511 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10512 | if (_token == NULL) { |
| 10513 | D(p->level--); |
| 10514 | return NULL; |
| 10515 | } |
| 10516 | int _end_lineno = _token->end_lineno; |
| 10517 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10518 | int _end_col_offset = _token->end_col_offset; |
| 10519 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 10520 | _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] | 10521 | if (_res == NULL && PyErr_Occurred()) { |
| 10522 | p->error_indicator = 1; |
| 10523 | D(p->level--); |
| 10524 | return NULL; |
| 10525 | } |
| 10526 | goto done; |
| 10527 | } |
| 10528 | p->mark = _mark; |
| 10529 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 10530 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+")); |
| 10531 | } |
| 10532 | { // conjunction |
| 10533 | if (p->error_indicator) { |
| 10534 | D(p->level--); |
| 10535 | return NULL; |
| 10536 | } |
| 10537 | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction")); |
| 10538 | expr_ty conjunction_var; |
| 10539 | if ( |
| 10540 | (conjunction_var = conjunction_rule(p)) // conjunction |
| 10541 | ) |
| 10542 | { |
| 10543 | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction")); |
| 10544 | _res = conjunction_var; |
| 10545 | goto done; |
| 10546 | } |
| 10547 | p->mark = _mark; |
| 10548 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 10549 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction")); |
| 10550 | } |
| 10551 | _res = NULL; |
| 10552 | done: |
| 10553 | _PyPegen_insert_memo(p, _mark, disjunction_type, _res); |
| 10554 | D(p->level--); |
| 10555 | return _res; |
| 10556 | } |
| 10557 | |
| 10558 | // conjunction: inversion (('and' inversion))+ | inversion |
| 10559 | static expr_ty |
| 10560 | conjunction_rule(Parser *p) |
| 10561 | { |
| 10562 | D(p->level++); |
| 10563 | if (p->error_indicator) { |
| 10564 | D(p->level--); |
| 10565 | return NULL; |
| 10566 | } |
| 10567 | expr_ty _res = NULL; |
| 10568 | if (_PyPegen_is_memoized(p, conjunction_type, &_res)) { |
| 10569 | D(p->level--); |
| 10570 | return _res; |
| 10571 | } |
| 10572 | int _mark = p->mark; |
| 10573 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10574 | p->error_indicator = 1; |
| 10575 | D(p->level--); |
| 10576 | return NULL; |
| 10577 | } |
| 10578 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10579 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10580 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10581 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10582 | { // inversion (('and' inversion))+ |
| 10583 | if (p->error_indicator) { |
| 10584 | D(p->level--); |
| 10585 | return NULL; |
| 10586 | } |
| 10587 | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); |
| 10588 | expr_ty a; |
| 10589 | asdl_seq * b; |
| 10590 | if ( |
| 10591 | (a = inversion_rule(p)) // inversion |
| 10592 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10593 | (b = _loop1_105_rule(p)) // (('and' inversion))+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10594 | ) |
| 10595 | { |
| 10596 | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); |
| 10597 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10598 | if (_token == NULL) { |
| 10599 | D(p->level--); |
| 10600 | return NULL; |
| 10601 | } |
| 10602 | int _end_lineno = _token->end_lineno; |
| 10603 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10604 | int _end_col_offset = _token->end_col_offset; |
| 10605 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 10606 | _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] | 10607 | if (_res == NULL && PyErr_Occurred()) { |
| 10608 | p->error_indicator = 1; |
| 10609 | D(p->level--); |
| 10610 | return NULL; |
| 10611 | } |
| 10612 | goto done; |
| 10613 | } |
| 10614 | p->mark = _mark; |
| 10615 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 10616 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+")); |
| 10617 | } |
| 10618 | { // inversion |
| 10619 | if (p->error_indicator) { |
| 10620 | D(p->level--); |
| 10621 | return NULL; |
| 10622 | } |
| 10623 | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion")); |
| 10624 | expr_ty inversion_var; |
| 10625 | if ( |
| 10626 | (inversion_var = inversion_rule(p)) // inversion |
| 10627 | ) |
| 10628 | { |
| 10629 | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion")); |
| 10630 | _res = inversion_var; |
| 10631 | goto done; |
| 10632 | } |
| 10633 | p->mark = _mark; |
| 10634 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 10635 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion")); |
| 10636 | } |
| 10637 | _res = NULL; |
| 10638 | done: |
| 10639 | _PyPegen_insert_memo(p, _mark, conjunction_type, _res); |
| 10640 | D(p->level--); |
| 10641 | return _res; |
| 10642 | } |
| 10643 | |
| 10644 | // inversion: 'not' inversion | comparison |
| 10645 | static expr_ty |
| 10646 | inversion_rule(Parser *p) |
| 10647 | { |
| 10648 | D(p->level++); |
| 10649 | if (p->error_indicator) { |
| 10650 | D(p->level--); |
| 10651 | return NULL; |
| 10652 | } |
| 10653 | expr_ty _res = NULL; |
| 10654 | if (_PyPegen_is_memoized(p, inversion_type, &_res)) { |
| 10655 | D(p->level--); |
| 10656 | return _res; |
| 10657 | } |
| 10658 | int _mark = p->mark; |
| 10659 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10660 | p->error_indicator = 1; |
| 10661 | D(p->level--); |
| 10662 | return NULL; |
| 10663 | } |
| 10664 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10665 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10666 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10667 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10668 | { // 'not' inversion |
| 10669 | if (p->error_indicator) { |
| 10670 | D(p->level--); |
| 10671 | return NULL; |
| 10672 | } |
| 10673 | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion")); |
| 10674 | Token * _keyword; |
| 10675 | expr_ty a; |
| 10676 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10677 | (_keyword = _PyPegen_expect_token(p, 529)) // token='not' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10678 | && |
| 10679 | (a = inversion_rule(p)) // inversion |
| 10680 | ) |
| 10681 | { |
| 10682 | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion")); |
| 10683 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10684 | if (_token == NULL) { |
| 10685 | D(p->level--); |
| 10686 | return NULL; |
| 10687 | } |
| 10688 | int _end_lineno = _token->end_lineno; |
| 10689 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10690 | int _end_col_offset = _token->end_col_offset; |
| 10691 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10692 | _res = _Py_UnaryOp ( Not , a , EXTRA ); |
| 10693 | if (_res == NULL && PyErr_Occurred()) { |
| 10694 | p->error_indicator = 1; |
| 10695 | D(p->level--); |
| 10696 | return NULL; |
| 10697 | } |
| 10698 | goto done; |
| 10699 | } |
| 10700 | p->mark = _mark; |
| 10701 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
| 10702 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion")); |
| 10703 | } |
| 10704 | { // comparison |
| 10705 | if (p->error_indicator) { |
| 10706 | D(p->level--); |
| 10707 | return NULL; |
| 10708 | } |
| 10709 | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison")); |
| 10710 | expr_ty comparison_var; |
| 10711 | if ( |
| 10712 | (comparison_var = comparison_rule(p)) // comparison |
| 10713 | ) |
| 10714 | { |
| 10715 | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison")); |
| 10716 | _res = comparison_var; |
| 10717 | goto done; |
| 10718 | } |
| 10719 | p->mark = _mark; |
| 10720 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
| 10721 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison")); |
| 10722 | } |
| 10723 | _res = NULL; |
| 10724 | done: |
| 10725 | _PyPegen_insert_memo(p, _mark, inversion_type, _res); |
| 10726 | D(p->level--); |
| 10727 | return _res; |
| 10728 | } |
| 10729 | |
| 10730 | // comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or |
| 10731 | static expr_ty |
| 10732 | comparison_rule(Parser *p) |
| 10733 | { |
| 10734 | D(p->level++); |
| 10735 | if (p->error_indicator) { |
| 10736 | D(p->level--); |
| 10737 | return NULL; |
| 10738 | } |
| 10739 | expr_ty _res = NULL; |
| 10740 | int _mark = p->mark; |
| 10741 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10742 | p->error_indicator = 1; |
| 10743 | D(p->level--); |
| 10744 | return NULL; |
| 10745 | } |
| 10746 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10747 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10748 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10749 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 10750 | { // bitwise_or compare_op_bitwise_or_pair+ |
| 10751 | if (p->error_indicator) { |
| 10752 | D(p->level--); |
| 10753 | return NULL; |
| 10754 | } |
| 10755 | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
| 10756 | expr_ty a; |
| 10757 | asdl_seq * b; |
| 10758 | if ( |
| 10759 | (a = bitwise_or_rule(p)) // bitwise_or |
| 10760 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 10761 | (b = _loop1_106_rule(p)) // compare_op_bitwise_or_pair+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 10762 | ) |
| 10763 | { |
| 10764 | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
| 10765 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10766 | if (_token == NULL) { |
| 10767 | D(p->level--); |
| 10768 | return NULL; |
| 10769 | } |
| 10770 | int _end_lineno = _token->end_lineno; |
| 10771 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10772 | int _end_col_offset = _token->end_col_offset; |
| 10773 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 10774 | _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] | 10775 | if (_res == NULL && PyErr_Occurred()) { |
| 10776 | p->error_indicator = 1; |
| 10777 | D(p->level--); |
| 10778 | return NULL; |
| 10779 | } |
| 10780 | goto done; |
| 10781 | } |
| 10782 | p->mark = _mark; |
| 10783 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
| 10784 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
| 10785 | } |
| 10786 | { // bitwise_or |
| 10787 | if (p->error_indicator) { |
| 10788 | D(p->level--); |
| 10789 | return NULL; |
| 10790 | } |
| 10791 | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or")); |
| 10792 | expr_ty bitwise_or_var; |
| 10793 | if ( |
| 10794 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
| 10795 | ) |
| 10796 | { |
| 10797 | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or")); |
| 10798 | _res = bitwise_or_var; |
| 10799 | goto done; |
| 10800 | } |
| 10801 | p->mark = _mark; |
| 10802 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
| 10803 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or")); |
| 10804 | } |
| 10805 | _res = NULL; |
| 10806 | done: |
| 10807 | D(p->level--); |
| 10808 | return _res; |
| 10809 | } |
| 10810 | |
| 10811 | // compare_op_bitwise_or_pair: |
| 10812 | // | eq_bitwise_or |
| 10813 | // | noteq_bitwise_or |
| 10814 | // | lte_bitwise_or |
| 10815 | // | lt_bitwise_or |
| 10816 | // | gte_bitwise_or |
| 10817 | // | gt_bitwise_or |
| 10818 | // | notin_bitwise_or |
| 10819 | // | in_bitwise_or |
| 10820 | // | isnot_bitwise_or |
| 10821 | // | is_bitwise_or |
| 10822 | static CmpopExprPair* |
| 10823 | compare_op_bitwise_or_pair_rule(Parser *p) |
| 10824 | { |
| 10825 | D(p->level++); |
| 10826 | if (p->error_indicator) { |
| 10827 | D(p->level--); |
| 10828 | return NULL; |
| 10829 | } |
| 10830 | CmpopExprPair* _res = NULL; |
| 10831 | int _mark = p->mark; |
| 10832 | { // eq_bitwise_or |
| 10833 | if (p->error_indicator) { |
| 10834 | D(p->level--); |
| 10835 | return NULL; |
| 10836 | } |
| 10837 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); |
| 10838 | CmpopExprPair* eq_bitwise_or_var; |
| 10839 | if ( |
| 10840 | (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or |
| 10841 | ) |
| 10842 | { |
| 10843 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); |
| 10844 | _res = eq_bitwise_or_var; |
| 10845 | goto done; |
| 10846 | } |
| 10847 | p->mark = _mark; |
| 10848 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10849 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or")); |
| 10850 | } |
| 10851 | { // noteq_bitwise_or |
| 10852 | if (p->error_indicator) { |
| 10853 | D(p->level--); |
| 10854 | return NULL; |
| 10855 | } |
| 10856 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); |
| 10857 | CmpopExprPair* noteq_bitwise_or_var; |
| 10858 | if ( |
| 10859 | (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or |
| 10860 | ) |
| 10861 | { |
| 10862 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); |
| 10863 | _res = noteq_bitwise_or_var; |
| 10864 | goto done; |
| 10865 | } |
| 10866 | p->mark = _mark; |
| 10867 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10868 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or")); |
| 10869 | } |
| 10870 | { // lte_bitwise_or |
| 10871 | if (p->error_indicator) { |
| 10872 | D(p->level--); |
| 10873 | return NULL; |
| 10874 | } |
| 10875 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); |
| 10876 | CmpopExprPair* lte_bitwise_or_var; |
| 10877 | if ( |
| 10878 | (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or |
| 10879 | ) |
| 10880 | { |
| 10881 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); |
| 10882 | _res = lte_bitwise_or_var; |
| 10883 | goto done; |
| 10884 | } |
| 10885 | p->mark = _mark; |
| 10886 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10887 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or")); |
| 10888 | } |
| 10889 | { // lt_bitwise_or |
| 10890 | if (p->error_indicator) { |
| 10891 | D(p->level--); |
| 10892 | return NULL; |
| 10893 | } |
| 10894 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); |
| 10895 | CmpopExprPair* lt_bitwise_or_var; |
| 10896 | if ( |
| 10897 | (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or |
| 10898 | ) |
| 10899 | { |
| 10900 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); |
| 10901 | _res = lt_bitwise_or_var; |
| 10902 | goto done; |
| 10903 | } |
| 10904 | p->mark = _mark; |
| 10905 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10906 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or")); |
| 10907 | } |
| 10908 | { // gte_bitwise_or |
| 10909 | if (p->error_indicator) { |
| 10910 | D(p->level--); |
| 10911 | return NULL; |
| 10912 | } |
| 10913 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); |
| 10914 | CmpopExprPair* gte_bitwise_or_var; |
| 10915 | if ( |
| 10916 | (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or |
| 10917 | ) |
| 10918 | { |
| 10919 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); |
| 10920 | _res = gte_bitwise_or_var; |
| 10921 | goto done; |
| 10922 | } |
| 10923 | p->mark = _mark; |
| 10924 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10925 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or")); |
| 10926 | } |
| 10927 | { // gt_bitwise_or |
| 10928 | if (p->error_indicator) { |
| 10929 | D(p->level--); |
| 10930 | return NULL; |
| 10931 | } |
| 10932 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); |
| 10933 | CmpopExprPair* gt_bitwise_or_var; |
| 10934 | if ( |
| 10935 | (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or |
| 10936 | ) |
| 10937 | { |
| 10938 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); |
| 10939 | _res = gt_bitwise_or_var; |
| 10940 | goto done; |
| 10941 | } |
| 10942 | p->mark = _mark; |
| 10943 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10944 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or")); |
| 10945 | } |
| 10946 | { // notin_bitwise_or |
| 10947 | if (p->error_indicator) { |
| 10948 | D(p->level--); |
| 10949 | return NULL; |
| 10950 | } |
| 10951 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); |
| 10952 | CmpopExprPair* notin_bitwise_or_var; |
| 10953 | if ( |
| 10954 | (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or |
| 10955 | ) |
| 10956 | { |
| 10957 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); |
| 10958 | _res = notin_bitwise_or_var; |
| 10959 | goto done; |
| 10960 | } |
| 10961 | p->mark = _mark; |
| 10962 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10963 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or")); |
| 10964 | } |
| 10965 | { // in_bitwise_or |
| 10966 | if (p->error_indicator) { |
| 10967 | D(p->level--); |
| 10968 | return NULL; |
| 10969 | } |
| 10970 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); |
| 10971 | CmpopExprPair* in_bitwise_or_var; |
| 10972 | if ( |
| 10973 | (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or |
| 10974 | ) |
| 10975 | { |
| 10976 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); |
| 10977 | _res = in_bitwise_or_var; |
| 10978 | goto done; |
| 10979 | } |
| 10980 | p->mark = _mark; |
| 10981 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 10982 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or")); |
| 10983 | } |
| 10984 | { // isnot_bitwise_or |
| 10985 | if (p->error_indicator) { |
| 10986 | D(p->level--); |
| 10987 | return NULL; |
| 10988 | } |
| 10989 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); |
| 10990 | CmpopExprPair* isnot_bitwise_or_var; |
| 10991 | if ( |
| 10992 | (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or |
| 10993 | ) |
| 10994 | { |
| 10995 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); |
| 10996 | _res = isnot_bitwise_or_var; |
| 10997 | goto done; |
| 10998 | } |
| 10999 | p->mark = _mark; |
| 11000 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11001 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or")); |
| 11002 | } |
| 11003 | { // is_bitwise_or |
| 11004 | if (p->error_indicator) { |
| 11005 | D(p->level--); |
| 11006 | return NULL; |
| 11007 | } |
| 11008 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); |
| 11009 | CmpopExprPair* is_bitwise_or_var; |
| 11010 | if ( |
| 11011 | (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or |
| 11012 | ) |
| 11013 | { |
| 11014 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); |
| 11015 | _res = is_bitwise_or_var; |
| 11016 | goto done; |
| 11017 | } |
| 11018 | p->mark = _mark; |
| 11019 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11020 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or")); |
| 11021 | } |
| 11022 | _res = NULL; |
| 11023 | done: |
| 11024 | D(p->level--); |
| 11025 | return _res; |
| 11026 | } |
| 11027 | |
| 11028 | // eq_bitwise_or: '==' bitwise_or |
| 11029 | static CmpopExprPair* |
| 11030 | eq_bitwise_or_rule(Parser *p) |
| 11031 | { |
| 11032 | D(p->level++); |
| 11033 | if (p->error_indicator) { |
| 11034 | D(p->level--); |
| 11035 | return NULL; |
| 11036 | } |
| 11037 | CmpopExprPair* _res = NULL; |
| 11038 | int _mark = p->mark; |
| 11039 | { // '==' bitwise_or |
| 11040 | if (p->error_indicator) { |
| 11041 | D(p->level--); |
| 11042 | return NULL; |
| 11043 | } |
| 11044 | D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); |
| 11045 | Token * _literal; |
| 11046 | expr_ty a; |
| 11047 | if ( |
| 11048 | (_literal = _PyPegen_expect_token(p, 27)) // token='==' |
| 11049 | && |
| 11050 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11051 | ) |
| 11052 | { |
| 11053 | D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); |
| 11054 | _res = _PyPegen_cmpop_expr_pair ( p , Eq , a ); |
| 11055 | if (_res == NULL && PyErr_Occurred()) { |
| 11056 | p->error_indicator = 1; |
| 11057 | D(p->level--); |
| 11058 | return NULL; |
| 11059 | } |
| 11060 | goto done; |
| 11061 | } |
| 11062 | p->mark = _mark; |
| 11063 | D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11064 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or")); |
| 11065 | } |
| 11066 | _res = NULL; |
| 11067 | done: |
| 11068 | D(p->level--); |
| 11069 | return _res; |
| 11070 | } |
| 11071 | |
| 11072 | // noteq_bitwise_or: ('!=') bitwise_or |
| 11073 | static CmpopExprPair* |
| 11074 | noteq_bitwise_or_rule(Parser *p) |
| 11075 | { |
| 11076 | D(p->level++); |
| 11077 | if (p->error_indicator) { |
| 11078 | D(p->level--); |
| 11079 | return NULL; |
| 11080 | } |
| 11081 | CmpopExprPair* _res = NULL; |
| 11082 | int _mark = p->mark; |
| 11083 | { // ('!=') bitwise_or |
| 11084 | if (p->error_indicator) { |
| 11085 | D(p->level--); |
| 11086 | return NULL; |
| 11087 | } |
| 11088 | 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] | 11089 | void *_tmp_107_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11090 | expr_ty a; |
| 11091 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11092 | (_tmp_107_var = _tmp_107_rule(p)) // '!=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11093 | && |
| 11094 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11095 | ) |
| 11096 | { |
| 11097 | D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); |
| 11098 | _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a ); |
| 11099 | if (_res == NULL && PyErr_Occurred()) { |
| 11100 | p->error_indicator = 1; |
| 11101 | D(p->level--); |
| 11102 | return NULL; |
| 11103 | } |
| 11104 | goto done; |
| 11105 | } |
| 11106 | p->mark = _mark; |
| 11107 | D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11108 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or")); |
| 11109 | } |
| 11110 | _res = NULL; |
| 11111 | done: |
| 11112 | D(p->level--); |
| 11113 | return _res; |
| 11114 | } |
| 11115 | |
| 11116 | // lte_bitwise_or: '<=' bitwise_or |
| 11117 | static CmpopExprPair* |
| 11118 | lte_bitwise_or_rule(Parser *p) |
| 11119 | { |
| 11120 | D(p->level++); |
| 11121 | if (p->error_indicator) { |
| 11122 | D(p->level--); |
| 11123 | return NULL; |
| 11124 | } |
| 11125 | CmpopExprPair* _res = NULL; |
| 11126 | int _mark = p->mark; |
| 11127 | { // '<=' bitwise_or |
| 11128 | if (p->error_indicator) { |
| 11129 | D(p->level--); |
| 11130 | return NULL; |
| 11131 | } |
| 11132 | D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); |
| 11133 | Token * _literal; |
| 11134 | expr_ty a; |
| 11135 | if ( |
| 11136 | (_literal = _PyPegen_expect_token(p, 29)) // token='<=' |
| 11137 | && |
| 11138 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11139 | ) |
| 11140 | { |
| 11141 | D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); |
| 11142 | _res = _PyPegen_cmpop_expr_pair ( p , LtE , a ); |
| 11143 | if (_res == NULL && PyErr_Occurred()) { |
| 11144 | p->error_indicator = 1; |
| 11145 | D(p->level--); |
| 11146 | return NULL; |
| 11147 | } |
| 11148 | goto done; |
| 11149 | } |
| 11150 | p->mark = _mark; |
| 11151 | D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11152 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or")); |
| 11153 | } |
| 11154 | _res = NULL; |
| 11155 | done: |
| 11156 | D(p->level--); |
| 11157 | return _res; |
| 11158 | } |
| 11159 | |
| 11160 | // lt_bitwise_or: '<' bitwise_or |
| 11161 | static CmpopExprPair* |
| 11162 | lt_bitwise_or_rule(Parser *p) |
| 11163 | { |
| 11164 | D(p->level++); |
| 11165 | if (p->error_indicator) { |
| 11166 | D(p->level--); |
| 11167 | return NULL; |
| 11168 | } |
| 11169 | CmpopExprPair* _res = NULL; |
| 11170 | int _mark = p->mark; |
| 11171 | { // '<' bitwise_or |
| 11172 | if (p->error_indicator) { |
| 11173 | D(p->level--); |
| 11174 | return NULL; |
| 11175 | } |
| 11176 | D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); |
| 11177 | Token * _literal; |
| 11178 | expr_ty a; |
| 11179 | if ( |
| 11180 | (_literal = _PyPegen_expect_token(p, 20)) // token='<' |
| 11181 | && |
| 11182 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11183 | ) |
| 11184 | { |
| 11185 | D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); |
| 11186 | _res = _PyPegen_cmpop_expr_pair ( p , Lt , a ); |
| 11187 | if (_res == NULL && PyErr_Occurred()) { |
| 11188 | p->error_indicator = 1; |
| 11189 | D(p->level--); |
| 11190 | return NULL; |
| 11191 | } |
| 11192 | goto done; |
| 11193 | } |
| 11194 | p->mark = _mark; |
| 11195 | D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11196 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or")); |
| 11197 | } |
| 11198 | _res = NULL; |
| 11199 | done: |
| 11200 | D(p->level--); |
| 11201 | return _res; |
| 11202 | } |
| 11203 | |
| 11204 | // gte_bitwise_or: '>=' bitwise_or |
| 11205 | static CmpopExprPair* |
| 11206 | gte_bitwise_or_rule(Parser *p) |
| 11207 | { |
| 11208 | D(p->level++); |
| 11209 | if (p->error_indicator) { |
| 11210 | D(p->level--); |
| 11211 | return NULL; |
| 11212 | } |
| 11213 | CmpopExprPair* _res = NULL; |
| 11214 | int _mark = p->mark; |
| 11215 | { // '>=' bitwise_or |
| 11216 | if (p->error_indicator) { |
| 11217 | D(p->level--); |
| 11218 | return NULL; |
| 11219 | } |
| 11220 | D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); |
| 11221 | Token * _literal; |
| 11222 | expr_ty a; |
| 11223 | if ( |
| 11224 | (_literal = _PyPegen_expect_token(p, 30)) // token='>=' |
| 11225 | && |
| 11226 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11227 | ) |
| 11228 | { |
| 11229 | D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); |
| 11230 | _res = _PyPegen_cmpop_expr_pair ( p , GtE , a ); |
| 11231 | if (_res == NULL && PyErr_Occurred()) { |
| 11232 | p->error_indicator = 1; |
| 11233 | D(p->level--); |
| 11234 | return NULL; |
| 11235 | } |
| 11236 | goto done; |
| 11237 | } |
| 11238 | p->mark = _mark; |
| 11239 | D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11240 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or")); |
| 11241 | } |
| 11242 | _res = NULL; |
| 11243 | done: |
| 11244 | D(p->level--); |
| 11245 | return _res; |
| 11246 | } |
| 11247 | |
| 11248 | // gt_bitwise_or: '>' bitwise_or |
| 11249 | static CmpopExprPair* |
| 11250 | gt_bitwise_or_rule(Parser *p) |
| 11251 | { |
| 11252 | D(p->level++); |
| 11253 | if (p->error_indicator) { |
| 11254 | D(p->level--); |
| 11255 | return NULL; |
| 11256 | } |
| 11257 | CmpopExprPair* _res = NULL; |
| 11258 | int _mark = p->mark; |
| 11259 | { // '>' bitwise_or |
| 11260 | if (p->error_indicator) { |
| 11261 | D(p->level--); |
| 11262 | return NULL; |
| 11263 | } |
| 11264 | D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); |
| 11265 | Token * _literal; |
| 11266 | expr_ty a; |
| 11267 | if ( |
| 11268 | (_literal = _PyPegen_expect_token(p, 21)) // token='>' |
| 11269 | && |
| 11270 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11271 | ) |
| 11272 | { |
| 11273 | D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); |
| 11274 | _res = _PyPegen_cmpop_expr_pair ( p , Gt , a ); |
| 11275 | if (_res == NULL && PyErr_Occurred()) { |
| 11276 | p->error_indicator = 1; |
| 11277 | D(p->level--); |
| 11278 | return NULL; |
| 11279 | } |
| 11280 | goto done; |
| 11281 | } |
| 11282 | p->mark = _mark; |
| 11283 | D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11284 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or")); |
| 11285 | } |
| 11286 | _res = NULL; |
| 11287 | done: |
| 11288 | D(p->level--); |
| 11289 | return _res; |
| 11290 | } |
| 11291 | |
| 11292 | // notin_bitwise_or: 'not' 'in' bitwise_or |
| 11293 | static CmpopExprPair* |
| 11294 | notin_bitwise_or_rule(Parser *p) |
| 11295 | { |
| 11296 | D(p->level++); |
| 11297 | if (p->error_indicator) { |
| 11298 | D(p->level--); |
| 11299 | return NULL; |
| 11300 | } |
| 11301 | CmpopExprPair* _res = NULL; |
| 11302 | int _mark = p->mark; |
| 11303 | { // 'not' 'in' bitwise_or |
| 11304 | if (p->error_indicator) { |
| 11305 | D(p->level--); |
| 11306 | return NULL; |
| 11307 | } |
| 11308 | D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); |
| 11309 | Token * _keyword; |
| 11310 | Token * _keyword_1; |
| 11311 | expr_ty a; |
| 11312 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11313 | (_keyword = _PyPegen_expect_token(p, 529)) // token='not' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11314 | && |
| 11315 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 11316 | && |
| 11317 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11318 | ) |
| 11319 | { |
| 11320 | D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); |
| 11321 | _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a ); |
| 11322 | if (_res == NULL && PyErr_Occurred()) { |
| 11323 | p->error_indicator = 1; |
| 11324 | D(p->level--); |
| 11325 | return NULL; |
| 11326 | } |
| 11327 | goto done; |
| 11328 | } |
| 11329 | p->mark = _mark; |
| 11330 | D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11331 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or")); |
| 11332 | } |
| 11333 | _res = NULL; |
| 11334 | done: |
| 11335 | D(p->level--); |
| 11336 | return _res; |
| 11337 | } |
| 11338 | |
| 11339 | // in_bitwise_or: 'in' bitwise_or |
| 11340 | static CmpopExprPair* |
| 11341 | in_bitwise_or_rule(Parser *p) |
| 11342 | { |
| 11343 | D(p->level++); |
| 11344 | if (p->error_indicator) { |
| 11345 | D(p->level--); |
| 11346 | return NULL; |
| 11347 | } |
| 11348 | CmpopExprPair* _res = NULL; |
| 11349 | int _mark = p->mark; |
| 11350 | { // 'in' bitwise_or |
| 11351 | if (p->error_indicator) { |
| 11352 | D(p->level--); |
| 11353 | return NULL; |
| 11354 | } |
| 11355 | D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); |
| 11356 | Token * _keyword; |
| 11357 | expr_ty a; |
| 11358 | if ( |
| 11359 | (_keyword = _PyPegen_expect_token(p, 518)) // token='in' |
| 11360 | && |
| 11361 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11362 | ) |
| 11363 | { |
| 11364 | D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); |
| 11365 | _res = _PyPegen_cmpop_expr_pair ( p , In , a ); |
| 11366 | if (_res == NULL && PyErr_Occurred()) { |
| 11367 | p->error_indicator = 1; |
| 11368 | D(p->level--); |
| 11369 | return NULL; |
| 11370 | } |
| 11371 | goto done; |
| 11372 | } |
| 11373 | p->mark = _mark; |
| 11374 | D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11375 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or")); |
| 11376 | } |
| 11377 | _res = NULL; |
| 11378 | done: |
| 11379 | D(p->level--); |
| 11380 | return _res; |
| 11381 | } |
| 11382 | |
| 11383 | // isnot_bitwise_or: 'is' 'not' bitwise_or |
| 11384 | static CmpopExprPair* |
| 11385 | isnot_bitwise_or_rule(Parser *p) |
| 11386 | { |
| 11387 | D(p->level++); |
| 11388 | if (p->error_indicator) { |
| 11389 | D(p->level--); |
| 11390 | return NULL; |
| 11391 | } |
| 11392 | CmpopExprPair* _res = NULL; |
| 11393 | int _mark = p->mark; |
| 11394 | { // 'is' 'not' bitwise_or |
| 11395 | if (p->error_indicator) { |
| 11396 | D(p->level--); |
| 11397 | return NULL; |
| 11398 | } |
| 11399 | D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); |
| 11400 | Token * _keyword; |
| 11401 | Token * _keyword_1; |
| 11402 | expr_ty a; |
| 11403 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11404 | (_keyword = _PyPegen_expect_token(p, 530)) // token='is' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11405 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11406 | (_keyword_1 = _PyPegen_expect_token(p, 529)) // token='not' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11407 | && |
| 11408 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11409 | ) |
| 11410 | { |
| 11411 | D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); |
| 11412 | _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a ); |
| 11413 | if (_res == NULL && PyErr_Occurred()) { |
| 11414 | p->error_indicator = 1; |
| 11415 | D(p->level--); |
| 11416 | return NULL; |
| 11417 | } |
| 11418 | goto done; |
| 11419 | } |
| 11420 | p->mark = _mark; |
| 11421 | D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11422 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or")); |
| 11423 | } |
| 11424 | _res = NULL; |
| 11425 | done: |
| 11426 | D(p->level--); |
| 11427 | return _res; |
| 11428 | } |
| 11429 | |
| 11430 | // is_bitwise_or: 'is' bitwise_or |
| 11431 | static CmpopExprPair* |
| 11432 | is_bitwise_or_rule(Parser *p) |
| 11433 | { |
| 11434 | D(p->level++); |
| 11435 | if (p->error_indicator) { |
| 11436 | D(p->level--); |
| 11437 | return NULL; |
| 11438 | } |
| 11439 | CmpopExprPair* _res = NULL; |
| 11440 | int _mark = p->mark; |
| 11441 | { // 'is' bitwise_or |
| 11442 | if (p->error_indicator) { |
| 11443 | D(p->level--); |
| 11444 | return NULL; |
| 11445 | } |
| 11446 | D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); |
| 11447 | Token * _keyword; |
| 11448 | expr_ty a; |
| 11449 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11450 | (_keyword = _PyPegen_expect_token(p, 530)) // token='is' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11451 | && |
| 11452 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11453 | ) |
| 11454 | { |
| 11455 | D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); |
| 11456 | _res = _PyPegen_cmpop_expr_pair ( p , Is , a ); |
| 11457 | if (_res == NULL && PyErr_Occurred()) { |
| 11458 | p->error_indicator = 1; |
| 11459 | D(p->level--); |
| 11460 | return NULL; |
| 11461 | } |
| 11462 | goto done; |
| 11463 | } |
| 11464 | p->mark = _mark; |
| 11465 | D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11466 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or")); |
| 11467 | } |
| 11468 | _res = NULL; |
| 11469 | done: |
| 11470 | D(p->level--); |
| 11471 | return _res; |
| 11472 | } |
| 11473 | |
| 11474 | // Left-recursive |
| 11475 | // bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor |
| 11476 | static expr_ty bitwise_or_raw(Parser *); |
| 11477 | static expr_ty |
| 11478 | bitwise_or_rule(Parser *p) |
| 11479 | { |
| 11480 | D(p->level++); |
| 11481 | expr_ty _res = NULL; |
| 11482 | if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) { |
| 11483 | D(p->level--); |
| 11484 | return _res; |
| 11485 | } |
| 11486 | int _mark = p->mark; |
| 11487 | int _resmark = p->mark; |
| 11488 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11489 | int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); |
| 11490 | if (tmpvar_2) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11491 | D(p->level--); |
| 11492 | return _res; |
| 11493 | } |
| 11494 | p->mark = _mark; |
| 11495 | void *_raw = bitwise_or_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11496 | if (p->error_indicator) |
| 11497 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11498 | if (_raw == NULL || p->mark <= _resmark) |
| 11499 | break; |
| 11500 | _resmark = p->mark; |
| 11501 | _res = _raw; |
| 11502 | } |
| 11503 | p->mark = _resmark; |
| 11504 | D(p->level--); |
| 11505 | return _res; |
| 11506 | } |
| 11507 | static expr_ty |
| 11508 | bitwise_or_raw(Parser *p) |
| 11509 | { |
| 11510 | D(p->level++); |
| 11511 | if (p->error_indicator) { |
| 11512 | D(p->level--); |
| 11513 | return NULL; |
| 11514 | } |
| 11515 | expr_ty _res = NULL; |
| 11516 | int _mark = p->mark; |
| 11517 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11518 | p->error_indicator = 1; |
| 11519 | D(p->level--); |
| 11520 | return NULL; |
| 11521 | } |
| 11522 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11523 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11524 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11525 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 11526 | { // bitwise_or '|' bitwise_xor |
| 11527 | if (p->error_indicator) { |
| 11528 | D(p->level--); |
| 11529 | return NULL; |
| 11530 | } |
| 11531 | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
| 11532 | Token * _literal; |
| 11533 | expr_ty a; |
| 11534 | expr_ty b; |
| 11535 | if ( |
| 11536 | (a = bitwise_or_rule(p)) // bitwise_or |
| 11537 | && |
| 11538 | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
| 11539 | && |
| 11540 | (b = bitwise_xor_rule(p)) // bitwise_xor |
| 11541 | ) |
| 11542 | { |
| 11543 | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
| 11544 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11545 | if (_token == NULL) { |
| 11546 | D(p->level--); |
| 11547 | return NULL; |
| 11548 | } |
| 11549 | int _end_lineno = _token->end_lineno; |
| 11550 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11551 | int _end_col_offset = _token->end_col_offset; |
| 11552 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11553 | _res = _Py_BinOp ( a , BitOr , b , EXTRA ); |
| 11554 | if (_res == NULL && PyErr_Occurred()) { |
| 11555 | p->error_indicator = 1; |
| 11556 | D(p->level--); |
| 11557 | return NULL; |
| 11558 | } |
| 11559 | goto done; |
| 11560 | } |
| 11561 | p->mark = _mark; |
| 11562 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11563 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
| 11564 | } |
| 11565 | { // bitwise_xor |
| 11566 | if (p->error_indicator) { |
| 11567 | D(p->level--); |
| 11568 | return NULL; |
| 11569 | } |
| 11570 | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); |
| 11571 | expr_ty bitwise_xor_var; |
| 11572 | if ( |
| 11573 | (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor |
| 11574 | ) |
| 11575 | { |
| 11576 | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); |
| 11577 | _res = bitwise_xor_var; |
| 11578 | goto done; |
| 11579 | } |
| 11580 | p->mark = _mark; |
| 11581 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 11582 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor")); |
| 11583 | } |
| 11584 | _res = NULL; |
| 11585 | done: |
| 11586 | D(p->level--); |
| 11587 | return _res; |
| 11588 | } |
| 11589 | |
| 11590 | // Left-recursive |
| 11591 | // bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and |
| 11592 | static expr_ty bitwise_xor_raw(Parser *); |
| 11593 | static expr_ty |
| 11594 | bitwise_xor_rule(Parser *p) |
| 11595 | { |
| 11596 | D(p->level++); |
| 11597 | expr_ty _res = NULL; |
| 11598 | if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) { |
| 11599 | D(p->level--); |
| 11600 | return _res; |
| 11601 | } |
| 11602 | int _mark = p->mark; |
| 11603 | int _resmark = p->mark; |
| 11604 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11605 | int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); |
| 11606 | if (tmpvar_3) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11607 | D(p->level--); |
| 11608 | return _res; |
| 11609 | } |
| 11610 | p->mark = _mark; |
| 11611 | void *_raw = bitwise_xor_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11612 | if (p->error_indicator) |
| 11613 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11614 | if (_raw == NULL || p->mark <= _resmark) |
| 11615 | break; |
| 11616 | _resmark = p->mark; |
| 11617 | _res = _raw; |
| 11618 | } |
| 11619 | p->mark = _resmark; |
| 11620 | D(p->level--); |
| 11621 | return _res; |
| 11622 | } |
| 11623 | static expr_ty |
| 11624 | bitwise_xor_raw(Parser *p) |
| 11625 | { |
| 11626 | D(p->level++); |
| 11627 | if (p->error_indicator) { |
| 11628 | D(p->level--); |
| 11629 | return NULL; |
| 11630 | } |
| 11631 | expr_ty _res = NULL; |
| 11632 | int _mark = p->mark; |
| 11633 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11634 | p->error_indicator = 1; |
| 11635 | D(p->level--); |
| 11636 | return NULL; |
| 11637 | } |
| 11638 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11639 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11640 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11641 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 11642 | { // bitwise_xor '^' bitwise_and |
| 11643 | if (p->error_indicator) { |
| 11644 | D(p->level--); |
| 11645 | return NULL; |
| 11646 | } |
| 11647 | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
| 11648 | Token * _literal; |
| 11649 | expr_ty a; |
| 11650 | expr_ty b; |
| 11651 | if ( |
| 11652 | (a = bitwise_xor_rule(p)) // bitwise_xor |
| 11653 | && |
| 11654 | (_literal = _PyPegen_expect_token(p, 32)) // token='^' |
| 11655 | && |
| 11656 | (b = bitwise_and_rule(p)) // bitwise_and |
| 11657 | ) |
| 11658 | { |
| 11659 | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
| 11660 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11661 | if (_token == NULL) { |
| 11662 | D(p->level--); |
| 11663 | return NULL; |
| 11664 | } |
| 11665 | int _end_lineno = _token->end_lineno; |
| 11666 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11667 | int _end_col_offset = _token->end_col_offset; |
| 11668 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11669 | _res = _Py_BinOp ( a , BitXor , b , EXTRA ); |
| 11670 | if (_res == NULL && PyErr_Occurred()) { |
| 11671 | p->error_indicator = 1; |
| 11672 | D(p->level--); |
| 11673 | return NULL; |
| 11674 | } |
| 11675 | goto done; |
| 11676 | } |
| 11677 | p->mark = _mark; |
| 11678 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
| 11679 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
| 11680 | } |
| 11681 | { // bitwise_and |
| 11682 | if (p->error_indicator) { |
| 11683 | D(p->level--); |
| 11684 | return NULL; |
| 11685 | } |
| 11686 | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and")); |
| 11687 | expr_ty bitwise_and_var; |
| 11688 | if ( |
| 11689 | (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and |
| 11690 | ) |
| 11691 | { |
| 11692 | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and")); |
| 11693 | _res = bitwise_and_var; |
| 11694 | goto done; |
| 11695 | } |
| 11696 | p->mark = _mark; |
| 11697 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
| 11698 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and")); |
| 11699 | } |
| 11700 | _res = NULL; |
| 11701 | done: |
| 11702 | D(p->level--); |
| 11703 | return _res; |
| 11704 | } |
| 11705 | |
| 11706 | // Left-recursive |
| 11707 | // bitwise_and: bitwise_and '&' shift_expr | shift_expr |
| 11708 | static expr_ty bitwise_and_raw(Parser *); |
| 11709 | static expr_ty |
| 11710 | bitwise_and_rule(Parser *p) |
| 11711 | { |
| 11712 | D(p->level++); |
| 11713 | expr_ty _res = NULL; |
| 11714 | if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) { |
| 11715 | D(p->level--); |
| 11716 | return _res; |
| 11717 | } |
| 11718 | int _mark = p->mark; |
| 11719 | int _resmark = p->mark; |
| 11720 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11721 | int tmpvar_4 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); |
| 11722 | if (tmpvar_4) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11723 | D(p->level--); |
| 11724 | return _res; |
| 11725 | } |
| 11726 | p->mark = _mark; |
| 11727 | void *_raw = bitwise_and_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11728 | if (p->error_indicator) |
| 11729 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11730 | if (_raw == NULL || p->mark <= _resmark) |
| 11731 | break; |
| 11732 | _resmark = p->mark; |
| 11733 | _res = _raw; |
| 11734 | } |
| 11735 | p->mark = _resmark; |
| 11736 | D(p->level--); |
| 11737 | return _res; |
| 11738 | } |
| 11739 | static expr_ty |
| 11740 | bitwise_and_raw(Parser *p) |
| 11741 | { |
| 11742 | D(p->level++); |
| 11743 | if (p->error_indicator) { |
| 11744 | D(p->level--); |
| 11745 | return NULL; |
| 11746 | } |
| 11747 | expr_ty _res = NULL; |
| 11748 | int _mark = p->mark; |
| 11749 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11750 | p->error_indicator = 1; |
| 11751 | D(p->level--); |
| 11752 | return NULL; |
| 11753 | } |
| 11754 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11755 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11756 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11757 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 11758 | { // bitwise_and '&' shift_expr |
| 11759 | if (p->error_indicator) { |
| 11760 | D(p->level--); |
| 11761 | return NULL; |
| 11762 | } |
| 11763 | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); |
| 11764 | Token * _literal; |
| 11765 | expr_ty a; |
| 11766 | expr_ty b; |
| 11767 | if ( |
| 11768 | (a = bitwise_and_rule(p)) // bitwise_and |
| 11769 | && |
| 11770 | (_literal = _PyPegen_expect_token(p, 19)) // token='&' |
| 11771 | && |
| 11772 | (b = shift_expr_rule(p)) // shift_expr |
| 11773 | ) |
| 11774 | { |
| 11775 | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); |
| 11776 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11777 | if (_token == NULL) { |
| 11778 | D(p->level--); |
| 11779 | return NULL; |
| 11780 | } |
| 11781 | int _end_lineno = _token->end_lineno; |
| 11782 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11783 | int _end_col_offset = _token->end_col_offset; |
| 11784 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11785 | _res = _Py_BinOp ( a , BitAnd , b , EXTRA ); |
| 11786 | if (_res == NULL && PyErr_Occurred()) { |
| 11787 | p->error_indicator = 1; |
| 11788 | D(p->level--); |
| 11789 | return NULL; |
| 11790 | } |
| 11791 | goto done; |
| 11792 | } |
| 11793 | p->mark = _mark; |
| 11794 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
| 11795 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr")); |
| 11796 | } |
| 11797 | { // shift_expr |
| 11798 | if (p->error_indicator) { |
| 11799 | D(p->level--); |
| 11800 | return NULL; |
| 11801 | } |
| 11802 | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr")); |
| 11803 | expr_ty shift_expr_var; |
| 11804 | if ( |
| 11805 | (shift_expr_var = shift_expr_rule(p)) // shift_expr |
| 11806 | ) |
| 11807 | { |
| 11808 | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr")); |
| 11809 | _res = shift_expr_var; |
| 11810 | goto done; |
| 11811 | } |
| 11812 | p->mark = _mark; |
| 11813 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
| 11814 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr")); |
| 11815 | } |
| 11816 | _res = NULL; |
| 11817 | done: |
| 11818 | D(p->level--); |
| 11819 | return _res; |
| 11820 | } |
| 11821 | |
| 11822 | // Left-recursive |
| 11823 | // shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum |
| 11824 | static expr_ty shift_expr_raw(Parser *); |
| 11825 | static expr_ty |
| 11826 | shift_expr_rule(Parser *p) |
| 11827 | { |
| 11828 | D(p->level++); |
| 11829 | expr_ty _res = NULL; |
| 11830 | if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) { |
| 11831 | D(p->level--); |
| 11832 | return _res; |
| 11833 | } |
| 11834 | int _mark = p->mark; |
| 11835 | int _resmark = p->mark; |
| 11836 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11837 | int tmpvar_5 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); |
| 11838 | if (tmpvar_5) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11839 | D(p->level--); |
| 11840 | return _res; |
| 11841 | } |
| 11842 | p->mark = _mark; |
| 11843 | void *_raw = shift_expr_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11844 | if (p->error_indicator) |
| 11845 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11846 | if (_raw == NULL || p->mark <= _resmark) |
| 11847 | break; |
| 11848 | _resmark = p->mark; |
| 11849 | _res = _raw; |
| 11850 | } |
| 11851 | p->mark = _resmark; |
| 11852 | D(p->level--); |
| 11853 | return _res; |
| 11854 | } |
| 11855 | static expr_ty |
| 11856 | shift_expr_raw(Parser *p) |
| 11857 | { |
| 11858 | D(p->level++); |
| 11859 | if (p->error_indicator) { |
| 11860 | D(p->level--); |
| 11861 | return NULL; |
| 11862 | } |
| 11863 | expr_ty _res = NULL; |
| 11864 | int _mark = p->mark; |
| 11865 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11866 | p->error_indicator = 1; |
| 11867 | D(p->level--); |
| 11868 | return NULL; |
| 11869 | } |
| 11870 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11871 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11872 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11873 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 11874 | { // shift_expr '<<' sum |
| 11875 | if (p->error_indicator) { |
| 11876 | D(p->level--); |
| 11877 | return NULL; |
| 11878 | } |
| 11879 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); |
| 11880 | Token * _literal; |
| 11881 | expr_ty a; |
| 11882 | expr_ty b; |
| 11883 | if ( |
| 11884 | (a = shift_expr_rule(p)) // shift_expr |
| 11885 | && |
| 11886 | (_literal = _PyPegen_expect_token(p, 33)) // token='<<' |
| 11887 | && |
| 11888 | (b = sum_rule(p)) // sum |
| 11889 | ) |
| 11890 | { |
| 11891 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); |
| 11892 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11893 | if (_token == NULL) { |
| 11894 | D(p->level--); |
| 11895 | return NULL; |
| 11896 | } |
| 11897 | int _end_lineno = _token->end_lineno; |
| 11898 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11899 | int _end_col_offset = _token->end_col_offset; |
| 11900 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11901 | _res = _Py_BinOp ( a , LShift , b , EXTRA ); |
| 11902 | if (_res == NULL && PyErr_Occurred()) { |
| 11903 | p->error_indicator = 1; |
| 11904 | D(p->level--); |
| 11905 | return NULL; |
| 11906 | } |
| 11907 | goto done; |
| 11908 | } |
| 11909 | p->mark = _mark; |
| 11910 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11911 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum")); |
| 11912 | } |
| 11913 | { // shift_expr '>>' sum |
| 11914 | if (p->error_indicator) { |
| 11915 | D(p->level--); |
| 11916 | return NULL; |
| 11917 | } |
| 11918 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); |
| 11919 | Token * _literal; |
| 11920 | expr_ty a; |
| 11921 | expr_ty b; |
| 11922 | if ( |
| 11923 | (a = shift_expr_rule(p)) // shift_expr |
| 11924 | && |
| 11925 | (_literal = _PyPegen_expect_token(p, 34)) // token='>>' |
| 11926 | && |
| 11927 | (b = sum_rule(p)) // sum |
| 11928 | ) |
| 11929 | { |
| 11930 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); |
| 11931 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11932 | if (_token == NULL) { |
| 11933 | D(p->level--); |
| 11934 | return NULL; |
| 11935 | } |
| 11936 | int _end_lineno = _token->end_lineno; |
| 11937 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11938 | int _end_col_offset = _token->end_col_offset; |
| 11939 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11940 | _res = _Py_BinOp ( a , RShift , b , EXTRA ); |
| 11941 | if (_res == NULL && PyErr_Occurred()) { |
| 11942 | p->error_indicator = 1; |
| 11943 | D(p->level--); |
| 11944 | return NULL; |
| 11945 | } |
| 11946 | goto done; |
| 11947 | } |
| 11948 | p->mark = _mark; |
| 11949 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11950 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum")); |
| 11951 | } |
| 11952 | { // sum |
| 11953 | if (p->error_indicator) { |
| 11954 | D(p->level--); |
| 11955 | return NULL; |
| 11956 | } |
| 11957 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum")); |
| 11958 | expr_ty sum_var; |
| 11959 | if ( |
| 11960 | (sum_var = sum_rule(p)) // sum |
| 11961 | ) |
| 11962 | { |
| 11963 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum")); |
| 11964 | _res = sum_var; |
| 11965 | goto done; |
| 11966 | } |
| 11967 | p->mark = _mark; |
| 11968 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11969 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum")); |
| 11970 | } |
| 11971 | _res = NULL; |
| 11972 | done: |
| 11973 | D(p->level--); |
| 11974 | return _res; |
| 11975 | } |
| 11976 | |
| 11977 | // Left-recursive |
| 11978 | // sum: sum '+' term | sum '-' term | term |
| 11979 | static expr_ty sum_raw(Parser *); |
| 11980 | static expr_ty |
| 11981 | sum_rule(Parser *p) |
| 11982 | { |
| 11983 | D(p->level++); |
| 11984 | expr_ty _res = NULL; |
| 11985 | if (_PyPegen_is_memoized(p, sum_type, &_res)) { |
| 11986 | D(p->level--); |
| 11987 | return _res; |
| 11988 | } |
| 11989 | int _mark = p->mark; |
| 11990 | int _resmark = p->mark; |
| 11991 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 11992 | int tmpvar_6 = _PyPegen_update_memo(p, _mark, sum_type, _res); |
| 11993 | if (tmpvar_6) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 11994 | D(p->level--); |
| 11995 | return _res; |
| 11996 | } |
| 11997 | p->mark = _mark; |
| 11998 | void *_raw = sum_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 11999 | if (p->error_indicator) |
| 12000 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12001 | if (_raw == NULL || p->mark <= _resmark) |
| 12002 | break; |
| 12003 | _resmark = p->mark; |
| 12004 | _res = _raw; |
| 12005 | } |
| 12006 | p->mark = _resmark; |
| 12007 | D(p->level--); |
| 12008 | return _res; |
| 12009 | } |
| 12010 | static expr_ty |
| 12011 | sum_raw(Parser *p) |
| 12012 | { |
| 12013 | D(p->level++); |
| 12014 | if (p->error_indicator) { |
| 12015 | D(p->level--); |
| 12016 | return NULL; |
| 12017 | } |
| 12018 | expr_ty _res = NULL; |
| 12019 | int _mark = p->mark; |
| 12020 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12021 | p->error_indicator = 1; |
| 12022 | D(p->level--); |
| 12023 | return NULL; |
| 12024 | } |
| 12025 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12026 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12027 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12028 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12029 | { // sum '+' term |
| 12030 | if (p->error_indicator) { |
| 12031 | D(p->level--); |
| 12032 | return NULL; |
| 12033 | } |
| 12034 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term")); |
| 12035 | Token * _literal; |
| 12036 | expr_ty a; |
| 12037 | expr_ty b; |
| 12038 | if ( |
| 12039 | (a = sum_rule(p)) // sum |
| 12040 | && |
| 12041 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
| 12042 | && |
| 12043 | (b = term_rule(p)) // term |
| 12044 | ) |
| 12045 | { |
| 12046 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term")); |
| 12047 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12048 | if (_token == NULL) { |
| 12049 | D(p->level--); |
| 12050 | return NULL; |
| 12051 | } |
| 12052 | int _end_lineno = _token->end_lineno; |
| 12053 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12054 | int _end_col_offset = _token->end_col_offset; |
| 12055 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12056 | _res = _Py_BinOp ( a , Add , b , EXTRA ); |
| 12057 | if (_res == NULL && PyErr_Occurred()) { |
| 12058 | p->error_indicator = 1; |
| 12059 | D(p->level--); |
| 12060 | return NULL; |
| 12061 | } |
| 12062 | goto done; |
| 12063 | } |
| 12064 | p->mark = _mark; |
| 12065 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 12066 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term")); |
| 12067 | } |
| 12068 | { // sum '-' term |
| 12069 | if (p->error_indicator) { |
| 12070 | D(p->level--); |
| 12071 | return NULL; |
| 12072 | } |
| 12073 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term")); |
| 12074 | Token * _literal; |
| 12075 | expr_ty a; |
| 12076 | expr_ty b; |
| 12077 | if ( |
| 12078 | (a = sum_rule(p)) // sum |
| 12079 | && |
| 12080 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 12081 | && |
| 12082 | (b = term_rule(p)) // term |
| 12083 | ) |
| 12084 | { |
| 12085 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term")); |
| 12086 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12087 | if (_token == NULL) { |
| 12088 | D(p->level--); |
| 12089 | return NULL; |
| 12090 | } |
| 12091 | int _end_lineno = _token->end_lineno; |
| 12092 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12093 | int _end_col_offset = _token->end_col_offset; |
| 12094 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12095 | _res = _Py_BinOp ( a , Sub , b , EXTRA ); |
| 12096 | if (_res == NULL && PyErr_Occurred()) { |
| 12097 | p->error_indicator = 1; |
| 12098 | D(p->level--); |
| 12099 | return NULL; |
| 12100 | } |
| 12101 | goto done; |
| 12102 | } |
| 12103 | p->mark = _mark; |
| 12104 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 12105 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term")); |
| 12106 | } |
| 12107 | { // term |
| 12108 | if (p->error_indicator) { |
| 12109 | D(p->level--); |
| 12110 | return NULL; |
| 12111 | } |
| 12112 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term")); |
| 12113 | expr_ty term_var; |
| 12114 | if ( |
| 12115 | (term_var = term_rule(p)) // term |
| 12116 | ) |
| 12117 | { |
| 12118 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term")); |
| 12119 | _res = term_var; |
| 12120 | goto done; |
| 12121 | } |
| 12122 | p->mark = _mark; |
| 12123 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 12124 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term")); |
| 12125 | } |
| 12126 | _res = NULL; |
| 12127 | done: |
| 12128 | D(p->level--); |
| 12129 | return _res; |
| 12130 | } |
| 12131 | |
| 12132 | // Left-recursive |
| 12133 | // term: |
| 12134 | // | term '*' factor |
| 12135 | // | term '/' factor |
| 12136 | // | term '//' factor |
| 12137 | // | term '%' factor |
| 12138 | // | term '@' factor |
| 12139 | // | factor |
| 12140 | static expr_ty term_raw(Parser *); |
| 12141 | static expr_ty |
| 12142 | term_rule(Parser *p) |
| 12143 | { |
| 12144 | D(p->level++); |
| 12145 | expr_ty _res = NULL; |
| 12146 | if (_PyPegen_is_memoized(p, term_type, &_res)) { |
| 12147 | D(p->level--); |
| 12148 | return _res; |
| 12149 | } |
| 12150 | int _mark = p->mark; |
| 12151 | int _resmark = p->mark; |
| 12152 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 12153 | int tmpvar_7 = _PyPegen_update_memo(p, _mark, term_type, _res); |
| 12154 | if (tmpvar_7) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12155 | D(p->level--); |
| 12156 | return _res; |
| 12157 | } |
| 12158 | p->mark = _mark; |
| 12159 | void *_raw = term_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 12160 | if (p->error_indicator) |
| 12161 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12162 | if (_raw == NULL || p->mark <= _resmark) |
| 12163 | break; |
| 12164 | _resmark = p->mark; |
| 12165 | _res = _raw; |
| 12166 | } |
| 12167 | p->mark = _resmark; |
| 12168 | D(p->level--); |
| 12169 | return _res; |
| 12170 | } |
| 12171 | static expr_ty |
| 12172 | term_raw(Parser *p) |
| 12173 | { |
| 12174 | D(p->level++); |
| 12175 | if (p->error_indicator) { |
| 12176 | D(p->level--); |
| 12177 | return NULL; |
| 12178 | } |
| 12179 | expr_ty _res = NULL; |
| 12180 | int _mark = p->mark; |
| 12181 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12182 | p->error_indicator = 1; |
| 12183 | D(p->level--); |
| 12184 | return NULL; |
| 12185 | } |
| 12186 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12187 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12188 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12189 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12190 | { // term '*' factor |
| 12191 | if (p->error_indicator) { |
| 12192 | D(p->level--); |
| 12193 | return NULL; |
| 12194 | } |
| 12195 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor")); |
| 12196 | Token * _literal; |
| 12197 | expr_ty a; |
| 12198 | expr_ty b; |
| 12199 | if ( |
| 12200 | (a = term_rule(p)) // term |
| 12201 | && |
| 12202 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 12203 | && |
| 12204 | (b = factor_rule(p)) // factor |
| 12205 | ) |
| 12206 | { |
| 12207 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor")); |
| 12208 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12209 | if (_token == NULL) { |
| 12210 | D(p->level--); |
| 12211 | return NULL; |
| 12212 | } |
| 12213 | int _end_lineno = _token->end_lineno; |
| 12214 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12215 | int _end_col_offset = _token->end_col_offset; |
| 12216 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12217 | _res = _Py_BinOp ( a , Mult , b , EXTRA ); |
| 12218 | if (_res == NULL && PyErr_Occurred()) { |
| 12219 | p->error_indicator = 1; |
| 12220 | D(p->level--); |
| 12221 | return NULL; |
| 12222 | } |
| 12223 | goto done; |
| 12224 | } |
| 12225 | p->mark = _mark; |
| 12226 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12227 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor")); |
| 12228 | } |
| 12229 | { // term '/' factor |
| 12230 | if (p->error_indicator) { |
| 12231 | D(p->level--); |
| 12232 | return NULL; |
| 12233 | } |
| 12234 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor")); |
| 12235 | Token * _literal; |
| 12236 | expr_ty a; |
| 12237 | expr_ty b; |
| 12238 | if ( |
| 12239 | (a = term_rule(p)) // term |
| 12240 | && |
| 12241 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
| 12242 | && |
| 12243 | (b = factor_rule(p)) // factor |
| 12244 | ) |
| 12245 | { |
| 12246 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor")); |
| 12247 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12248 | if (_token == NULL) { |
| 12249 | D(p->level--); |
| 12250 | return NULL; |
| 12251 | } |
| 12252 | int _end_lineno = _token->end_lineno; |
| 12253 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12254 | int _end_col_offset = _token->end_col_offset; |
| 12255 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12256 | _res = _Py_BinOp ( a , Div , b , EXTRA ); |
| 12257 | if (_res == NULL && PyErr_Occurred()) { |
| 12258 | p->error_indicator = 1; |
| 12259 | D(p->level--); |
| 12260 | return NULL; |
| 12261 | } |
| 12262 | goto done; |
| 12263 | } |
| 12264 | p->mark = _mark; |
| 12265 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12266 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor")); |
| 12267 | } |
| 12268 | { // term '//' factor |
| 12269 | if (p->error_indicator) { |
| 12270 | D(p->level--); |
| 12271 | return NULL; |
| 12272 | } |
| 12273 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor")); |
| 12274 | Token * _literal; |
| 12275 | expr_ty a; |
| 12276 | expr_ty b; |
| 12277 | if ( |
| 12278 | (a = term_rule(p)) // term |
| 12279 | && |
| 12280 | (_literal = _PyPegen_expect_token(p, 47)) // token='//' |
| 12281 | && |
| 12282 | (b = factor_rule(p)) // factor |
| 12283 | ) |
| 12284 | { |
| 12285 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor")); |
| 12286 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12287 | if (_token == NULL) { |
| 12288 | D(p->level--); |
| 12289 | return NULL; |
| 12290 | } |
| 12291 | int _end_lineno = _token->end_lineno; |
| 12292 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12293 | int _end_col_offset = _token->end_col_offset; |
| 12294 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12295 | _res = _Py_BinOp ( a , FloorDiv , b , EXTRA ); |
| 12296 | if (_res == NULL && PyErr_Occurred()) { |
| 12297 | p->error_indicator = 1; |
| 12298 | D(p->level--); |
| 12299 | return NULL; |
| 12300 | } |
| 12301 | goto done; |
| 12302 | } |
| 12303 | p->mark = _mark; |
| 12304 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12305 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor")); |
| 12306 | } |
| 12307 | { // term '%' factor |
| 12308 | if (p->error_indicator) { |
| 12309 | D(p->level--); |
| 12310 | return NULL; |
| 12311 | } |
| 12312 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor")); |
| 12313 | Token * _literal; |
| 12314 | expr_ty a; |
| 12315 | expr_ty b; |
| 12316 | if ( |
| 12317 | (a = term_rule(p)) // term |
| 12318 | && |
| 12319 | (_literal = _PyPegen_expect_token(p, 24)) // token='%' |
| 12320 | && |
| 12321 | (b = factor_rule(p)) // factor |
| 12322 | ) |
| 12323 | { |
| 12324 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor")); |
| 12325 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12326 | if (_token == NULL) { |
| 12327 | D(p->level--); |
| 12328 | return NULL; |
| 12329 | } |
| 12330 | int _end_lineno = _token->end_lineno; |
| 12331 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12332 | int _end_col_offset = _token->end_col_offset; |
| 12333 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12334 | _res = _Py_BinOp ( a , Mod , b , EXTRA ); |
| 12335 | if (_res == NULL && PyErr_Occurred()) { |
| 12336 | p->error_indicator = 1; |
| 12337 | D(p->level--); |
| 12338 | return NULL; |
| 12339 | } |
| 12340 | goto done; |
| 12341 | } |
| 12342 | p->mark = _mark; |
| 12343 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12344 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor")); |
| 12345 | } |
| 12346 | { // term '@' factor |
| 12347 | if (p->error_indicator) { |
| 12348 | D(p->level--); |
| 12349 | return NULL; |
| 12350 | } |
| 12351 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor")); |
| 12352 | Token * _literal; |
| 12353 | expr_ty a; |
| 12354 | expr_ty b; |
| 12355 | if ( |
| 12356 | (a = term_rule(p)) // term |
| 12357 | && |
| 12358 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
| 12359 | && |
| 12360 | (b = factor_rule(p)) // factor |
| 12361 | ) |
| 12362 | { |
| 12363 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor")); |
| 12364 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12365 | if (_token == NULL) { |
| 12366 | D(p->level--); |
| 12367 | return NULL; |
| 12368 | } |
| 12369 | int _end_lineno = _token->end_lineno; |
| 12370 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12371 | int _end_col_offset = _token->end_col_offset; |
| 12372 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 12373 | _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] | 12374 | if (_res == NULL && PyErr_Occurred()) { |
| 12375 | p->error_indicator = 1; |
| 12376 | D(p->level--); |
| 12377 | return NULL; |
| 12378 | } |
| 12379 | goto done; |
| 12380 | } |
| 12381 | p->mark = _mark; |
| 12382 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12383 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor")); |
| 12384 | } |
| 12385 | { // factor |
| 12386 | if (p->error_indicator) { |
| 12387 | D(p->level--); |
| 12388 | return NULL; |
| 12389 | } |
| 12390 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor")); |
| 12391 | expr_ty factor_var; |
| 12392 | if ( |
| 12393 | (factor_var = factor_rule(p)) // factor |
| 12394 | ) |
| 12395 | { |
| 12396 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor")); |
| 12397 | _res = factor_var; |
| 12398 | goto done; |
| 12399 | } |
| 12400 | p->mark = _mark; |
| 12401 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 12402 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor")); |
| 12403 | } |
| 12404 | _res = NULL; |
| 12405 | done: |
| 12406 | D(p->level--); |
| 12407 | return _res; |
| 12408 | } |
| 12409 | |
| 12410 | // factor: '+' factor | '-' factor | '~' factor | power |
| 12411 | static expr_ty |
| 12412 | factor_rule(Parser *p) |
| 12413 | { |
| 12414 | D(p->level++); |
| 12415 | if (p->error_indicator) { |
| 12416 | D(p->level--); |
| 12417 | return NULL; |
| 12418 | } |
| 12419 | expr_ty _res = NULL; |
| 12420 | if (_PyPegen_is_memoized(p, factor_type, &_res)) { |
| 12421 | D(p->level--); |
| 12422 | return _res; |
| 12423 | } |
| 12424 | int _mark = p->mark; |
| 12425 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12426 | p->error_indicator = 1; |
| 12427 | D(p->level--); |
| 12428 | return NULL; |
| 12429 | } |
| 12430 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12431 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12432 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12433 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12434 | { // '+' factor |
| 12435 | if (p->error_indicator) { |
| 12436 | D(p->level--); |
| 12437 | return NULL; |
| 12438 | } |
| 12439 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor")); |
| 12440 | Token * _literal; |
| 12441 | expr_ty a; |
| 12442 | if ( |
| 12443 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
| 12444 | && |
| 12445 | (a = factor_rule(p)) // factor |
| 12446 | ) |
| 12447 | { |
| 12448 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor")); |
| 12449 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12450 | if (_token == NULL) { |
| 12451 | D(p->level--); |
| 12452 | return NULL; |
| 12453 | } |
| 12454 | int _end_lineno = _token->end_lineno; |
| 12455 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12456 | int _end_col_offset = _token->end_col_offset; |
| 12457 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12458 | _res = _Py_UnaryOp ( UAdd , a , EXTRA ); |
| 12459 | if (_res == NULL && PyErr_Occurred()) { |
| 12460 | p->error_indicator = 1; |
| 12461 | D(p->level--); |
| 12462 | return NULL; |
| 12463 | } |
| 12464 | goto done; |
| 12465 | } |
| 12466 | p->mark = _mark; |
| 12467 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 12468 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor")); |
| 12469 | } |
| 12470 | { // '-' factor |
| 12471 | if (p->error_indicator) { |
| 12472 | D(p->level--); |
| 12473 | return NULL; |
| 12474 | } |
| 12475 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor")); |
| 12476 | Token * _literal; |
| 12477 | expr_ty a; |
| 12478 | if ( |
| 12479 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 12480 | && |
| 12481 | (a = factor_rule(p)) // factor |
| 12482 | ) |
| 12483 | { |
| 12484 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor")); |
| 12485 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12486 | if (_token == NULL) { |
| 12487 | D(p->level--); |
| 12488 | return NULL; |
| 12489 | } |
| 12490 | int _end_lineno = _token->end_lineno; |
| 12491 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12492 | int _end_col_offset = _token->end_col_offset; |
| 12493 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12494 | _res = _Py_UnaryOp ( USub , a , EXTRA ); |
| 12495 | if (_res == NULL && PyErr_Occurred()) { |
| 12496 | p->error_indicator = 1; |
| 12497 | D(p->level--); |
| 12498 | return NULL; |
| 12499 | } |
| 12500 | goto done; |
| 12501 | } |
| 12502 | p->mark = _mark; |
| 12503 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 12504 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor")); |
| 12505 | } |
| 12506 | { // '~' factor |
| 12507 | if (p->error_indicator) { |
| 12508 | D(p->level--); |
| 12509 | return NULL; |
| 12510 | } |
| 12511 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor")); |
| 12512 | Token * _literal; |
| 12513 | expr_ty a; |
| 12514 | if ( |
| 12515 | (_literal = _PyPegen_expect_token(p, 31)) // token='~' |
| 12516 | && |
| 12517 | (a = factor_rule(p)) // factor |
| 12518 | ) |
| 12519 | { |
| 12520 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor")); |
| 12521 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12522 | if (_token == NULL) { |
| 12523 | D(p->level--); |
| 12524 | return NULL; |
| 12525 | } |
| 12526 | int _end_lineno = _token->end_lineno; |
| 12527 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12528 | int _end_col_offset = _token->end_col_offset; |
| 12529 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12530 | _res = _Py_UnaryOp ( Invert , a , EXTRA ); |
| 12531 | if (_res == NULL && PyErr_Occurred()) { |
| 12532 | p->error_indicator = 1; |
| 12533 | D(p->level--); |
| 12534 | return NULL; |
| 12535 | } |
| 12536 | goto done; |
| 12537 | } |
| 12538 | p->mark = _mark; |
| 12539 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 12540 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor")); |
| 12541 | } |
| 12542 | { // power |
| 12543 | if (p->error_indicator) { |
| 12544 | D(p->level--); |
| 12545 | return NULL; |
| 12546 | } |
| 12547 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power")); |
| 12548 | expr_ty power_var; |
| 12549 | if ( |
| 12550 | (power_var = power_rule(p)) // power |
| 12551 | ) |
| 12552 | { |
| 12553 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power")); |
| 12554 | _res = power_var; |
| 12555 | goto done; |
| 12556 | } |
| 12557 | p->mark = _mark; |
| 12558 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 12559 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power")); |
| 12560 | } |
| 12561 | _res = NULL; |
| 12562 | done: |
| 12563 | _PyPegen_insert_memo(p, _mark, factor_type, _res); |
| 12564 | D(p->level--); |
| 12565 | return _res; |
| 12566 | } |
| 12567 | |
| 12568 | // power: await_primary '**' factor | await_primary |
| 12569 | static expr_ty |
| 12570 | power_rule(Parser *p) |
| 12571 | { |
| 12572 | D(p->level++); |
| 12573 | if (p->error_indicator) { |
| 12574 | D(p->level--); |
| 12575 | return NULL; |
| 12576 | } |
| 12577 | expr_ty _res = NULL; |
| 12578 | int _mark = p->mark; |
| 12579 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12580 | p->error_indicator = 1; |
| 12581 | D(p->level--); |
| 12582 | return NULL; |
| 12583 | } |
| 12584 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12585 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12586 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12587 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12588 | { // await_primary '**' factor |
| 12589 | if (p->error_indicator) { |
| 12590 | D(p->level--); |
| 12591 | return NULL; |
| 12592 | } |
| 12593 | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); |
| 12594 | Token * _literal; |
| 12595 | expr_ty a; |
| 12596 | expr_ty b; |
| 12597 | if ( |
| 12598 | (a = await_primary_rule(p)) // await_primary |
| 12599 | && |
| 12600 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 12601 | && |
| 12602 | (b = factor_rule(p)) // factor |
| 12603 | ) |
| 12604 | { |
| 12605 | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); |
| 12606 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12607 | if (_token == NULL) { |
| 12608 | D(p->level--); |
| 12609 | return NULL; |
| 12610 | } |
| 12611 | int _end_lineno = _token->end_lineno; |
| 12612 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12613 | int _end_col_offset = _token->end_col_offset; |
| 12614 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12615 | _res = _Py_BinOp ( a , Pow , b , EXTRA ); |
| 12616 | if (_res == NULL && PyErr_Occurred()) { |
| 12617 | p->error_indicator = 1; |
| 12618 | D(p->level--); |
| 12619 | return NULL; |
| 12620 | } |
| 12621 | goto done; |
| 12622 | } |
| 12623 | p->mark = _mark; |
| 12624 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
| 12625 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor")); |
| 12626 | } |
| 12627 | { // await_primary |
| 12628 | if (p->error_indicator) { |
| 12629 | D(p->level--); |
| 12630 | return NULL; |
| 12631 | } |
| 12632 | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary")); |
| 12633 | expr_ty await_primary_var; |
| 12634 | if ( |
| 12635 | (await_primary_var = await_primary_rule(p)) // await_primary |
| 12636 | ) |
| 12637 | { |
| 12638 | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary")); |
| 12639 | _res = await_primary_var; |
| 12640 | goto done; |
| 12641 | } |
| 12642 | p->mark = _mark; |
| 12643 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
| 12644 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary")); |
| 12645 | } |
| 12646 | _res = NULL; |
| 12647 | done: |
| 12648 | D(p->level--); |
| 12649 | return _res; |
| 12650 | } |
| 12651 | |
| 12652 | // await_primary: AWAIT primary | primary |
| 12653 | static expr_ty |
| 12654 | await_primary_rule(Parser *p) |
| 12655 | { |
| 12656 | D(p->level++); |
| 12657 | if (p->error_indicator) { |
| 12658 | D(p->level--); |
| 12659 | return NULL; |
| 12660 | } |
| 12661 | expr_ty _res = NULL; |
| 12662 | if (_PyPegen_is_memoized(p, await_primary_type, &_res)) { |
| 12663 | D(p->level--); |
| 12664 | return _res; |
| 12665 | } |
| 12666 | int _mark = p->mark; |
| 12667 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12668 | p->error_indicator = 1; |
| 12669 | D(p->level--); |
| 12670 | return NULL; |
| 12671 | } |
| 12672 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12673 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12674 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12675 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 12676 | { // AWAIT primary |
| 12677 | if (p->error_indicator) { |
| 12678 | D(p->level--); |
| 12679 | return NULL; |
| 12680 | } |
| 12681 | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); |
| 12682 | expr_ty a; |
| 12683 | Token * await_var; |
| 12684 | if ( |
| 12685 | (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT' |
| 12686 | && |
| 12687 | (a = primary_rule(p)) // primary |
| 12688 | ) |
| 12689 | { |
| 12690 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); |
| 12691 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12692 | if (_token == NULL) { |
| 12693 | D(p->level--); |
| 12694 | return NULL; |
| 12695 | } |
| 12696 | int _end_lineno = _token->end_lineno; |
| 12697 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12698 | int _end_col_offset = _token->end_col_offset; |
| 12699 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 12700 | _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] | 12701 | if (_res == NULL && PyErr_Occurred()) { |
| 12702 | p->error_indicator = 1; |
| 12703 | D(p->level--); |
| 12704 | return NULL; |
| 12705 | } |
| 12706 | goto done; |
| 12707 | } |
| 12708 | p->mark = _mark; |
| 12709 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12710 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary")); |
| 12711 | } |
| 12712 | { // primary |
| 12713 | if (p->error_indicator) { |
| 12714 | D(p->level--); |
| 12715 | return NULL; |
| 12716 | } |
| 12717 | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary")); |
| 12718 | expr_ty primary_var; |
| 12719 | if ( |
| 12720 | (primary_var = primary_rule(p)) // primary |
| 12721 | ) |
| 12722 | { |
| 12723 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary")); |
| 12724 | _res = primary_var; |
| 12725 | goto done; |
| 12726 | } |
| 12727 | p->mark = _mark; |
| 12728 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12729 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary")); |
| 12730 | } |
| 12731 | _res = NULL; |
| 12732 | done: |
| 12733 | _PyPegen_insert_memo(p, _mark, await_primary_type, _res); |
| 12734 | D(p->level--); |
| 12735 | return _res; |
| 12736 | } |
| 12737 | |
| 12738 | // Left-recursive |
| 12739 | // primary: |
Lysandros Nikolaou | 15acc4e | 2020-10-27 20:54:20 +0200 | [diff] [blame] | 12740 | // | invalid_primary |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12741 | // | primary '.' NAME |
| 12742 | // | primary genexp |
| 12743 | // | primary '(' arguments? ')' |
| 12744 | // | primary '[' slices ']' |
| 12745 | // | atom |
| 12746 | static expr_ty primary_raw(Parser *); |
| 12747 | static expr_ty |
| 12748 | primary_rule(Parser *p) |
| 12749 | { |
| 12750 | D(p->level++); |
| 12751 | expr_ty _res = NULL; |
| 12752 | if (_PyPegen_is_memoized(p, primary_type, &_res)) { |
| 12753 | D(p->level--); |
| 12754 | return _res; |
| 12755 | } |
| 12756 | int _mark = p->mark; |
| 12757 | int _resmark = p->mark; |
| 12758 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 12759 | int tmpvar_8 = _PyPegen_update_memo(p, _mark, primary_type, _res); |
| 12760 | if (tmpvar_8) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12761 | D(p->level--); |
| 12762 | return _res; |
| 12763 | } |
| 12764 | p->mark = _mark; |
| 12765 | void *_raw = primary_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 12766 | if (p->error_indicator) |
| 12767 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12768 | if (_raw == NULL || p->mark <= _resmark) |
| 12769 | break; |
| 12770 | _resmark = p->mark; |
| 12771 | _res = _raw; |
| 12772 | } |
| 12773 | p->mark = _resmark; |
| 12774 | D(p->level--); |
| 12775 | return _res; |
| 12776 | } |
| 12777 | static expr_ty |
| 12778 | primary_raw(Parser *p) |
| 12779 | { |
| 12780 | D(p->level++); |
| 12781 | if (p->error_indicator) { |
| 12782 | D(p->level--); |
| 12783 | return NULL; |
| 12784 | } |
| 12785 | expr_ty _res = NULL; |
| 12786 | int _mark = p->mark; |
| 12787 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12788 | p->error_indicator = 1; |
| 12789 | D(p->level--); |
| 12790 | return NULL; |
| 12791 | } |
| 12792 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12793 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12794 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12795 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 15acc4e | 2020-10-27 20:54:20 +0200 | [diff] [blame] | 12796 | if (p->call_invalid_rules) { // invalid_primary |
| 12797 | if (p->error_indicator) { |
| 12798 | D(p->level--); |
| 12799 | return NULL; |
| 12800 | } |
| 12801 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_primary")); |
| 12802 | void *invalid_primary_var; |
| 12803 | if ( |
| 12804 | (invalid_primary_var = invalid_primary_rule(p)) // invalid_primary |
| 12805 | ) |
| 12806 | { |
| 12807 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_primary")); |
| 12808 | _res = invalid_primary_var; |
| 12809 | goto done; |
| 12810 | } |
| 12811 | p->mark = _mark; |
| 12812 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12813 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_primary")); |
| 12814 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 12815 | { // primary '.' NAME |
| 12816 | if (p->error_indicator) { |
| 12817 | D(p->level--); |
| 12818 | return NULL; |
| 12819 | } |
| 12820 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); |
| 12821 | Token * _literal; |
| 12822 | expr_ty a; |
| 12823 | expr_ty b; |
| 12824 | if ( |
| 12825 | (a = primary_rule(p)) // primary |
| 12826 | && |
| 12827 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 12828 | && |
| 12829 | (b = _PyPegen_name_token(p)) // NAME |
| 12830 | ) |
| 12831 | { |
| 12832 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); |
| 12833 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12834 | if (_token == NULL) { |
| 12835 | D(p->level--); |
| 12836 | return NULL; |
| 12837 | } |
| 12838 | int _end_lineno = _token->end_lineno; |
| 12839 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12840 | int _end_col_offset = _token->end_col_offset; |
| 12841 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12842 | _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
| 12843 | if (_res == NULL && PyErr_Occurred()) { |
| 12844 | p->error_indicator = 1; |
| 12845 | D(p->level--); |
| 12846 | return NULL; |
| 12847 | } |
| 12848 | goto done; |
| 12849 | } |
| 12850 | p->mark = _mark; |
| 12851 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12852 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME")); |
| 12853 | } |
| 12854 | { // primary genexp |
| 12855 | if (p->error_indicator) { |
| 12856 | D(p->level--); |
| 12857 | return NULL; |
| 12858 | } |
| 12859 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp")); |
| 12860 | expr_ty a; |
| 12861 | expr_ty b; |
| 12862 | if ( |
| 12863 | (a = primary_rule(p)) // primary |
| 12864 | && |
| 12865 | (b = genexp_rule(p)) // genexp |
| 12866 | ) |
| 12867 | { |
| 12868 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp")); |
| 12869 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12870 | if (_token == NULL) { |
| 12871 | D(p->level--); |
| 12872 | return NULL; |
| 12873 | } |
| 12874 | int _end_lineno = _token->end_lineno; |
| 12875 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12876 | int _end_col_offset = _token->end_col_offset; |
| 12877 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 12878 | _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] | 12879 | if (_res == NULL && PyErr_Occurred()) { |
| 12880 | p->error_indicator = 1; |
| 12881 | D(p->level--); |
| 12882 | return NULL; |
| 12883 | } |
| 12884 | goto done; |
| 12885 | } |
| 12886 | p->mark = _mark; |
| 12887 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12888 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp")); |
| 12889 | } |
| 12890 | { // primary '(' arguments? ')' |
| 12891 | if (p->error_indicator) { |
| 12892 | D(p->level--); |
| 12893 | return NULL; |
| 12894 | } |
| 12895 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); |
| 12896 | Token * _literal; |
| 12897 | Token * _literal_1; |
| 12898 | expr_ty a; |
| 12899 | void *b; |
| 12900 | if ( |
| 12901 | (a = primary_rule(p)) // primary |
| 12902 | && |
| 12903 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 12904 | && |
| 12905 | (b = arguments_rule(p), 1) // arguments? |
| 12906 | && |
| 12907 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 12908 | ) |
| 12909 | { |
| 12910 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); |
| 12911 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12912 | if (_token == NULL) { |
| 12913 | D(p->level--); |
| 12914 | return NULL; |
| 12915 | } |
| 12916 | int _end_lineno = _token->end_lineno; |
| 12917 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12918 | int _end_col_offset = _token->end_col_offset; |
| 12919 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12920 | _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 12921 | if (_res == NULL && PyErr_Occurred()) { |
| 12922 | p->error_indicator = 1; |
| 12923 | D(p->level--); |
| 12924 | return NULL; |
| 12925 | } |
| 12926 | goto done; |
| 12927 | } |
| 12928 | p->mark = _mark; |
| 12929 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12930 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'")); |
| 12931 | } |
| 12932 | { // primary '[' slices ']' |
| 12933 | if (p->error_indicator) { |
| 12934 | D(p->level--); |
| 12935 | return NULL; |
| 12936 | } |
| 12937 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); |
| 12938 | Token * _literal; |
| 12939 | Token * _literal_1; |
| 12940 | expr_ty a; |
| 12941 | expr_ty b; |
| 12942 | if ( |
| 12943 | (a = primary_rule(p)) // primary |
| 12944 | && |
| 12945 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 12946 | && |
| 12947 | (b = slices_rule(p)) // slices |
| 12948 | && |
| 12949 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 12950 | ) |
| 12951 | { |
| 12952 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); |
| 12953 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12954 | if (_token == NULL) { |
| 12955 | D(p->level--); |
| 12956 | return NULL; |
| 12957 | } |
| 12958 | int _end_lineno = _token->end_lineno; |
| 12959 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12960 | int _end_col_offset = _token->end_col_offset; |
| 12961 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12962 | _res = _Py_Subscript ( a , b , Load , EXTRA ); |
| 12963 | if (_res == NULL && PyErr_Occurred()) { |
| 12964 | p->error_indicator = 1; |
| 12965 | D(p->level--); |
| 12966 | return NULL; |
| 12967 | } |
| 12968 | goto done; |
| 12969 | } |
| 12970 | p->mark = _mark; |
| 12971 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12972 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'")); |
| 12973 | } |
| 12974 | { // atom |
| 12975 | if (p->error_indicator) { |
| 12976 | D(p->level--); |
| 12977 | return NULL; |
| 12978 | } |
| 12979 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom")); |
| 12980 | expr_ty atom_var; |
| 12981 | if ( |
| 12982 | (atom_var = atom_rule(p)) // atom |
| 12983 | ) |
| 12984 | { |
| 12985 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom")); |
| 12986 | _res = atom_var; |
| 12987 | goto done; |
| 12988 | } |
| 12989 | p->mark = _mark; |
| 12990 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 12991 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom")); |
| 12992 | } |
| 12993 | _res = NULL; |
| 12994 | done: |
| 12995 | D(p->level--); |
| 12996 | return _res; |
| 12997 | } |
| 12998 | |
| 12999 | // slices: slice !',' | ','.slice+ ','? |
| 13000 | static expr_ty |
| 13001 | slices_rule(Parser *p) |
| 13002 | { |
| 13003 | D(p->level++); |
| 13004 | if (p->error_indicator) { |
| 13005 | D(p->level--); |
| 13006 | return NULL; |
| 13007 | } |
| 13008 | expr_ty _res = NULL; |
| 13009 | int _mark = p->mark; |
| 13010 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13011 | p->error_indicator = 1; |
| 13012 | D(p->level--); |
| 13013 | return NULL; |
| 13014 | } |
| 13015 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13016 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13017 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13018 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13019 | { // slice !',' |
| 13020 | if (p->error_indicator) { |
| 13021 | D(p->level--); |
| 13022 | return NULL; |
| 13023 | } |
| 13024 | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','")); |
| 13025 | expr_ty a; |
| 13026 | if ( |
| 13027 | (a = slice_rule(p)) // slice |
| 13028 | && |
| 13029 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
| 13030 | ) |
| 13031 | { |
| 13032 | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','")); |
| 13033 | _res = a; |
| 13034 | if (_res == NULL && PyErr_Occurred()) { |
| 13035 | p->error_indicator = 1; |
| 13036 | D(p->level--); |
| 13037 | return NULL; |
| 13038 | } |
| 13039 | goto done; |
| 13040 | } |
| 13041 | p->mark = _mark; |
| 13042 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
| 13043 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','")); |
| 13044 | } |
| 13045 | { // ','.slice+ ','? |
| 13046 | if (p->error_indicator) { |
| 13047 | D(p->level--); |
| 13048 | return NULL; |
| 13049 | } |
| 13050 | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); |
| 13051 | void *_opt_var; |
| 13052 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13053 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13054 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13055 | (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.slice+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13056 | && |
| 13057 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 13058 | ) |
| 13059 | { |
| 13060 | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); |
| 13061 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13062 | if (_token == NULL) { |
| 13063 | D(p->level--); |
| 13064 | return NULL; |
| 13065 | } |
| 13066 | int _end_lineno = _token->end_lineno; |
| 13067 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13068 | int _end_col_offset = _token->end_col_offset; |
| 13069 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13070 | _res = _Py_Tuple ( a , Load , EXTRA ); |
| 13071 | if (_res == NULL && PyErr_Occurred()) { |
| 13072 | p->error_indicator = 1; |
| 13073 | D(p->level--); |
| 13074 | return NULL; |
| 13075 | } |
| 13076 | goto done; |
| 13077 | } |
| 13078 | p->mark = _mark; |
| 13079 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
| 13080 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?")); |
| 13081 | } |
| 13082 | _res = NULL; |
| 13083 | done: |
| 13084 | D(p->level--); |
| 13085 | return _res; |
| 13086 | } |
| 13087 | |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13088 | // slice: expression? ':' expression? [':' expression?] | named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13089 | static expr_ty |
| 13090 | slice_rule(Parser *p) |
| 13091 | { |
| 13092 | D(p->level++); |
| 13093 | if (p->error_indicator) { |
| 13094 | D(p->level--); |
| 13095 | return NULL; |
| 13096 | } |
| 13097 | expr_ty _res = NULL; |
| 13098 | int _mark = p->mark; |
| 13099 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13100 | p->error_indicator = 1; |
| 13101 | D(p->level--); |
| 13102 | return NULL; |
| 13103 | } |
| 13104 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13105 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13106 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13107 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13108 | { // expression? ':' expression? [':' expression?] |
| 13109 | if (p->error_indicator) { |
| 13110 | D(p->level--); |
| 13111 | return NULL; |
| 13112 | } |
| 13113 | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
| 13114 | Token * _literal; |
| 13115 | void *a; |
| 13116 | void *b; |
| 13117 | void *c; |
| 13118 | if ( |
| 13119 | (a = expression_rule(p), 1) // expression? |
| 13120 | && |
| 13121 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 13122 | && |
| 13123 | (b = expression_rule(p), 1) // expression? |
| 13124 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13125 | (c = _tmp_110_rule(p), 1) // [':' expression?] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13126 | ) |
| 13127 | { |
| 13128 | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
| 13129 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13130 | if (_token == NULL) { |
| 13131 | D(p->level--); |
| 13132 | return NULL; |
| 13133 | } |
| 13134 | int _end_lineno = _token->end_lineno; |
| 13135 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13136 | int _end_col_offset = _token->end_col_offset; |
| 13137 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13138 | _res = _Py_Slice ( a , b , c , EXTRA ); |
| 13139 | if (_res == NULL && PyErr_Occurred()) { |
| 13140 | p->error_indicator = 1; |
| 13141 | D(p->level--); |
| 13142 | return NULL; |
| 13143 | } |
| 13144 | goto done; |
| 13145 | } |
| 13146 | p->mark = _mark; |
| 13147 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
| 13148 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
| 13149 | } |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13150 | { // named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13151 | if (p->error_indicator) { |
| 13152 | D(p->level--); |
| 13153 | return NULL; |
| 13154 | } |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13155 | 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] | 13156 | expr_ty a; |
| 13157 | if ( |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13158 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13159 | ) |
| 13160 | { |
Lysandros Nikolaou | cae6018 | 2020-11-17 01:09:35 +0200 | [diff] [blame] | 13161 | 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] | 13162 | _res = a; |
| 13163 | if (_res == NULL && PyErr_Occurred()) { |
| 13164 | p->error_indicator = 1; |
| 13165 | D(p->level--); |
| 13166 | return NULL; |
| 13167 | } |
| 13168 | goto done; |
| 13169 | } |
| 13170 | p->mark = _mark; |
| 13171 | 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] | 13172 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13173 | } |
| 13174 | _res = NULL; |
| 13175 | done: |
| 13176 | D(p->level--); |
| 13177 | return _res; |
| 13178 | } |
| 13179 | |
| 13180 | // atom: |
| 13181 | // | NAME |
| 13182 | // | 'True' |
| 13183 | // | 'False' |
| 13184 | // | 'None' |
| 13185 | // | &STRING strings |
| 13186 | // | NUMBER |
| 13187 | // | &'(' (tuple | group | genexp) |
| 13188 | // | &'[' (list | listcomp) |
| 13189 | // | &'{' (dict | set | dictcomp | setcomp) |
| 13190 | // | '...' |
| 13191 | static expr_ty |
| 13192 | atom_rule(Parser *p) |
| 13193 | { |
| 13194 | D(p->level++); |
| 13195 | if (p->error_indicator) { |
| 13196 | D(p->level--); |
| 13197 | return NULL; |
| 13198 | } |
| 13199 | expr_ty _res = NULL; |
| 13200 | int _mark = p->mark; |
| 13201 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13202 | p->error_indicator = 1; |
| 13203 | D(p->level--); |
| 13204 | return NULL; |
| 13205 | } |
| 13206 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13207 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13208 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13209 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13210 | { // NAME |
| 13211 | if (p->error_indicator) { |
| 13212 | D(p->level--); |
| 13213 | return NULL; |
| 13214 | } |
| 13215 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 13216 | expr_ty name_var; |
| 13217 | if ( |
| 13218 | (name_var = _PyPegen_name_token(p)) // NAME |
| 13219 | ) |
| 13220 | { |
| 13221 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 13222 | _res = name_var; |
| 13223 | goto done; |
| 13224 | } |
| 13225 | p->mark = _mark; |
| 13226 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13227 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 13228 | } |
| 13229 | { // 'True' |
| 13230 | if (p->error_indicator) { |
| 13231 | D(p->level--); |
| 13232 | return NULL; |
| 13233 | } |
| 13234 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
| 13235 | Token * _keyword; |
| 13236 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13237 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13238 | ) |
| 13239 | { |
| 13240 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
| 13241 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13242 | if (_token == NULL) { |
| 13243 | D(p->level--); |
| 13244 | return NULL; |
| 13245 | } |
| 13246 | int _end_lineno = _token->end_lineno; |
| 13247 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13248 | int _end_col_offset = _token->end_col_offset; |
| 13249 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13250 | _res = _Py_Constant ( Py_True , NULL , EXTRA ); |
| 13251 | if (_res == NULL && PyErr_Occurred()) { |
| 13252 | p->error_indicator = 1; |
| 13253 | D(p->level--); |
| 13254 | return NULL; |
| 13255 | } |
| 13256 | goto done; |
| 13257 | } |
| 13258 | p->mark = _mark; |
| 13259 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13260 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
| 13261 | } |
| 13262 | { // 'False' |
| 13263 | if (p->error_indicator) { |
| 13264 | D(p->level--); |
| 13265 | return NULL; |
| 13266 | } |
| 13267 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
| 13268 | Token * _keyword; |
| 13269 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13270 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13271 | ) |
| 13272 | { |
| 13273 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
| 13274 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13275 | if (_token == NULL) { |
| 13276 | D(p->level--); |
| 13277 | return NULL; |
| 13278 | } |
| 13279 | int _end_lineno = _token->end_lineno; |
| 13280 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13281 | int _end_col_offset = _token->end_col_offset; |
| 13282 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13283 | _res = _Py_Constant ( Py_False , NULL , EXTRA ); |
| 13284 | if (_res == NULL && PyErr_Occurred()) { |
| 13285 | p->error_indicator = 1; |
| 13286 | D(p->level--); |
| 13287 | return NULL; |
| 13288 | } |
| 13289 | goto done; |
| 13290 | } |
| 13291 | p->mark = _mark; |
| 13292 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13293 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
| 13294 | } |
| 13295 | { // 'None' |
| 13296 | if (p->error_indicator) { |
| 13297 | D(p->level--); |
| 13298 | return NULL; |
| 13299 | } |
| 13300 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
| 13301 | Token * _keyword; |
| 13302 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13303 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13304 | ) |
| 13305 | { |
| 13306 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
| 13307 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13308 | if (_token == NULL) { |
| 13309 | D(p->level--); |
| 13310 | return NULL; |
| 13311 | } |
| 13312 | int _end_lineno = _token->end_lineno; |
| 13313 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13314 | int _end_col_offset = _token->end_col_offset; |
| 13315 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13316 | _res = _Py_Constant ( Py_None , NULL , EXTRA ); |
| 13317 | if (_res == NULL && PyErr_Occurred()) { |
| 13318 | p->error_indicator = 1; |
| 13319 | D(p->level--); |
| 13320 | return NULL; |
| 13321 | } |
| 13322 | goto done; |
| 13323 | } |
| 13324 | p->mark = _mark; |
| 13325 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13326 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
| 13327 | } |
| 13328 | { // &STRING strings |
| 13329 | if (p->error_indicator) { |
| 13330 | D(p->level--); |
| 13331 | return NULL; |
| 13332 | } |
| 13333 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings")); |
| 13334 | expr_ty strings_var; |
| 13335 | if ( |
| 13336 | _PyPegen_lookahead(1, _PyPegen_string_token, p) |
| 13337 | && |
| 13338 | (strings_var = strings_rule(p)) // strings |
| 13339 | ) |
| 13340 | { |
| 13341 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings")); |
| 13342 | _res = strings_var; |
| 13343 | goto done; |
| 13344 | } |
| 13345 | p->mark = _mark; |
| 13346 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13347 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings")); |
| 13348 | } |
| 13349 | { // NUMBER |
| 13350 | if (p->error_indicator) { |
| 13351 | D(p->level--); |
| 13352 | return NULL; |
| 13353 | } |
| 13354 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
| 13355 | expr_ty number_var; |
| 13356 | if ( |
| 13357 | (number_var = _PyPegen_number_token(p)) // NUMBER |
| 13358 | ) |
| 13359 | { |
| 13360 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
| 13361 | _res = number_var; |
| 13362 | goto done; |
| 13363 | } |
| 13364 | p->mark = _mark; |
| 13365 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13366 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
| 13367 | } |
| 13368 | { // &'(' (tuple | group | genexp) |
| 13369 | if (p->error_indicator) { |
| 13370 | D(p->level--); |
| 13371 | return NULL; |
| 13372 | } |
| 13373 | 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] | 13374 | void *_tmp_111_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13375 | if ( |
| 13376 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' |
| 13377 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13378 | (_tmp_111_var = _tmp_111_rule(p)) // tuple | group | genexp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13379 | ) |
| 13380 | { |
| 13381 | 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] | 13382 | _res = _tmp_111_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13383 | goto done; |
| 13384 | } |
| 13385 | p->mark = _mark; |
| 13386 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13387 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)")); |
| 13388 | } |
| 13389 | { // &'[' (list | listcomp) |
| 13390 | if (p->error_indicator) { |
| 13391 | D(p->level--); |
| 13392 | return NULL; |
| 13393 | } |
| 13394 | 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] | 13395 | void *_tmp_112_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13396 | if ( |
| 13397 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' |
| 13398 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13399 | (_tmp_112_var = _tmp_112_rule(p)) // list | listcomp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13400 | ) |
| 13401 | { |
| 13402 | 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] | 13403 | _res = _tmp_112_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13404 | goto done; |
| 13405 | } |
| 13406 | p->mark = _mark; |
| 13407 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13408 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)")); |
| 13409 | } |
| 13410 | { // &'{' (dict | set | dictcomp | setcomp) |
| 13411 | if (p->error_indicator) { |
| 13412 | D(p->level--); |
| 13413 | return NULL; |
| 13414 | } |
| 13415 | 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] | 13416 | void *_tmp_113_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13417 | if ( |
| 13418 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' |
| 13419 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13420 | (_tmp_113_var = _tmp_113_rule(p)) // dict | set | dictcomp | setcomp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13421 | ) |
| 13422 | { |
| 13423 | 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] | 13424 | _res = _tmp_113_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13425 | goto done; |
| 13426 | } |
| 13427 | p->mark = _mark; |
| 13428 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13429 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
| 13430 | } |
| 13431 | { // '...' |
| 13432 | if (p->error_indicator) { |
| 13433 | D(p->level--); |
| 13434 | return NULL; |
| 13435 | } |
| 13436 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
| 13437 | Token * _literal; |
| 13438 | if ( |
| 13439 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 13440 | ) |
| 13441 | { |
| 13442 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
| 13443 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13444 | if (_token == NULL) { |
| 13445 | D(p->level--); |
| 13446 | return NULL; |
| 13447 | } |
| 13448 | int _end_lineno = _token->end_lineno; |
| 13449 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13450 | int _end_col_offset = _token->end_col_offset; |
| 13451 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13452 | _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA ); |
| 13453 | if (_res == NULL && PyErr_Occurred()) { |
| 13454 | p->error_indicator = 1; |
| 13455 | D(p->level--); |
| 13456 | return NULL; |
| 13457 | } |
| 13458 | goto done; |
| 13459 | } |
| 13460 | p->mark = _mark; |
| 13461 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13462 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
| 13463 | } |
| 13464 | _res = NULL; |
| 13465 | done: |
| 13466 | D(p->level--); |
| 13467 | return _res; |
| 13468 | } |
| 13469 | |
| 13470 | // strings: STRING+ |
| 13471 | static expr_ty |
| 13472 | strings_rule(Parser *p) |
| 13473 | { |
| 13474 | D(p->level++); |
| 13475 | if (p->error_indicator) { |
| 13476 | D(p->level--); |
| 13477 | return NULL; |
| 13478 | } |
| 13479 | expr_ty _res = NULL; |
| 13480 | if (_PyPegen_is_memoized(p, strings_type, &_res)) { |
| 13481 | D(p->level--); |
| 13482 | return _res; |
| 13483 | } |
| 13484 | int _mark = p->mark; |
| 13485 | { // STRING+ |
| 13486 | if (p->error_indicator) { |
| 13487 | D(p->level--); |
| 13488 | return NULL; |
| 13489 | } |
| 13490 | D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); |
| 13491 | asdl_seq * a; |
| 13492 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13493 | (a = _loop1_114_rule(p)) // STRING+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13494 | ) |
| 13495 | { |
| 13496 | D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); |
| 13497 | _res = _PyPegen_concatenate_strings ( p , a ); |
| 13498 | if (_res == NULL && PyErr_Occurred()) { |
| 13499 | p->error_indicator = 1; |
| 13500 | D(p->level--); |
| 13501 | return NULL; |
| 13502 | } |
| 13503 | goto done; |
| 13504 | } |
| 13505 | p->mark = _mark; |
| 13506 | D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', |
| 13507 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+")); |
| 13508 | } |
| 13509 | _res = NULL; |
| 13510 | done: |
| 13511 | _PyPegen_insert_memo(p, _mark, strings_type, _res); |
| 13512 | D(p->level--); |
| 13513 | return _res; |
| 13514 | } |
| 13515 | |
| 13516 | // list: '[' star_named_expressions? ']' |
| 13517 | static expr_ty |
| 13518 | list_rule(Parser *p) |
| 13519 | { |
| 13520 | D(p->level++); |
| 13521 | if (p->error_indicator) { |
| 13522 | D(p->level--); |
| 13523 | return NULL; |
| 13524 | } |
| 13525 | expr_ty _res = NULL; |
| 13526 | int _mark = p->mark; |
| 13527 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13528 | p->error_indicator = 1; |
| 13529 | D(p->level--); |
| 13530 | return NULL; |
| 13531 | } |
| 13532 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13533 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13534 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13535 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13536 | { // '[' star_named_expressions? ']' |
| 13537 | if (p->error_indicator) { |
| 13538 | D(p->level--); |
| 13539 | return NULL; |
| 13540 | } |
| 13541 | D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); |
| 13542 | Token * _literal; |
| 13543 | Token * _literal_1; |
| 13544 | void *a; |
| 13545 | if ( |
| 13546 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 13547 | && |
| 13548 | (a = star_named_expressions_rule(p), 1) // star_named_expressions? |
| 13549 | && |
| 13550 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 13551 | ) |
| 13552 | { |
| 13553 | D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); |
| 13554 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13555 | if (_token == NULL) { |
| 13556 | D(p->level--); |
| 13557 | return NULL; |
| 13558 | } |
| 13559 | int _end_lineno = _token->end_lineno; |
| 13560 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13561 | int _end_col_offset = _token->end_col_offset; |
| 13562 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13563 | _res = _Py_List ( a , Load , EXTRA ); |
| 13564 | if (_res == NULL && PyErr_Occurred()) { |
| 13565 | p->error_indicator = 1; |
| 13566 | D(p->level--); |
| 13567 | return NULL; |
| 13568 | } |
| 13569 | goto done; |
| 13570 | } |
| 13571 | p->mark = _mark; |
| 13572 | D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ', |
| 13573 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'")); |
| 13574 | } |
| 13575 | _res = NULL; |
| 13576 | done: |
| 13577 | D(p->level--); |
| 13578 | return _res; |
| 13579 | } |
| 13580 | |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13581 | // listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13582 | static expr_ty |
| 13583 | listcomp_rule(Parser *p) |
| 13584 | { |
| 13585 | D(p->level++); |
| 13586 | if (p->error_indicator) { |
| 13587 | D(p->level--); |
| 13588 | return NULL; |
| 13589 | } |
| 13590 | expr_ty _res = NULL; |
| 13591 | int _mark = p->mark; |
| 13592 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13593 | p->error_indicator = 1; |
| 13594 | D(p->level--); |
| 13595 | return NULL; |
| 13596 | } |
| 13597 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13598 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13599 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13600 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13601 | { // '[' named_expression for_if_clauses ']' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13602 | if (p->error_indicator) { |
| 13603 | D(p->level--); |
| 13604 | return NULL; |
| 13605 | } |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13606 | 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] | 13607 | Token * _literal; |
| 13608 | Token * _literal_1; |
| 13609 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13610 | asdl_comprehension_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13611 | if ( |
| 13612 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 13613 | && |
| 13614 | (a = named_expression_rule(p)) // named_expression |
| 13615 | && |
| 13616 | (b = for_if_clauses_rule(p)) // for_if_clauses |
| 13617 | && |
| 13618 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 13619 | ) |
| 13620 | { |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13621 | 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] | 13622 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13623 | if (_token == NULL) { |
| 13624 | D(p->level--); |
| 13625 | return NULL; |
| 13626 | } |
| 13627 | int _end_lineno = _token->end_lineno; |
| 13628 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13629 | int _end_col_offset = _token->end_col_offset; |
| 13630 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13631 | _res = _Py_ListComp ( a , b , EXTRA ); |
| 13632 | if (_res == NULL && PyErr_Occurred()) { |
| 13633 | p->error_indicator = 1; |
| 13634 | D(p->level--); |
| 13635 | return NULL; |
| 13636 | } |
| 13637 | goto done; |
| 13638 | } |
| 13639 | p->mark = _mark; |
| 13640 | 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] | 13641 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13642 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 13643 | if (p->call_invalid_rules) { // invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13644 | if (p->error_indicator) { |
| 13645 | D(p->level--); |
| 13646 | return NULL; |
| 13647 | } |
| 13648 | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 13649 | void *invalid_comprehension_var; |
| 13650 | if ( |
| 13651 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
| 13652 | ) |
| 13653 | { |
| 13654 | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 13655 | _res = invalid_comprehension_var; |
| 13656 | goto done; |
| 13657 | } |
| 13658 | p->mark = _mark; |
| 13659 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 13660 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
| 13661 | } |
| 13662 | _res = NULL; |
| 13663 | done: |
| 13664 | D(p->level--); |
| 13665 | return _res; |
| 13666 | } |
| 13667 | |
| 13668 | // tuple: '(' [star_named_expression ',' star_named_expressions?] ')' |
| 13669 | static expr_ty |
| 13670 | tuple_rule(Parser *p) |
| 13671 | { |
| 13672 | D(p->level++); |
| 13673 | if (p->error_indicator) { |
| 13674 | D(p->level--); |
| 13675 | return NULL; |
| 13676 | } |
| 13677 | expr_ty _res = NULL; |
| 13678 | int _mark = p->mark; |
| 13679 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13680 | p->error_indicator = 1; |
| 13681 | D(p->level--); |
| 13682 | return NULL; |
| 13683 | } |
| 13684 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13685 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13686 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13687 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 13688 | { // '(' [star_named_expression ',' star_named_expressions?] ')' |
| 13689 | if (p->error_indicator) { |
| 13690 | D(p->level--); |
| 13691 | return NULL; |
| 13692 | } |
| 13693 | D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
| 13694 | Token * _literal; |
| 13695 | Token * _literal_1; |
| 13696 | void *a; |
| 13697 | if ( |
| 13698 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 13699 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13700 | (a = _tmp_115_rule(p), 1) // [star_named_expression ',' star_named_expressions?] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13701 | && |
| 13702 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 13703 | ) |
| 13704 | { |
| 13705 | D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
| 13706 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13707 | if (_token == NULL) { |
| 13708 | D(p->level--); |
| 13709 | return NULL; |
| 13710 | } |
| 13711 | int _end_lineno = _token->end_lineno; |
| 13712 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13713 | int _end_col_offset = _token->end_col_offset; |
| 13714 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13715 | _res = _Py_Tuple ( a , Load , EXTRA ); |
| 13716 | if (_res == NULL && PyErr_Occurred()) { |
| 13717 | p->error_indicator = 1; |
| 13718 | D(p->level--); |
| 13719 | return NULL; |
| 13720 | } |
| 13721 | goto done; |
| 13722 | } |
| 13723 | p->mark = _mark; |
| 13724 | D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ', |
| 13725 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
| 13726 | } |
| 13727 | _res = NULL; |
| 13728 | done: |
| 13729 | D(p->level--); |
| 13730 | return _res; |
| 13731 | } |
| 13732 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 13733 | // group: '(' (yield_expr | named_expression) ')' | invalid_group |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13734 | static expr_ty |
| 13735 | group_rule(Parser *p) |
| 13736 | { |
| 13737 | D(p->level++); |
| 13738 | if (p->error_indicator) { |
| 13739 | D(p->level--); |
| 13740 | return NULL; |
| 13741 | } |
| 13742 | expr_ty _res = NULL; |
| 13743 | int _mark = p->mark; |
| 13744 | { // '(' (yield_expr | named_expression) ')' |
| 13745 | if (p->error_indicator) { |
| 13746 | D(p->level--); |
| 13747 | return NULL; |
| 13748 | } |
| 13749 | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
| 13750 | Token * _literal; |
| 13751 | Token * _literal_1; |
| 13752 | void *a; |
| 13753 | if ( |
| 13754 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 13755 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 13756 | (a = _tmp_116_rule(p)) // yield_expr | named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13757 | && |
| 13758 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 13759 | ) |
| 13760 | { |
| 13761 | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
| 13762 | _res = a; |
| 13763 | if (_res == NULL && PyErr_Occurred()) { |
| 13764 | p->error_indicator = 1; |
| 13765 | D(p->level--); |
| 13766 | return NULL; |
| 13767 | } |
| 13768 | goto done; |
| 13769 | } |
| 13770 | p->mark = _mark; |
| 13771 | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', |
| 13772 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
| 13773 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 13774 | if (p->call_invalid_rules) { // invalid_group |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 13775 | if (p->error_indicator) { |
| 13776 | D(p->level--); |
| 13777 | return NULL; |
| 13778 | } |
| 13779 | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group")); |
| 13780 | void *invalid_group_var; |
| 13781 | if ( |
| 13782 | (invalid_group_var = invalid_group_rule(p)) // invalid_group |
| 13783 | ) |
| 13784 | { |
| 13785 | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group")); |
| 13786 | _res = invalid_group_var; |
| 13787 | goto done; |
| 13788 | } |
| 13789 | p->mark = _mark; |
| 13790 | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', |
| 13791 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group")); |
| 13792 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13793 | _res = NULL; |
| 13794 | done: |
| 13795 | D(p->level--); |
| 13796 | return _res; |
| 13797 | } |
| 13798 | |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13799 | // genexp: '(' named_expression for_if_clauses ')' | invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13800 | static expr_ty |
| 13801 | genexp_rule(Parser *p) |
| 13802 | { |
| 13803 | D(p->level++); |
| 13804 | if (p->error_indicator) { |
| 13805 | D(p->level--); |
| 13806 | return NULL; |
| 13807 | } |
| 13808 | expr_ty _res = NULL; |
| 13809 | int _mark = p->mark; |
| 13810 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13811 | p->error_indicator = 1; |
| 13812 | D(p->level--); |
| 13813 | return NULL; |
| 13814 | } |
| 13815 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13816 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13817 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13818 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13819 | { // '(' named_expression for_if_clauses ')' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13820 | if (p->error_indicator) { |
| 13821 | D(p->level--); |
| 13822 | return NULL; |
| 13823 | } |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13824 | 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] | 13825 | Token * _literal; |
| 13826 | Token * _literal_1; |
| 13827 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13828 | asdl_comprehension_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13829 | if ( |
| 13830 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 13831 | && |
Lysandros Nikolaou | cb3e5ed | 2020-11-17 01:08:35 +0200 | [diff] [blame] | 13832 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13833 | && |
| 13834 | (b = for_if_clauses_rule(p)) // for_if_clauses |
| 13835 | && |
| 13836 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 13837 | ) |
| 13838 | { |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13839 | 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] | 13840 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13841 | if (_token == NULL) { |
| 13842 | D(p->level--); |
| 13843 | return NULL; |
| 13844 | } |
| 13845 | int _end_lineno = _token->end_lineno; |
| 13846 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13847 | int _end_col_offset = _token->end_col_offset; |
| 13848 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13849 | _res = _Py_GeneratorExp ( a , b , EXTRA ); |
| 13850 | if (_res == NULL && PyErr_Occurred()) { |
| 13851 | p->error_indicator = 1; |
| 13852 | D(p->level--); |
| 13853 | return NULL; |
| 13854 | } |
| 13855 | goto done; |
| 13856 | } |
| 13857 | p->mark = _mark; |
| 13858 | 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] | 13859 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' named_expression for_if_clauses ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13860 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 13861 | if (p->call_invalid_rules) { // invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13862 | if (p->error_indicator) { |
| 13863 | D(p->level--); |
| 13864 | return NULL; |
| 13865 | } |
| 13866 | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 13867 | void *invalid_comprehension_var; |
| 13868 | if ( |
| 13869 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
| 13870 | ) |
| 13871 | { |
| 13872 | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 13873 | _res = invalid_comprehension_var; |
| 13874 | goto done; |
| 13875 | } |
| 13876 | p->mark = _mark; |
| 13877 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
| 13878 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
| 13879 | } |
| 13880 | _res = NULL; |
| 13881 | done: |
| 13882 | D(p->level--); |
| 13883 | return _res; |
| 13884 | } |
| 13885 | |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13886 | // set: '{' star_named_expressions '}' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13887 | static expr_ty |
| 13888 | set_rule(Parser *p) |
| 13889 | { |
| 13890 | D(p->level++); |
| 13891 | if (p->error_indicator) { |
| 13892 | D(p->level--); |
| 13893 | return NULL; |
| 13894 | } |
| 13895 | expr_ty _res = NULL; |
| 13896 | int _mark = p->mark; |
| 13897 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13898 | p->error_indicator = 1; |
| 13899 | D(p->level--); |
| 13900 | return NULL; |
| 13901 | } |
| 13902 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13903 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13904 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13905 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13906 | { // '{' star_named_expressions '}' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13907 | if (p->error_indicator) { |
| 13908 | D(p->level--); |
| 13909 | return NULL; |
| 13910 | } |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13911 | 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] | 13912 | Token * _literal; |
| 13913 | Token * _literal_1; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13914 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13915 | if ( |
| 13916 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 13917 | && |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13918 | (a = star_named_expressions_rule(p)) // star_named_expressions |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13919 | && |
| 13920 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 13921 | ) |
| 13922 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13923 | 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] | 13924 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13925 | if (_token == NULL) { |
| 13926 | D(p->level--); |
| 13927 | return NULL; |
| 13928 | } |
| 13929 | int _end_lineno = _token->end_lineno; |
| 13930 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13931 | int _end_col_offset = _token->end_col_offset; |
| 13932 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13933 | _res = _Py_Set ( a , EXTRA ); |
| 13934 | if (_res == NULL && PyErr_Occurred()) { |
| 13935 | p->error_indicator = 1; |
| 13936 | D(p->level--); |
| 13937 | return NULL; |
| 13938 | } |
| 13939 | goto done; |
| 13940 | } |
| 13941 | p->mark = _mark; |
| 13942 | 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] | 13943 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13944 | } |
| 13945 | _res = NULL; |
| 13946 | done: |
| 13947 | D(p->level--); |
| 13948 | return _res; |
| 13949 | } |
| 13950 | |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13951 | // setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13952 | static expr_ty |
| 13953 | setcomp_rule(Parser *p) |
| 13954 | { |
| 13955 | D(p->level++); |
| 13956 | if (p->error_indicator) { |
| 13957 | D(p->level--); |
| 13958 | return NULL; |
| 13959 | } |
| 13960 | expr_ty _res = NULL; |
| 13961 | int _mark = p->mark; |
| 13962 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13963 | p->error_indicator = 1; |
| 13964 | D(p->level--); |
| 13965 | return NULL; |
| 13966 | } |
| 13967 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13968 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13969 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13970 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13971 | { // '{' named_expression for_if_clauses '}' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13972 | if (p->error_indicator) { |
| 13973 | D(p->level--); |
| 13974 | return NULL; |
| 13975 | } |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13976 | 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] | 13977 | Token * _literal; |
| 13978 | Token * _literal_1; |
| 13979 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 13980 | asdl_comprehension_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13981 | if ( |
| 13982 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 13983 | && |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 13984 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 13985 | && |
| 13986 | (b = for_if_clauses_rule(p)) // for_if_clauses |
| 13987 | && |
| 13988 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 13989 | ) |
| 13990 | { |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 13991 | 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] | 13992 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13993 | if (_token == NULL) { |
| 13994 | D(p->level--); |
| 13995 | return NULL; |
| 13996 | } |
| 13997 | int _end_lineno = _token->end_lineno; |
| 13998 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13999 | int _end_col_offset = _token->end_col_offset; |
| 14000 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14001 | _res = _Py_SetComp ( a , b , EXTRA ); |
| 14002 | if (_res == NULL && PyErr_Occurred()) { |
| 14003 | p->error_indicator = 1; |
| 14004 | D(p->level--); |
| 14005 | return NULL; |
| 14006 | } |
| 14007 | goto done; |
| 14008 | } |
| 14009 | p->mark = _mark; |
| 14010 | 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] | 14011 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression for_if_clauses '}'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14012 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14013 | if (p->call_invalid_rules) { // invalid_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14014 | if (p->error_indicator) { |
| 14015 | D(p->level--); |
| 14016 | return NULL; |
| 14017 | } |
| 14018 | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 14019 | void *invalid_comprehension_var; |
| 14020 | if ( |
| 14021 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
| 14022 | ) |
| 14023 | { |
| 14024 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
| 14025 | _res = invalid_comprehension_var; |
| 14026 | goto done; |
| 14027 | } |
| 14028 | p->mark = _mark; |
| 14029 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 14030 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
| 14031 | } |
| 14032 | _res = NULL; |
| 14033 | done: |
| 14034 | D(p->level--); |
| 14035 | return _res; |
| 14036 | } |
| 14037 | |
| 14038 | // dict: '{' double_starred_kvpairs? '}' |
| 14039 | static expr_ty |
| 14040 | dict_rule(Parser *p) |
| 14041 | { |
| 14042 | D(p->level++); |
| 14043 | if (p->error_indicator) { |
| 14044 | D(p->level--); |
| 14045 | return NULL; |
| 14046 | } |
| 14047 | expr_ty _res = NULL; |
| 14048 | int _mark = p->mark; |
| 14049 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14050 | p->error_indicator = 1; |
| 14051 | D(p->level--); |
| 14052 | return NULL; |
| 14053 | } |
| 14054 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14055 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14056 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14057 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14058 | { // '{' double_starred_kvpairs? '}' |
| 14059 | if (p->error_indicator) { |
| 14060 | D(p->level--); |
| 14061 | return NULL; |
| 14062 | } |
| 14063 | D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
| 14064 | Token * _literal; |
| 14065 | Token * _literal_1; |
| 14066 | void *a; |
| 14067 | if ( |
| 14068 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 14069 | && |
| 14070 | (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs? |
| 14071 | && |
| 14072 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 14073 | ) |
| 14074 | { |
| 14075 | D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
| 14076 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14077 | if (_token == NULL) { |
| 14078 | D(p->level--); |
| 14079 | return NULL; |
| 14080 | } |
| 14081 | int _end_lineno = _token->end_lineno; |
| 14082 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14083 | int _end_col_offset = _token->end_col_offset; |
| 14084 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 14085 | _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] | 14086 | if (_res == NULL && PyErr_Occurred()) { |
| 14087 | p->error_indicator = 1; |
| 14088 | D(p->level--); |
| 14089 | return NULL; |
| 14090 | } |
| 14091 | goto done; |
| 14092 | } |
| 14093 | p->mark = _mark; |
| 14094 | D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ', |
| 14095 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
| 14096 | } |
| 14097 | _res = NULL; |
| 14098 | done: |
| 14099 | D(p->level--); |
| 14100 | return _res; |
| 14101 | } |
| 14102 | |
| 14103 | // dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension |
| 14104 | static expr_ty |
| 14105 | dictcomp_rule(Parser *p) |
| 14106 | { |
| 14107 | D(p->level++); |
| 14108 | if (p->error_indicator) { |
| 14109 | D(p->level--); |
| 14110 | return NULL; |
| 14111 | } |
| 14112 | expr_ty _res = NULL; |
| 14113 | int _mark = p->mark; |
| 14114 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14115 | p->error_indicator = 1; |
| 14116 | D(p->level--); |
| 14117 | return NULL; |
| 14118 | } |
| 14119 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14120 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14121 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14122 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14123 | { // '{' kvpair for_if_clauses '}' |
| 14124 | if (p->error_indicator) { |
| 14125 | D(p->level--); |
| 14126 | return NULL; |
| 14127 | } |
| 14128 | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
| 14129 | Token * _literal; |
| 14130 | Token * _literal_1; |
| 14131 | KeyValuePair* a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14132 | asdl_comprehension_seq* b; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14133 | if ( |
| 14134 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 14135 | && |
| 14136 | (a = kvpair_rule(p)) // kvpair |
| 14137 | && |
| 14138 | (b = for_if_clauses_rule(p)) // for_if_clauses |
| 14139 | && |
| 14140 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 14141 | ) |
| 14142 | { |
| 14143 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
| 14144 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14145 | if (_token == NULL) { |
| 14146 | D(p->level--); |
| 14147 | return NULL; |
| 14148 | } |
| 14149 | int _end_lineno = _token->end_lineno; |
| 14150 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14151 | int _end_col_offset = _token->end_col_offset; |
| 14152 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14153 | _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA ); |
| 14154 | if (_res == NULL && PyErr_Occurred()) { |
| 14155 | p->error_indicator = 1; |
| 14156 | D(p->level--); |
| 14157 | return NULL; |
| 14158 | } |
| 14159 | goto done; |
| 14160 | } |
| 14161 | p->mark = _mark; |
| 14162 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 14163 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
| 14164 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14165 | if (p->call_invalid_rules) { // invalid_dict_comprehension |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14166 | if (p->error_indicator) { |
| 14167 | D(p->level--); |
| 14168 | return NULL; |
| 14169 | } |
| 14170 | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); |
| 14171 | void *invalid_dict_comprehension_var; |
| 14172 | if ( |
| 14173 | (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension |
| 14174 | ) |
| 14175 | { |
| 14176 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); |
| 14177 | _res = invalid_dict_comprehension_var; |
| 14178 | goto done; |
| 14179 | } |
| 14180 | p->mark = _mark; |
| 14181 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 14182 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension")); |
| 14183 | } |
| 14184 | _res = NULL; |
| 14185 | done: |
| 14186 | D(p->level--); |
| 14187 | return _res; |
| 14188 | } |
| 14189 | |
| 14190 | // double_starred_kvpairs: ','.double_starred_kvpair+ ','? |
| 14191 | static asdl_seq* |
| 14192 | double_starred_kvpairs_rule(Parser *p) |
| 14193 | { |
| 14194 | D(p->level++); |
| 14195 | if (p->error_indicator) { |
| 14196 | D(p->level--); |
| 14197 | return NULL; |
| 14198 | } |
| 14199 | asdl_seq* _res = NULL; |
| 14200 | int _mark = p->mark; |
| 14201 | { // ','.double_starred_kvpair+ ','? |
| 14202 | if (p->error_indicator) { |
| 14203 | D(p->level--); |
| 14204 | return NULL; |
| 14205 | } |
| 14206 | D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
| 14207 | void *_opt_var; |
| 14208 | UNUSED(_opt_var); // Silence compiler warnings |
| 14209 | asdl_seq * a; |
| 14210 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14211 | (a = _gather_117_rule(p)) // ','.double_starred_kvpair+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14212 | && |
| 14213 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 14214 | ) |
| 14215 | { |
| 14216 | D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
| 14217 | _res = a; |
| 14218 | if (_res == NULL && PyErr_Occurred()) { |
| 14219 | p->error_indicator = 1; |
| 14220 | D(p->level--); |
| 14221 | return NULL; |
| 14222 | } |
| 14223 | goto done; |
| 14224 | } |
| 14225 | p->mark = _mark; |
| 14226 | D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', |
| 14227 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
| 14228 | } |
| 14229 | _res = NULL; |
| 14230 | done: |
| 14231 | D(p->level--); |
| 14232 | return _res; |
| 14233 | } |
| 14234 | |
| 14235 | // double_starred_kvpair: '**' bitwise_or | kvpair |
| 14236 | static KeyValuePair* |
| 14237 | double_starred_kvpair_rule(Parser *p) |
| 14238 | { |
| 14239 | D(p->level++); |
| 14240 | if (p->error_indicator) { |
| 14241 | D(p->level--); |
| 14242 | return NULL; |
| 14243 | } |
| 14244 | KeyValuePair* _res = NULL; |
| 14245 | int _mark = p->mark; |
| 14246 | { // '**' bitwise_or |
| 14247 | if (p->error_indicator) { |
| 14248 | D(p->level--); |
| 14249 | return NULL; |
| 14250 | } |
| 14251 | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); |
| 14252 | Token * _literal; |
| 14253 | expr_ty a; |
| 14254 | if ( |
| 14255 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 14256 | && |
| 14257 | (a = bitwise_or_rule(p)) // bitwise_or |
| 14258 | ) |
| 14259 | { |
| 14260 | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); |
| 14261 | _res = _PyPegen_key_value_pair ( p , NULL , a ); |
| 14262 | if (_res == NULL && PyErr_Occurred()) { |
| 14263 | p->error_indicator = 1; |
| 14264 | D(p->level--); |
| 14265 | return NULL; |
| 14266 | } |
| 14267 | goto done; |
| 14268 | } |
| 14269 | p->mark = _mark; |
| 14270 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 14271 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or")); |
| 14272 | } |
| 14273 | { // kvpair |
| 14274 | if (p->error_indicator) { |
| 14275 | D(p->level--); |
| 14276 | return NULL; |
| 14277 | } |
| 14278 | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair")); |
| 14279 | KeyValuePair* kvpair_var; |
| 14280 | if ( |
| 14281 | (kvpair_var = kvpair_rule(p)) // kvpair |
| 14282 | ) |
| 14283 | { |
| 14284 | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair")); |
| 14285 | _res = kvpair_var; |
| 14286 | goto done; |
| 14287 | } |
| 14288 | p->mark = _mark; |
| 14289 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 14290 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair")); |
| 14291 | } |
| 14292 | _res = NULL; |
| 14293 | done: |
| 14294 | D(p->level--); |
| 14295 | return _res; |
| 14296 | } |
| 14297 | |
| 14298 | // kvpair: expression ':' expression |
| 14299 | static KeyValuePair* |
| 14300 | kvpair_rule(Parser *p) |
| 14301 | { |
| 14302 | D(p->level++); |
| 14303 | if (p->error_indicator) { |
| 14304 | D(p->level--); |
| 14305 | return NULL; |
| 14306 | } |
| 14307 | KeyValuePair* _res = NULL; |
| 14308 | int _mark = p->mark; |
| 14309 | { // expression ':' expression |
| 14310 | if (p->error_indicator) { |
| 14311 | D(p->level--); |
| 14312 | return NULL; |
| 14313 | } |
| 14314 | D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
| 14315 | Token * _literal; |
| 14316 | expr_ty a; |
| 14317 | expr_ty b; |
| 14318 | if ( |
| 14319 | (a = expression_rule(p)) // expression |
| 14320 | && |
| 14321 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 14322 | && |
| 14323 | (b = expression_rule(p)) // expression |
| 14324 | ) |
| 14325 | { |
| 14326 | D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
| 14327 | _res = _PyPegen_key_value_pair ( p , a , b ); |
| 14328 | if (_res == NULL && PyErr_Occurred()) { |
| 14329 | p->error_indicator = 1; |
| 14330 | D(p->level--); |
| 14331 | return NULL; |
| 14332 | } |
| 14333 | goto done; |
| 14334 | } |
| 14335 | p->mark = _mark; |
| 14336 | D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 14337 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); |
| 14338 | } |
| 14339 | _res = NULL; |
| 14340 | done: |
| 14341 | D(p->level--); |
| 14342 | return _res; |
| 14343 | } |
| 14344 | |
| 14345 | // for_if_clauses: for_if_clause+ |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14346 | static asdl_comprehension_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14347 | for_if_clauses_rule(Parser *p) |
| 14348 | { |
| 14349 | D(p->level++); |
| 14350 | if (p->error_indicator) { |
| 14351 | D(p->level--); |
| 14352 | return NULL; |
| 14353 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14354 | asdl_comprehension_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14355 | int _mark = p->mark; |
| 14356 | { // for_if_clause+ |
| 14357 | if (p->error_indicator) { |
| 14358 | D(p->level--); |
| 14359 | return NULL; |
| 14360 | } |
| 14361 | 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] | 14362 | asdl_comprehension_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14363 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14364 | (a = (asdl_comprehension_seq*)_loop1_119_rule(p)) // for_if_clause+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14365 | ) |
| 14366 | { |
| 14367 | 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] | 14368 | _res = a; |
| 14369 | if (_res == NULL && PyErr_Occurred()) { |
| 14370 | p->error_indicator = 1; |
| 14371 | D(p->level--); |
| 14372 | return NULL; |
| 14373 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14374 | goto done; |
| 14375 | } |
| 14376 | p->mark = _mark; |
| 14377 | D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ', |
| 14378 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+")); |
| 14379 | } |
| 14380 | _res = NULL; |
| 14381 | done: |
| 14382 | D(p->level--); |
| 14383 | return _res; |
| 14384 | } |
| 14385 | |
| 14386 | // for_if_clause: |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14387 | // | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
| 14388 | // | 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
| 14389 | // | invalid_for_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14390 | static comprehension_ty |
| 14391 | for_if_clause_rule(Parser *p) |
| 14392 | { |
| 14393 | D(p->level++); |
| 14394 | if (p->error_indicator) { |
| 14395 | D(p->level--); |
| 14396 | return NULL; |
| 14397 | } |
| 14398 | comprehension_ty _res = NULL; |
| 14399 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14400 | { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14401 | if (p->error_indicator) { |
| 14402 | D(p->level--); |
| 14403 | return NULL; |
| 14404 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14405 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
| 14406 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14407 | Token * _keyword; |
| 14408 | Token * _keyword_1; |
| 14409 | expr_ty a; |
| 14410 | Token * async_var; |
| 14411 | expr_ty b; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14412 | asdl_expr_seq* c; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14413 | if ( |
| 14414 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 14415 | && |
| 14416 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 14417 | && |
| 14418 | (a = star_targets_rule(p)) // star_targets |
| 14419 | && |
| 14420 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 14421 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14422 | (_cut_var = 1) |
| 14423 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14424 | (b = disjunction_rule(p)) // disjunction |
| 14425 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14426 | (c = (asdl_expr_seq*)_loop0_120_rule(p)) // (('if' disjunction))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14427 | ) |
| 14428 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14429 | 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] | 14430 | _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] | 14431 | if (_res == NULL && PyErr_Occurred()) { |
| 14432 | p->error_indicator = 1; |
| 14433 | D(p->level--); |
| 14434 | return NULL; |
| 14435 | } |
| 14436 | goto done; |
| 14437 | } |
| 14438 | p->mark = _mark; |
| 14439 | 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] | 14440 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
| 14441 | if (_cut_var) { |
| 14442 | D(p->level--); |
| 14443 | return NULL; |
| 14444 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14445 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14446 | { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14447 | if (p->error_indicator) { |
| 14448 | D(p->level--); |
| 14449 | return NULL; |
| 14450 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14451 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
| 14452 | int _cut_var = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14453 | Token * _keyword; |
| 14454 | Token * _keyword_1; |
| 14455 | expr_ty a; |
| 14456 | expr_ty b; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 14457 | asdl_expr_seq* c; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14458 | if ( |
| 14459 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 14460 | && |
| 14461 | (a = star_targets_rule(p)) // star_targets |
| 14462 | && |
| 14463 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
| 14464 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14465 | (_cut_var = 1) |
| 14466 | && |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14467 | (b = disjunction_rule(p)) // disjunction |
| 14468 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14469 | (c = (asdl_expr_seq*)_loop0_121_rule(p)) // (('if' disjunction))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14470 | ) |
| 14471 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14472 | 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] | 14473 | _res = _Py_comprehension ( a , b , c , 0 , p -> arena ); |
| 14474 | if (_res == NULL && PyErr_Occurred()) { |
| 14475 | p->error_indicator = 1; |
| 14476 | D(p->level--); |
| 14477 | return NULL; |
| 14478 | } |
| 14479 | goto done; |
| 14480 | } |
| 14481 | p->mark = _mark; |
| 14482 | 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] | 14483 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
| 14484 | if (_cut_var) { |
| 14485 | D(p->level--); |
| 14486 | return NULL; |
| 14487 | } |
| 14488 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14489 | if (p->call_invalid_rules) { // invalid_for_target |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 14490 | if (p->error_indicator) { |
| 14491 | D(p->level--); |
| 14492 | return NULL; |
| 14493 | } |
| 14494 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
| 14495 | void *invalid_for_target_var; |
| 14496 | if ( |
| 14497 | (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target |
| 14498 | ) |
| 14499 | { |
| 14500 | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
| 14501 | _res = invalid_for_target_var; |
| 14502 | goto done; |
| 14503 | } |
| 14504 | p->mark = _mark; |
| 14505 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
| 14506 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14507 | } |
| 14508 | _res = NULL; |
| 14509 | done: |
| 14510 | D(p->level--); |
| 14511 | return _res; |
| 14512 | } |
| 14513 | |
| 14514 | // yield_expr: 'yield' 'from' expression | 'yield' star_expressions? |
| 14515 | static expr_ty |
| 14516 | yield_expr_rule(Parser *p) |
| 14517 | { |
| 14518 | D(p->level++); |
| 14519 | if (p->error_indicator) { |
| 14520 | D(p->level--); |
| 14521 | return NULL; |
| 14522 | } |
| 14523 | expr_ty _res = NULL; |
| 14524 | int _mark = p->mark; |
| 14525 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14526 | p->error_indicator = 1; |
| 14527 | D(p->level--); |
| 14528 | return NULL; |
| 14529 | } |
| 14530 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14531 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14532 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14533 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14534 | { // 'yield' 'from' expression |
| 14535 | if (p->error_indicator) { |
| 14536 | D(p->level--); |
| 14537 | return NULL; |
| 14538 | } |
| 14539 | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); |
| 14540 | Token * _keyword; |
| 14541 | Token * _keyword_1; |
| 14542 | expr_ty a; |
| 14543 | if ( |
| 14544 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
| 14545 | && |
| 14546 | (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from' |
| 14547 | && |
| 14548 | (a = expression_rule(p)) // expression |
| 14549 | ) |
| 14550 | { |
| 14551 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); |
| 14552 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14553 | if (_token == NULL) { |
| 14554 | D(p->level--); |
| 14555 | return NULL; |
| 14556 | } |
| 14557 | int _end_lineno = _token->end_lineno; |
| 14558 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14559 | int _end_col_offset = _token->end_col_offset; |
| 14560 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14561 | _res = _Py_YieldFrom ( a , EXTRA ); |
| 14562 | if (_res == NULL && PyErr_Occurred()) { |
| 14563 | p->error_indicator = 1; |
| 14564 | D(p->level--); |
| 14565 | return NULL; |
| 14566 | } |
| 14567 | goto done; |
| 14568 | } |
| 14569 | p->mark = _mark; |
| 14570 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 14571 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression")); |
| 14572 | } |
| 14573 | { // 'yield' star_expressions? |
| 14574 | if (p->error_indicator) { |
| 14575 | D(p->level--); |
| 14576 | return NULL; |
| 14577 | } |
| 14578 | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); |
| 14579 | Token * _keyword; |
| 14580 | void *a; |
| 14581 | if ( |
| 14582 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
| 14583 | && |
| 14584 | (a = star_expressions_rule(p), 1) // star_expressions? |
| 14585 | ) |
| 14586 | { |
| 14587 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); |
| 14588 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14589 | if (_token == NULL) { |
| 14590 | D(p->level--); |
| 14591 | return NULL; |
| 14592 | } |
| 14593 | int _end_lineno = _token->end_lineno; |
| 14594 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14595 | int _end_col_offset = _token->end_col_offset; |
| 14596 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14597 | _res = _Py_Yield ( a , EXTRA ); |
| 14598 | if (_res == NULL && PyErr_Occurred()) { |
| 14599 | p->error_indicator = 1; |
| 14600 | D(p->level--); |
| 14601 | return NULL; |
| 14602 | } |
| 14603 | goto done; |
| 14604 | } |
| 14605 | p->mark = _mark; |
| 14606 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 14607 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?")); |
| 14608 | } |
| 14609 | _res = NULL; |
| 14610 | done: |
| 14611 | D(p->level--); |
| 14612 | return _res; |
| 14613 | } |
| 14614 | |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14615 | // arguments: args ','? &')' | invalid_arguments |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14616 | static expr_ty |
| 14617 | arguments_rule(Parser *p) |
| 14618 | { |
| 14619 | D(p->level++); |
| 14620 | if (p->error_indicator) { |
| 14621 | D(p->level--); |
| 14622 | return NULL; |
| 14623 | } |
| 14624 | expr_ty _res = NULL; |
| 14625 | if (_PyPegen_is_memoized(p, arguments_type, &_res)) { |
| 14626 | D(p->level--); |
| 14627 | return _res; |
| 14628 | } |
| 14629 | int _mark = p->mark; |
| 14630 | { // args ','? &')' |
| 14631 | if (p->error_indicator) { |
| 14632 | D(p->level--); |
| 14633 | return NULL; |
| 14634 | } |
| 14635 | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); |
| 14636 | void *_opt_var; |
| 14637 | UNUSED(_opt_var); // Silence compiler warnings |
| 14638 | expr_ty a; |
| 14639 | if ( |
| 14640 | (a = args_rule(p)) // args |
| 14641 | && |
| 14642 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 14643 | && |
| 14644 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
| 14645 | ) |
| 14646 | { |
| 14647 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); |
| 14648 | _res = a; |
| 14649 | if (_res == NULL && PyErr_Occurred()) { |
| 14650 | p->error_indicator = 1; |
| 14651 | D(p->level--); |
| 14652 | return NULL; |
| 14653 | } |
| 14654 | goto done; |
| 14655 | } |
| 14656 | p->mark = _mark; |
| 14657 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14658 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'")); |
| 14659 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14660 | if (p->call_invalid_rules) { // invalid_arguments |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14661 | if (p->error_indicator) { |
| 14662 | D(p->level--); |
| 14663 | return NULL; |
| 14664 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14665 | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments")); |
| 14666 | void *invalid_arguments_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14667 | if ( |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14668 | (invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14669 | ) |
| 14670 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 14671 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments")); |
| 14672 | _res = invalid_arguments_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14673 | goto done; |
| 14674 | } |
| 14675 | p->mark = _mark; |
| 14676 | 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] | 14677 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14678 | } |
| 14679 | _res = NULL; |
| 14680 | done: |
| 14681 | _PyPegen_insert_memo(p, _mark, arguments_type, _res); |
| 14682 | D(p->level--); |
| 14683 | return _res; |
| 14684 | } |
| 14685 | |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14686 | // args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14687 | static expr_ty |
| 14688 | args_rule(Parser *p) |
| 14689 | { |
| 14690 | D(p->level++); |
| 14691 | if (p->error_indicator) { |
| 14692 | D(p->level--); |
| 14693 | return NULL; |
| 14694 | } |
| 14695 | expr_ty _res = NULL; |
| 14696 | int _mark = p->mark; |
| 14697 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14698 | p->error_indicator = 1; |
| 14699 | D(p->level--); |
| 14700 | return NULL; |
| 14701 | } |
| 14702 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14703 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14704 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14705 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14706 | { // ','.(starred_expression | named_expression !'=')+ [',' kwargs] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14707 | if (p->error_indicator) { |
| 14708 | D(p->level--); |
| 14709 | return NULL; |
| 14710 | } |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14711 | 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] | 14712 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14713 | void *b; |
| 14714 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14715 | (a = (asdl_expr_seq*)_gather_122_rule(p)) // ','.(starred_expression | named_expression !'=')+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14716 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14717 | (b = _tmp_124_rule(p), 1) // [',' kwargs] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14718 | ) |
| 14719 | { |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 14720 | 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] | 14721 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14722 | if (_token == NULL) { |
| 14723 | D(p->level--); |
| 14724 | return NULL; |
| 14725 | } |
| 14726 | int _end_lineno = _token->end_lineno; |
| 14727 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14728 | int _end_col_offset = _token->end_col_offset; |
| 14729 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14730 | _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14731 | if (_res == NULL && PyErr_Occurred()) { |
| 14732 | p->error_indicator = 1; |
| 14733 | D(p->level--); |
| 14734 | return NULL; |
| 14735 | } |
| 14736 | goto done; |
| 14737 | } |
| 14738 | p->mark = _mark; |
| 14739 | 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] | 14740 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14741 | } |
| 14742 | { // kwargs |
| 14743 | if (p->error_indicator) { |
| 14744 | D(p->level--); |
| 14745 | return NULL; |
| 14746 | } |
| 14747 | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs")); |
| 14748 | asdl_seq* a; |
| 14749 | if ( |
| 14750 | (a = kwargs_rule(p)) // kwargs |
| 14751 | ) |
| 14752 | { |
| 14753 | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs")); |
| 14754 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14755 | if (_token == NULL) { |
| 14756 | D(p->level--); |
| 14757 | return NULL; |
| 14758 | } |
| 14759 | int _end_lineno = _token->end_lineno; |
| 14760 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14761 | int _end_col_offset = _token->end_col_offset; |
| 14762 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 14763 | _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] | 14764 | if (_res == NULL && PyErr_Occurred()) { |
| 14765 | p->error_indicator = 1; |
| 14766 | D(p->level--); |
| 14767 | return NULL; |
| 14768 | } |
| 14769 | goto done; |
| 14770 | } |
| 14771 | p->mark = _mark; |
| 14772 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
| 14773 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs")); |
| 14774 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14775 | _res = NULL; |
| 14776 | done: |
| 14777 | D(p->level--); |
| 14778 | return _res; |
| 14779 | } |
| 14780 | |
| 14781 | // kwargs: |
| 14782 | // | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
| 14783 | // | ','.kwarg_or_starred+ |
| 14784 | // | ','.kwarg_or_double_starred+ |
| 14785 | static asdl_seq* |
| 14786 | kwargs_rule(Parser *p) |
| 14787 | { |
| 14788 | D(p->level++); |
| 14789 | if (p->error_indicator) { |
| 14790 | D(p->level--); |
| 14791 | return NULL; |
| 14792 | } |
| 14793 | asdl_seq* _res = NULL; |
| 14794 | int _mark = p->mark; |
| 14795 | { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
| 14796 | if (p->error_indicator) { |
| 14797 | D(p->level--); |
| 14798 | return NULL; |
| 14799 | } |
| 14800 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
| 14801 | Token * _literal; |
| 14802 | asdl_seq * a; |
| 14803 | asdl_seq * b; |
| 14804 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14805 | (a = _gather_125_rule(p)) // ','.kwarg_or_starred+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14806 | && |
| 14807 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 14808 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14809 | (b = _gather_127_rule(p)) // ','.kwarg_or_double_starred+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14810 | ) |
| 14811 | { |
| 14812 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
| 14813 | _res = _PyPegen_join_sequences ( p , a , b ); |
| 14814 | if (_res == NULL && PyErr_Occurred()) { |
| 14815 | p->error_indicator = 1; |
| 14816 | D(p->level--); |
| 14817 | return NULL; |
| 14818 | } |
| 14819 | goto done; |
| 14820 | } |
| 14821 | p->mark = _mark; |
| 14822 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 14823 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
| 14824 | } |
| 14825 | { // ','.kwarg_or_starred+ |
| 14826 | if (p->error_indicator) { |
| 14827 | D(p->level--); |
| 14828 | return NULL; |
| 14829 | } |
| 14830 | 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] | 14831 | asdl_seq * _gather_129_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14832 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14833 | (_gather_129_var = _gather_129_rule(p)) // ','.kwarg_or_starred+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14834 | ) |
| 14835 | { |
| 14836 | 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] | 14837 | _res = _gather_129_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14838 | goto done; |
| 14839 | } |
| 14840 | p->mark = _mark; |
| 14841 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 14842 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+")); |
| 14843 | } |
| 14844 | { // ','.kwarg_or_double_starred+ |
| 14845 | if (p->error_indicator) { |
| 14846 | D(p->level--); |
| 14847 | return NULL; |
| 14848 | } |
| 14849 | 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] | 14850 | asdl_seq * _gather_131_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14851 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 14852 | (_gather_131_var = _gather_131_rule(p)) // ','.kwarg_or_double_starred+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14853 | ) |
| 14854 | { |
| 14855 | 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] | 14856 | _res = _gather_131_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 14857 | goto done; |
| 14858 | } |
| 14859 | p->mark = _mark; |
| 14860 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 14861 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+")); |
| 14862 | } |
| 14863 | _res = NULL; |
| 14864 | done: |
| 14865 | D(p->level--); |
| 14866 | return _res; |
| 14867 | } |
| 14868 | |
| 14869 | // starred_expression: '*' expression |
| 14870 | static expr_ty |
| 14871 | starred_expression_rule(Parser *p) |
| 14872 | { |
| 14873 | D(p->level++); |
| 14874 | if (p->error_indicator) { |
| 14875 | D(p->level--); |
| 14876 | return NULL; |
| 14877 | } |
| 14878 | expr_ty _res = NULL; |
| 14879 | int _mark = p->mark; |
| 14880 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14881 | p->error_indicator = 1; |
| 14882 | D(p->level--); |
| 14883 | return NULL; |
| 14884 | } |
| 14885 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14886 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14887 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14888 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14889 | { // '*' expression |
| 14890 | if (p->error_indicator) { |
| 14891 | D(p->level--); |
| 14892 | return NULL; |
| 14893 | } |
| 14894 | D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
| 14895 | Token * _literal; |
| 14896 | expr_ty a; |
| 14897 | if ( |
| 14898 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 14899 | && |
| 14900 | (a = expression_rule(p)) // expression |
| 14901 | ) |
| 14902 | { |
| 14903 | D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
| 14904 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14905 | if (_token == NULL) { |
| 14906 | D(p->level--); |
| 14907 | return NULL; |
| 14908 | } |
| 14909 | int _end_lineno = _token->end_lineno; |
| 14910 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14911 | int _end_col_offset = _token->end_col_offset; |
| 14912 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14913 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 14914 | if (_res == NULL && PyErr_Occurred()) { |
| 14915 | p->error_indicator = 1; |
| 14916 | D(p->level--); |
| 14917 | return NULL; |
| 14918 | } |
| 14919 | goto done; |
| 14920 | } |
| 14921 | p->mark = _mark; |
| 14922 | D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 14923 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
| 14924 | } |
| 14925 | _res = NULL; |
| 14926 | done: |
| 14927 | D(p->level--); |
| 14928 | return _res; |
| 14929 | } |
| 14930 | |
| 14931 | // kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg |
| 14932 | static KeywordOrStarred* |
| 14933 | kwarg_or_starred_rule(Parser *p) |
| 14934 | { |
| 14935 | D(p->level++); |
| 14936 | if (p->error_indicator) { |
| 14937 | D(p->level--); |
| 14938 | return NULL; |
| 14939 | } |
| 14940 | KeywordOrStarred* _res = NULL; |
| 14941 | int _mark = p->mark; |
| 14942 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14943 | p->error_indicator = 1; |
| 14944 | D(p->level--); |
| 14945 | return NULL; |
| 14946 | } |
| 14947 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14948 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14949 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14950 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 14951 | { // NAME '=' expression |
| 14952 | if (p->error_indicator) { |
| 14953 | D(p->level--); |
| 14954 | return NULL; |
| 14955 | } |
| 14956 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
| 14957 | Token * _literal; |
| 14958 | expr_ty a; |
| 14959 | expr_ty b; |
| 14960 | if ( |
| 14961 | (a = _PyPegen_name_token(p)) // NAME |
| 14962 | && |
| 14963 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 14964 | && |
| 14965 | (b = expression_rule(p)) // expression |
| 14966 | ) |
| 14967 | { |
| 14968 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
| 14969 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14970 | if (_token == NULL) { |
| 14971 | D(p->level--); |
| 14972 | return NULL; |
| 14973 | } |
| 14974 | int _end_lineno = _token->end_lineno; |
| 14975 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14976 | int _end_col_offset = _token->end_col_offset; |
| 14977 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 14978 | _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] | 14979 | if (_res == NULL && PyErr_Occurred()) { |
| 14980 | p->error_indicator = 1; |
| 14981 | D(p->level--); |
| 14982 | return NULL; |
| 14983 | } |
| 14984 | goto done; |
| 14985 | } |
| 14986 | p->mark = _mark; |
| 14987 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 14988 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
| 14989 | } |
| 14990 | { // starred_expression |
| 14991 | if (p->error_indicator) { |
| 14992 | D(p->level--); |
| 14993 | return NULL; |
| 14994 | } |
| 14995 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
| 14996 | expr_ty a; |
| 14997 | if ( |
| 14998 | (a = starred_expression_rule(p)) // starred_expression |
| 14999 | ) |
| 15000 | { |
| 15001 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
| 15002 | _res = _PyPegen_keyword_or_starred ( p , a , 0 ); |
| 15003 | if (_res == NULL && PyErr_Occurred()) { |
| 15004 | p->error_indicator = 1; |
| 15005 | D(p->level--); |
| 15006 | return NULL; |
| 15007 | } |
| 15008 | goto done; |
| 15009 | } |
| 15010 | p->mark = _mark; |
| 15011 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15012 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
| 15013 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 15014 | if (p->call_invalid_rules) { // invalid_kwarg |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15015 | if (p->error_indicator) { |
| 15016 | D(p->level--); |
| 15017 | return NULL; |
| 15018 | } |
| 15019 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
| 15020 | void *invalid_kwarg_var; |
| 15021 | if ( |
| 15022 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
| 15023 | ) |
| 15024 | { |
| 15025 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
| 15026 | _res = invalid_kwarg_var; |
| 15027 | goto done; |
| 15028 | } |
| 15029 | p->mark = _mark; |
| 15030 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15031 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
| 15032 | } |
| 15033 | _res = NULL; |
| 15034 | done: |
| 15035 | D(p->level--); |
| 15036 | return _res; |
| 15037 | } |
| 15038 | |
| 15039 | // kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg |
| 15040 | static KeywordOrStarred* |
| 15041 | kwarg_or_double_starred_rule(Parser *p) |
| 15042 | { |
| 15043 | D(p->level++); |
| 15044 | if (p->error_indicator) { |
| 15045 | D(p->level--); |
| 15046 | return NULL; |
| 15047 | } |
| 15048 | KeywordOrStarred* _res = NULL; |
| 15049 | int _mark = p->mark; |
| 15050 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15051 | p->error_indicator = 1; |
| 15052 | D(p->level--); |
| 15053 | return NULL; |
| 15054 | } |
| 15055 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15056 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15057 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15058 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15059 | { // NAME '=' expression |
| 15060 | if (p->error_indicator) { |
| 15061 | D(p->level--); |
| 15062 | return NULL; |
| 15063 | } |
| 15064 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
| 15065 | Token * _literal; |
| 15066 | expr_ty a; |
| 15067 | expr_ty b; |
| 15068 | if ( |
| 15069 | (a = _PyPegen_name_token(p)) // NAME |
| 15070 | && |
| 15071 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 15072 | && |
| 15073 | (b = expression_rule(p)) // expression |
| 15074 | ) |
| 15075 | { |
| 15076 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
| 15077 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15078 | if (_token == NULL) { |
| 15079 | D(p->level--); |
| 15080 | return NULL; |
| 15081 | } |
| 15082 | int _end_lineno = _token->end_lineno; |
| 15083 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15084 | int _end_col_offset = _token->end_col_offset; |
| 15085 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 15086 | _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] | 15087 | if (_res == NULL && PyErr_Occurred()) { |
| 15088 | p->error_indicator = 1; |
| 15089 | D(p->level--); |
| 15090 | return NULL; |
| 15091 | } |
| 15092 | goto done; |
| 15093 | } |
| 15094 | p->mark = _mark; |
| 15095 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15096 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
| 15097 | } |
| 15098 | { // '**' expression |
| 15099 | if (p->error_indicator) { |
| 15100 | D(p->level--); |
| 15101 | return NULL; |
| 15102 | } |
| 15103 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
| 15104 | Token * _literal; |
| 15105 | expr_ty a; |
| 15106 | if ( |
| 15107 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 15108 | && |
| 15109 | (a = expression_rule(p)) // expression |
| 15110 | ) |
| 15111 | { |
| 15112 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
| 15113 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15114 | if (_token == NULL) { |
| 15115 | D(p->level--); |
| 15116 | return NULL; |
| 15117 | } |
| 15118 | int _end_lineno = _token->end_lineno; |
| 15119 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15120 | int _end_col_offset = _token->end_col_offset; |
| 15121 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 15122 | _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] | 15123 | if (_res == NULL && PyErr_Occurred()) { |
| 15124 | p->error_indicator = 1; |
| 15125 | D(p->level--); |
| 15126 | return NULL; |
| 15127 | } |
| 15128 | goto done; |
| 15129 | } |
| 15130 | p->mark = _mark; |
| 15131 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15132 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
| 15133 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 15134 | if (p->call_invalid_rules) { // invalid_kwarg |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15135 | if (p->error_indicator) { |
| 15136 | D(p->level--); |
| 15137 | return NULL; |
| 15138 | } |
| 15139 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
| 15140 | void *invalid_kwarg_var; |
| 15141 | if ( |
| 15142 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
| 15143 | ) |
| 15144 | { |
| 15145 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
| 15146 | _res = invalid_kwarg_var; |
| 15147 | goto done; |
| 15148 | } |
| 15149 | p->mark = _mark; |
| 15150 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 15151 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
| 15152 | } |
| 15153 | _res = NULL; |
| 15154 | done: |
| 15155 | D(p->level--); |
| 15156 | return _res; |
| 15157 | } |
| 15158 | |
| 15159 | // star_targets: star_target !',' | star_target ((',' star_target))* ','? |
| 15160 | static expr_ty |
| 15161 | star_targets_rule(Parser *p) |
| 15162 | { |
| 15163 | D(p->level++); |
| 15164 | if (p->error_indicator) { |
| 15165 | D(p->level--); |
| 15166 | return NULL; |
| 15167 | } |
| 15168 | expr_ty _res = NULL; |
| 15169 | int _mark = p->mark; |
| 15170 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15171 | p->error_indicator = 1; |
| 15172 | D(p->level--); |
| 15173 | return NULL; |
| 15174 | } |
| 15175 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15176 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15177 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15178 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15179 | { // star_target !',' |
| 15180 | if (p->error_indicator) { |
| 15181 | D(p->level--); |
| 15182 | return NULL; |
| 15183 | } |
| 15184 | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','")); |
| 15185 | expr_ty a; |
| 15186 | if ( |
| 15187 | (a = star_target_rule(p)) // star_target |
| 15188 | && |
| 15189 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
| 15190 | ) |
| 15191 | { |
| 15192 | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','")); |
| 15193 | _res = a; |
| 15194 | if (_res == NULL && PyErr_Occurred()) { |
| 15195 | p->error_indicator = 1; |
| 15196 | D(p->level--); |
| 15197 | return NULL; |
| 15198 | } |
| 15199 | goto done; |
| 15200 | } |
| 15201 | p->mark = _mark; |
| 15202 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 15203 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','")); |
| 15204 | } |
| 15205 | { // star_target ((',' star_target))* ','? |
| 15206 | if (p->error_indicator) { |
| 15207 | D(p->level--); |
| 15208 | return NULL; |
| 15209 | } |
| 15210 | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); |
| 15211 | void *_opt_var; |
| 15212 | UNUSED(_opt_var); // Silence compiler warnings |
| 15213 | expr_ty a; |
| 15214 | asdl_seq * b; |
| 15215 | if ( |
| 15216 | (a = star_target_rule(p)) // star_target |
| 15217 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15218 | (b = _loop0_133_rule(p)) // ((',' star_target))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15219 | && |
| 15220 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 15221 | ) |
| 15222 | { |
| 15223 | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); |
| 15224 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15225 | if (_token == NULL) { |
| 15226 | D(p->level--); |
| 15227 | return NULL; |
| 15228 | } |
| 15229 | int _end_lineno = _token->end_lineno; |
| 15230 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15231 | int _end_col_offset = _token->end_col_offset; |
| 15232 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 15233 | _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] | 15234 | if (_res == NULL && PyErr_Occurred()) { |
| 15235 | p->error_indicator = 1; |
| 15236 | D(p->level--); |
| 15237 | return NULL; |
| 15238 | } |
| 15239 | goto done; |
| 15240 | } |
| 15241 | p->mark = _mark; |
| 15242 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 15243 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?")); |
| 15244 | } |
| 15245 | _res = NULL; |
| 15246 | done: |
| 15247 | D(p->level--); |
| 15248 | return _res; |
| 15249 | } |
| 15250 | |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15251 | // star_targets_list_seq: ','.star_target+ ','? |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15252 | static asdl_expr_seq* |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15253 | star_targets_list_seq_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15254 | { |
| 15255 | D(p->level++); |
| 15256 | if (p->error_indicator) { |
| 15257 | D(p->level--); |
| 15258 | return NULL; |
| 15259 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15260 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15261 | int _mark = p->mark; |
| 15262 | { // ','.star_target+ ','? |
| 15263 | if (p->error_indicator) { |
| 15264 | D(p->level--); |
| 15265 | return NULL; |
| 15266 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15267 | 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] | 15268 | void *_opt_var; |
| 15269 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15270 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15271 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15272 | (a = (asdl_expr_seq*)_gather_134_rule(p)) // ','.star_target+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15273 | && |
| 15274 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 15275 | ) |
| 15276 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15277 | 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] | 15278 | _res = a; |
| 15279 | if (_res == NULL && PyErr_Occurred()) { |
| 15280 | p->error_indicator = 1; |
| 15281 | D(p->level--); |
| 15282 | return NULL; |
| 15283 | } |
| 15284 | goto done; |
| 15285 | } |
| 15286 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15287 | 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] | 15288 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?")); |
| 15289 | } |
| 15290 | _res = NULL; |
| 15291 | done: |
| 15292 | D(p->level--); |
| 15293 | return _res; |
| 15294 | } |
| 15295 | |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15296 | // star_targets_tuple_seq: star_target ((',' star_target))+ ','? | star_target ',' |
| 15297 | static asdl_expr_seq* |
| 15298 | star_targets_tuple_seq_rule(Parser *p) |
| 15299 | { |
| 15300 | D(p->level++); |
| 15301 | if (p->error_indicator) { |
| 15302 | D(p->level--); |
| 15303 | return NULL; |
| 15304 | } |
| 15305 | asdl_expr_seq* _res = NULL; |
| 15306 | int _mark = p->mark; |
| 15307 | { // star_target ((',' star_target))+ ','? |
| 15308 | if (p->error_indicator) { |
| 15309 | D(p->level--); |
| 15310 | return NULL; |
| 15311 | } |
| 15312 | D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
| 15313 | void *_opt_var; |
| 15314 | UNUSED(_opt_var); // Silence compiler warnings |
| 15315 | expr_ty a; |
| 15316 | asdl_seq * b; |
| 15317 | if ( |
| 15318 | (a = star_target_rule(p)) // star_target |
| 15319 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15320 | (b = _loop1_136_rule(p)) // ((',' star_target))+ |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15321 | && |
| 15322 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 15323 | ) |
| 15324 | { |
| 15325 | D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
| 15326 | _res = ( asdl_expr_seq * ) _PyPegen_seq_insert_in_front ( p , a , b ); |
| 15327 | if (_res == NULL && PyErr_Occurred()) { |
| 15328 | p->error_indicator = 1; |
| 15329 | D(p->level--); |
| 15330 | return NULL; |
| 15331 | } |
| 15332 | goto done; |
| 15333 | } |
| 15334 | p->mark = _mark; |
| 15335 | D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ', |
| 15336 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
| 15337 | } |
| 15338 | { // star_target ',' |
| 15339 | if (p->error_indicator) { |
| 15340 | D(p->level--); |
| 15341 | return NULL; |
| 15342 | } |
| 15343 | D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ','")); |
| 15344 | Token * _literal; |
| 15345 | expr_ty a; |
| 15346 | if ( |
| 15347 | (a = star_target_rule(p)) // star_target |
| 15348 | && |
| 15349 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 15350 | ) |
| 15351 | { |
| 15352 | D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ','")); |
| 15353 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
| 15354 | if (_res == NULL && PyErr_Occurred()) { |
| 15355 | p->error_indicator = 1; |
| 15356 | D(p->level--); |
| 15357 | return NULL; |
| 15358 | } |
| 15359 | goto done; |
| 15360 | } |
| 15361 | p->mark = _mark; |
| 15362 | D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ', |
| 15363 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ','")); |
| 15364 | } |
| 15365 | _res = NULL; |
| 15366 | done: |
| 15367 | D(p->level--); |
| 15368 | return _res; |
| 15369 | } |
| 15370 | |
| 15371 | // star_target: '*' (!'*' star_target) | target_with_star_atom |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15372 | static expr_ty |
| 15373 | star_target_rule(Parser *p) |
| 15374 | { |
| 15375 | D(p->level++); |
| 15376 | if (p->error_indicator) { |
| 15377 | D(p->level--); |
| 15378 | return NULL; |
| 15379 | } |
| 15380 | expr_ty _res = NULL; |
| 15381 | if (_PyPegen_is_memoized(p, star_target_type, &_res)) { |
| 15382 | D(p->level--); |
| 15383 | return _res; |
| 15384 | } |
| 15385 | int _mark = p->mark; |
| 15386 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15387 | p->error_indicator = 1; |
| 15388 | D(p->level--); |
| 15389 | return NULL; |
| 15390 | } |
| 15391 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15392 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15393 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15394 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15395 | { // '*' (!'*' star_target) |
| 15396 | if (p->error_indicator) { |
| 15397 | D(p->level--); |
| 15398 | return NULL; |
| 15399 | } |
| 15400 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); |
| 15401 | Token * _literal; |
| 15402 | void *a; |
| 15403 | if ( |
| 15404 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 15405 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15406 | (a = _tmp_137_rule(p)) // !'*' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15407 | ) |
| 15408 | { |
| 15409 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); |
| 15410 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15411 | if (_token == NULL) { |
| 15412 | D(p->level--); |
| 15413 | return NULL; |
| 15414 | } |
| 15415 | int _end_lineno = _token->end_lineno; |
| 15416 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15417 | int _end_col_offset = _token->end_col_offset; |
| 15418 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 15419 | _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] | 15420 | if (_res == NULL && PyErr_Occurred()) { |
| 15421 | p->error_indicator = 1; |
| 15422 | D(p->level--); |
| 15423 | return NULL; |
| 15424 | } |
| 15425 | goto done; |
| 15426 | } |
| 15427 | p->mark = _mark; |
| 15428 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15429 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)")); |
| 15430 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15431 | { // target_with_star_atom |
| 15432 | if (p->error_indicator) { |
| 15433 | D(p->level--); |
| 15434 | return NULL; |
| 15435 | } |
| 15436 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target_with_star_atom")); |
| 15437 | expr_ty target_with_star_atom_var; |
| 15438 | if ( |
| 15439 | (target_with_star_atom_var = target_with_star_atom_rule(p)) // target_with_star_atom |
| 15440 | ) |
| 15441 | { |
| 15442 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target_with_star_atom")); |
| 15443 | _res = target_with_star_atom_var; |
| 15444 | goto done; |
| 15445 | } |
| 15446 | p->mark = _mark; |
| 15447 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15448 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target_with_star_atom")); |
| 15449 | } |
| 15450 | _res = NULL; |
| 15451 | done: |
| 15452 | _PyPegen_insert_memo(p, _mark, star_target_type, _res); |
| 15453 | D(p->level--); |
| 15454 | return _res; |
| 15455 | } |
| 15456 | |
| 15457 | // target_with_star_atom: |
| 15458 | // | t_primary '.' NAME !t_lookahead |
| 15459 | // | t_primary '[' slices ']' !t_lookahead |
| 15460 | // | star_atom |
| 15461 | static expr_ty |
| 15462 | target_with_star_atom_rule(Parser *p) |
| 15463 | { |
| 15464 | D(p->level++); |
| 15465 | if (p->error_indicator) { |
| 15466 | D(p->level--); |
| 15467 | return NULL; |
| 15468 | } |
| 15469 | expr_ty _res = NULL; |
| 15470 | if (_PyPegen_is_memoized(p, target_with_star_atom_type, &_res)) { |
| 15471 | D(p->level--); |
| 15472 | return _res; |
| 15473 | } |
| 15474 | int _mark = p->mark; |
| 15475 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15476 | p->error_indicator = 1; |
| 15477 | D(p->level--); |
| 15478 | return NULL; |
| 15479 | } |
| 15480 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15481 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15482 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15483 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15484 | { // t_primary '.' NAME !t_lookahead |
| 15485 | if (p->error_indicator) { |
| 15486 | D(p->level--); |
| 15487 | return NULL; |
| 15488 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15489 | 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] | 15490 | Token * _literal; |
| 15491 | expr_ty a; |
| 15492 | expr_ty b; |
| 15493 | if ( |
| 15494 | (a = t_primary_rule(p)) // t_primary |
| 15495 | && |
| 15496 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 15497 | && |
| 15498 | (b = _PyPegen_name_token(p)) // NAME |
| 15499 | && |
| 15500 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 15501 | ) |
| 15502 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15503 | 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] | 15504 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15505 | if (_token == NULL) { |
| 15506 | D(p->level--); |
| 15507 | return NULL; |
| 15508 | } |
| 15509 | int _end_lineno = _token->end_lineno; |
| 15510 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15511 | int _end_col_offset = _token->end_col_offset; |
| 15512 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15513 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 15514 | if (_res == NULL && PyErr_Occurred()) { |
| 15515 | p->error_indicator = 1; |
| 15516 | D(p->level--); |
| 15517 | return NULL; |
| 15518 | } |
| 15519 | goto done; |
| 15520 | } |
| 15521 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15522 | 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] | 15523 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 15524 | } |
| 15525 | { // t_primary '[' slices ']' !t_lookahead |
| 15526 | if (p->error_indicator) { |
| 15527 | D(p->level--); |
| 15528 | return NULL; |
| 15529 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15530 | 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] | 15531 | Token * _literal; |
| 15532 | Token * _literal_1; |
| 15533 | expr_ty a; |
| 15534 | expr_ty b; |
| 15535 | if ( |
| 15536 | (a = t_primary_rule(p)) // t_primary |
| 15537 | && |
| 15538 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 15539 | && |
| 15540 | (b = slices_rule(p)) // slices |
| 15541 | && |
| 15542 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 15543 | && |
| 15544 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 15545 | ) |
| 15546 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15547 | 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] | 15548 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15549 | if (_token == NULL) { |
| 15550 | D(p->level--); |
| 15551 | return NULL; |
| 15552 | } |
| 15553 | int _end_lineno = _token->end_lineno; |
| 15554 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15555 | int _end_col_offset = _token->end_col_offset; |
| 15556 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15557 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 15558 | if (_res == NULL && PyErr_Occurred()) { |
| 15559 | p->error_indicator = 1; |
| 15560 | D(p->level--); |
| 15561 | return NULL; |
| 15562 | } |
| 15563 | goto done; |
| 15564 | } |
| 15565 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15566 | 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] | 15567 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 15568 | } |
| 15569 | { // star_atom |
| 15570 | if (p->error_indicator) { |
| 15571 | D(p->level--); |
| 15572 | return NULL; |
| 15573 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15574 | 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] | 15575 | expr_ty star_atom_var; |
| 15576 | if ( |
| 15577 | (star_atom_var = star_atom_rule(p)) // star_atom |
| 15578 | ) |
| 15579 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15580 | 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] | 15581 | _res = star_atom_var; |
| 15582 | goto done; |
| 15583 | } |
| 15584 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15585 | 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] | 15586 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom")); |
| 15587 | } |
| 15588 | _res = NULL; |
| 15589 | done: |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15590 | _PyPegen_insert_memo(p, _mark, target_with_star_atom_type, _res); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15591 | D(p->level--); |
| 15592 | return _res; |
| 15593 | } |
| 15594 | |
| 15595 | // star_atom: |
| 15596 | // | NAME |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15597 | // | '(' target_with_star_atom ')' |
| 15598 | // | '(' star_targets_tuple_seq? ')' |
| 15599 | // | '[' star_targets_list_seq? ']' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15600 | static expr_ty |
| 15601 | star_atom_rule(Parser *p) |
| 15602 | { |
| 15603 | D(p->level++); |
| 15604 | if (p->error_indicator) { |
| 15605 | D(p->level--); |
| 15606 | return NULL; |
| 15607 | } |
| 15608 | expr_ty _res = NULL; |
| 15609 | int _mark = p->mark; |
| 15610 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15611 | p->error_indicator = 1; |
| 15612 | D(p->level--); |
| 15613 | return NULL; |
| 15614 | } |
| 15615 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15616 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15617 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15618 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15619 | { // NAME |
| 15620 | if (p->error_indicator) { |
| 15621 | D(p->level--); |
| 15622 | return NULL; |
| 15623 | } |
| 15624 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 15625 | expr_ty a; |
| 15626 | if ( |
| 15627 | (a = _PyPegen_name_token(p)) // NAME |
| 15628 | ) |
| 15629 | { |
| 15630 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 15631 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 15632 | if (_res == NULL && PyErr_Occurred()) { |
| 15633 | p->error_indicator = 1; |
| 15634 | D(p->level--); |
| 15635 | return NULL; |
| 15636 | } |
| 15637 | goto done; |
| 15638 | } |
| 15639 | p->mark = _mark; |
| 15640 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 15641 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 15642 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15643 | { // '(' target_with_star_atom ')' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15644 | if (p->error_indicator) { |
| 15645 | D(p->level--); |
| 15646 | return NULL; |
| 15647 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15648 | 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] | 15649 | Token * _literal; |
| 15650 | Token * _literal_1; |
| 15651 | expr_ty a; |
| 15652 | if ( |
| 15653 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 15654 | && |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15655 | (a = target_with_star_atom_rule(p)) // target_with_star_atom |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15656 | && |
| 15657 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 15658 | ) |
| 15659 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15660 | 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] | 15661 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 15662 | if (_res == NULL && PyErr_Occurred()) { |
| 15663 | p->error_indicator = 1; |
| 15664 | D(p->level--); |
| 15665 | return NULL; |
| 15666 | } |
| 15667 | goto done; |
| 15668 | } |
| 15669 | p->mark = _mark; |
| 15670 | 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] | 15671 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target_with_star_atom ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15672 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15673 | { // '(' star_targets_tuple_seq? ')' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15674 | if (p->error_indicator) { |
| 15675 | D(p->level--); |
| 15676 | return NULL; |
| 15677 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15678 | 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] | 15679 | Token * _literal; |
| 15680 | Token * _literal_1; |
| 15681 | void *a; |
| 15682 | if ( |
| 15683 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 15684 | && |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15685 | (a = star_targets_tuple_seq_rule(p), 1) // star_targets_tuple_seq? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15686 | && |
| 15687 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 15688 | ) |
| 15689 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15690 | 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] | 15691 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15692 | if (_token == NULL) { |
| 15693 | D(p->level--); |
| 15694 | return NULL; |
| 15695 | } |
| 15696 | int _end_lineno = _token->end_lineno; |
| 15697 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15698 | int _end_col_offset = _token->end_col_offset; |
| 15699 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15700 | _res = _Py_Tuple ( a , Store , EXTRA ); |
| 15701 | if (_res == NULL && PyErr_Occurred()) { |
| 15702 | p->error_indicator = 1; |
| 15703 | D(p->level--); |
| 15704 | return NULL; |
| 15705 | } |
| 15706 | goto done; |
| 15707 | } |
| 15708 | p->mark = _mark; |
| 15709 | 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] | 15710 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_tuple_seq? ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15711 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15712 | { // '[' star_targets_list_seq? ']' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15713 | if (p->error_indicator) { |
| 15714 | D(p->level--); |
| 15715 | return NULL; |
| 15716 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15717 | 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] | 15718 | Token * _literal; |
| 15719 | Token * _literal_1; |
| 15720 | void *a; |
| 15721 | if ( |
| 15722 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 15723 | && |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15724 | (a = star_targets_list_seq_rule(p), 1) // star_targets_list_seq? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15725 | && |
| 15726 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 15727 | ) |
| 15728 | { |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 15729 | 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] | 15730 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15731 | if (_token == NULL) { |
| 15732 | D(p->level--); |
| 15733 | return NULL; |
| 15734 | } |
| 15735 | int _end_lineno = _token->end_lineno; |
| 15736 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15737 | int _end_col_offset = _token->end_col_offset; |
| 15738 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15739 | _res = _Py_List ( a , Store , EXTRA ); |
| 15740 | if (_res == NULL && PyErr_Occurred()) { |
| 15741 | p->error_indicator = 1; |
| 15742 | D(p->level--); |
| 15743 | return NULL; |
| 15744 | } |
| 15745 | goto done; |
| 15746 | } |
| 15747 | p->mark = _mark; |
| 15748 | 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] | 15749 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_list_seq? ']'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15750 | } |
| 15751 | _res = NULL; |
| 15752 | done: |
| 15753 | D(p->level--); |
| 15754 | return _res; |
| 15755 | } |
| 15756 | |
| 15757 | // single_target: single_subscript_attribute_target | NAME | '(' single_target ')' |
| 15758 | static expr_ty |
| 15759 | single_target_rule(Parser *p) |
| 15760 | { |
| 15761 | D(p->level++); |
| 15762 | if (p->error_indicator) { |
| 15763 | D(p->level--); |
| 15764 | return NULL; |
| 15765 | } |
| 15766 | expr_ty _res = NULL; |
| 15767 | int _mark = p->mark; |
| 15768 | { // single_subscript_attribute_target |
| 15769 | if (p->error_indicator) { |
| 15770 | D(p->level--); |
| 15771 | return NULL; |
| 15772 | } |
| 15773 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
| 15774 | expr_ty single_subscript_attribute_target_var; |
| 15775 | if ( |
| 15776 | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
| 15777 | ) |
| 15778 | { |
| 15779 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
| 15780 | _res = single_subscript_attribute_target_var; |
| 15781 | goto done; |
| 15782 | } |
| 15783 | p->mark = _mark; |
| 15784 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15785 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
| 15786 | } |
| 15787 | { // NAME |
| 15788 | if (p->error_indicator) { |
| 15789 | D(p->level--); |
| 15790 | return NULL; |
| 15791 | } |
| 15792 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 15793 | expr_ty a; |
| 15794 | if ( |
| 15795 | (a = _PyPegen_name_token(p)) // NAME |
| 15796 | ) |
| 15797 | { |
| 15798 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 15799 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 15800 | if (_res == NULL && PyErr_Occurred()) { |
| 15801 | p->error_indicator = 1; |
| 15802 | D(p->level--); |
| 15803 | return NULL; |
| 15804 | } |
| 15805 | goto done; |
| 15806 | } |
| 15807 | p->mark = _mark; |
| 15808 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15809 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 15810 | } |
| 15811 | { // '(' single_target ')' |
| 15812 | if (p->error_indicator) { |
| 15813 | D(p->level--); |
| 15814 | return NULL; |
| 15815 | } |
| 15816 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
| 15817 | Token * _literal; |
| 15818 | Token * _literal_1; |
| 15819 | expr_ty a; |
| 15820 | if ( |
| 15821 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 15822 | && |
| 15823 | (a = single_target_rule(p)) // single_target |
| 15824 | && |
| 15825 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 15826 | ) |
| 15827 | { |
| 15828 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
| 15829 | _res = a; |
| 15830 | if (_res == NULL && PyErr_Occurred()) { |
| 15831 | p->error_indicator = 1; |
| 15832 | D(p->level--); |
| 15833 | return NULL; |
| 15834 | } |
| 15835 | goto done; |
| 15836 | } |
| 15837 | p->mark = _mark; |
| 15838 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15839 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
| 15840 | } |
| 15841 | _res = NULL; |
| 15842 | done: |
| 15843 | D(p->level--); |
| 15844 | return _res; |
| 15845 | } |
| 15846 | |
| 15847 | // single_subscript_attribute_target: |
| 15848 | // | t_primary '.' NAME !t_lookahead |
| 15849 | // | t_primary '[' slices ']' !t_lookahead |
| 15850 | static expr_ty |
| 15851 | single_subscript_attribute_target_rule(Parser *p) |
| 15852 | { |
| 15853 | D(p->level++); |
| 15854 | if (p->error_indicator) { |
| 15855 | D(p->level--); |
| 15856 | return NULL; |
| 15857 | } |
| 15858 | expr_ty _res = NULL; |
| 15859 | int _mark = p->mark; |
| 15860 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 15861 | p->error_indicator = 1; |
| 15862 | D(p->level--); |
| 15863 | return NULL; |
| 15864 | } |
| 15865 | int _start_lineno = p->tokens[_mark]->lineno; |
| 15866 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 15867 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 15868 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 15869 | { // t_primary '.' NAME !t_lookahead |
| 15870 | if (p->error_indicator) { |
| 15871 | D(p->level--); |
| 15872 | return NULL; |
| 15873 | } |
| 15874 | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 15875 | Token * _literal; |
| 15876 | expr_ty a; |
| 15877 | expr_ty b; |
| 15878 | if ( |
| 15879 | (a = t_primary_rule(p)) // t_primary |
| 15880 | && |
| 15881 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 15882 | && |
| 15883 | (b = _PyPegen_name_token(p)) // NAME |
| 15884 | && |
| 15885 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 15886 | ) |
| 15887 | { |
| 15888 | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 15889 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15890 | if (_token == NULL) { |
| 15891 | D(p->level--); |
| 15892 | return NULL; |
| 15893 | } |
| 15894 | int _end_lineno = _token->end_lineno; |
| 15895 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15896 | int _end_col_offset = _token->end_col_offset; |
| 15897 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15898 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 15899 | if (_res == NULL && PyErr_Occurred()) { |
| 15900 | p->error_indicator = 1; |
| 15901 | D(p->level--); |
| 15902 | return NULL; |
| 15903 | } |
| 15904 | goto done; |
| 15905 | } |
| 15906 | p->mark = _mark; |
| 15907 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15908 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 15909 | } |
| 15910 | { // t_primary '[' slices ']' !t_lookahead |
| 15911 | if (p->error_indicator) { |
| 15912 | D(p->level--); |
| 15913 | return NULL; |
| 15914 | } |
| 15915 | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 15916 | Token * _literal; |
| 15917 | Token * _literal_1; |
| 15918 | expr_ty a; |
| 15919 | expr_ty b; |
| 15920 | if ( |
| 15921 | (a = t_primary_rule(p)) // t_primary |
| 15922 | && |
| 15923 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 15924 | && |
| 15925 | (b = slices_rule(p)) // slices |
| 15926 | && |
| 15927 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 15928 | && |
| 15929 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 15930 | ) |
| 15931 | { |
| 15932 | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 15933 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 15934 | if (_token == NULL) { |
| 15935 | D(p->level--); |
| 15936 | return NULL; |
| 15937 | } |
| 15938 | int _end_lineno = _token->end_lineno; |
| 15939 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 15940 | int _end_col_offset = _token->end_col_offset; |
| 15941 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 15942 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 15943 | if (_res == NULL && PyErr_Occurred()) { |
| 15944 | p->error_indicator = 1; |
| 15945 | D(p->level--); |
| 15946 | return NULL; |
| 15947 | } |
| 15948 | goto done; |
| 15949 | } |
| 15950 | p->mark = _mark; |
| 15951 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15952 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 15953 | } |
| 15954 | _res = NULL; |
| 15955 | done: |
| 15956 | D(p->level--); |
| 15957 | return _res; |
| 15958 | } |
| 15959 | |
| 15960 | // del_targets: ','.del_target+ ','? |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15961 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15962 | del_targets_rule(Parser *p) |
| 15963 | { |
| 15964 | D(p->level++); |
| 15965 | if (p->error_indicator) { |
| 15966 | D(p->level--); |
| 15967 | return NULL; |
| 15968 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15969 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15970 | int _mark = p->mark; |
| 15971 | { // ','.del_target+ ','? |
| 15972 | if (p->error_indicator) { |
| 15973 | D(p->level--); |
| 15974 | return NULL; |
| 15975 | } |
| 15976 | D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); |
| 15977 | void *_opt_var; |
| 15978 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 15979 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15980 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 15981 | (a = (asdl_expr_seq*)_gather_138_rule(p)) // ','.del_target+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 15982 | && |
| 15983 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 15984 | ) |
| 15985 | { |
| 15986 | D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); |
| 15987 | _res = a; |
| 15988 | if (_res == NULL && PyErr_Occurred()) { |
| 15989 | p->error_indicator = 1; |
| 15990 | D(p->level--); |
| 15991 | return NULL; |
| 15992 | } |
| 15993 | goto done; |
| 15994 | } |
| 15995 | p->mark = _mark; |
| 15996 | D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 15997 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?")); |
| 15998 | } |
| 15999 | _res = NULL; |
| 16000 | done: |
| 16001 | D(p->level--); |
| 16002 | return _res; |
| 16003 | } |
| 16004 | |
| 16005 | // del_target: |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16006 | // | t_primary '.' NAME !t_lookahead |
| 16007 | // | t_primary '[' slices ']' !t_lookahead |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16008 | // | del_t_atom |
| 16009 | static expr_ty |
| 16010 | del_target_rule(Parser *p) |
| 16011 | { |
| 16012 | D(p->level++); |
| 16013 | if (p->error_indicator) { |
| 16014 | D(p->level--); |
| 16015 | return NULL; |
| 16016 | } |
| 16017 | expr_ty _res = NULL; |
| 16018 | if (_PyPegen_is_memoized(p, del_target_type, &_res)) { |
| 16019 | D(p->level--); |
| 16020 | return _res; |
| 16021 | } |
| 16022 | int _mark = p->mark; |
| 16023 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16024 | p->error_indicator = 1; |
| 16025 | D(p->level--); |
| 16026 | return NULL; |
| 16027 | } |
| 16028 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16029 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16030 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16031 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16032 | { // t_primary '.' NAME !t_lookahead |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16033 | if (p->error_indicator) { |
| 16034 | D(p->level--); |
| 16035 | return NULL; |
| 16036 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16037 | 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] | 16038 | Token * _literal; |
| 16039 | expr_ty a; |
| 16040 | expr_ty b; |
| 16041 | if ( |
| 16042 | (a = t_primary_rule(p)) // t_primary |
| 16043 | && |
| 16044 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 16045 | && |
| 16046 | (b = _PyPegen_name_token(p)) // NAME |
| 16047 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16048 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16049 | ) |
| 16050 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16051 | 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] | 16052 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16053 | if (_token == NULL) { |
| 16054 | D(p->level--); |
| 16055 | return NULL; |
| 16056 | } |
| 16057 | int _end_lineno = _token->end_lineno; |
| 16058 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16059 | int _end_col_offset = _token->end_col_offset; |
| 16060 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16061 | _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA ); |
| 16062 | if (_res == NULL && PyErr_Occurred()) { |
| 16063 | p->error_indicator = 1; |
| 16064 | D(p->level--); |
| 16065 | return NULL; |
| 16066 | } |
| 16067 | goto done; |
| 16068 | } |
| 16069 | p->mark = _mark; |
| 16070 | 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] | 16071 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16072 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16073 | { // t_primary '[' slices ']' !t_lookahead |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16074 | if (p->error_indicator) { |
| 16075 | D(p->level--); |
| 16076 | return NULL; |
| 16077 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16078 | 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] | 16079 | Token * _literal; |
| 16080 | Token * _literal_1; |
| 16081 | expr_ty a; |
| 16082 | expr_ty b; |
| 16083 | if ( |
| 16084 | (a = t_primary_rule(p)) // t_primary |
| 16085 | && |
| 16086 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16087 | && |
| 16088 | (b = slices_rule(p)) // slices |
| 16089 | && |
| 16090 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16091 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16092 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16093 | ) |
| 16094 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16095 | 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] | 16096 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16097 | if (_token == NULL) { |
| 16098 | D(p->level--); |
| 16099 | return NULL; |
| 16100 | } |
| 16101 | int _end_lineno = _token->end_lineno; |
| 16102 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16103 | int _end_col_offset = _token->end_col_offset; |
| 16104 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16105 | _res = _Py_Subscript ( a , b , Del , EXTRA ); |
| 16106 | if (_res == NULL && PyErr_Occurred()) { |
| 16107 | p->error_indicator = 1; |
| 16108 | D(p->level--); |
| 16109 | return NULL; |
| 16110 | } |
| 16111 | goto done; |
| 16112 | } |
| 16113 | p->mark = _mark; |
| 16114 | 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] | 16115 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16116 | } |
| 16117 | { // del_t_atom |
| 16118 | if (p->error_indicator) { |
| 16119 | D(p->level--); |
| 16120 | return NULL; |
| 16121 | } |
| 16122 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom")); |
| 16123 | expr_ty del_t_atom_var; |
| 16124 | if ( |
| 16125 | (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom |
| 16126 | ) |
| 16127 | { |
| 16128 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom")); |
| 16129 | _res = del_t_atom_var; |
| 16130 | goto done; |
| 16131 | } |
| 16132 | p->mark = _mark; |
| 16133 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 16134 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom")); |
| 16135 | } |
| 16136 | _res = NULL; |
| 16137 | done: |
| 16138 | _PyPegen_insert_memo(p, _mark, del_target_type, _res); |
| 16139 | D(p->level--); |
| 16140 | return _res; |
| 16141 | } |
| 16142 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16143 | // del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16144 | static expr_ty |
| 16145 | del_t_atom_rule(Parser *p) |
| 16146 | { |
| 16147 | D(p->level++); |
| 16148 | if (p->error_indicator) { |
| 16149 | D(p->level--); |
| 16150 | return NULL; |
| 16151 | } |
| 16152 | expr_ty _res = NULL; |
| 16153 | int _mark = p->mark; |
| 16154 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16155 | p->error_indicator = 1; |
| 16156 | D(p->level--); |
| 16157 | return NULL; |
| 16158 | } |
| 16159 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16160 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16161 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16162 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16163 | { // NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16164 | if (p->error_indicator) { |
| 16165 | D(p->level--); |
| 16166 | return NULL; |
| 16167 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16168 | 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] | 16169 | expr_ty a; |
| 16170 | if ( |
| 16171 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16172 | ) |
| 16173 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 16174 | 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] | 16175 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
| 16176 | if (_res == NULL && PyErr_Occurred()) { |
| 16177 | p->error_indicator = 1; |
| 16178 | D(p->level--); |
| 16179 | return NULL; |
| 16180 | } |
| 16181 | goto done; |
| 16182 | } |
| 16183 | p->mark = _mark; |
| 16184 | 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] | 16185 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16186 | } |
| 16187 | { // '(' del_target ')' |
| 16188 | if (p->error_indicator) { |
| 16189 | D(p->level--); |
| 16190 | return NULL; |
| 16191 | } |
| 16192 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); |
| 16193 | Token * _literal; |
| 16194 | Token * _literal_1; |
| 16195 | expr_ty a; |
| 16196 | if ( |
| 16197 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16198 | && |
| 16199 | (a = del_target_rule(p)) // del_target |
| 16200 | && |
| 16201 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16202 | ) |
| 16203 | { |
| 16204 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); |
| 16205 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
| 16206 | if (_res == NULL && PyErr_Occurred()) { |
| 16207 | p->error_indicator = 1; |
| 16208 | D(p->level--); |
| 16209 | return NULL; |
| 16210 | } |
| 16211 | goto done; |
| 16212 | } |
| 16213 | p->mark = _mark; |
| 16214 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16215 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'")); |
| 16216 | } |
| 16217 | { // '(' del_targets? ')' |
| 16218 | if (p->error_indicator) { |
| 16219 | D(p->level--); |
| 16220 | return NULL; |
| 16221 | } |
| 16222 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); |
| 16223 | Token * _literal; |
| 16224 | Token * _literal_1; |
| 16225 | void *a; |
| 16226 | if ( |
| 16227 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16228 | && |
| 16229 | (a = del_targets_rule(p), 1) // del_targets? |
| 16230 | && |
| 16231 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16232 | ) |
| 16233 | { |
| 16234 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); |
| 16235 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16236 | if (_token == NULL) { |
| 16237 | D(p->level--); |
| 16238 | return NULL; |
| 16239 | } |
| 16240 | int _end_lineno = _token->end_lineno; |
| 16241 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16242 | int _end_col_offset = _token->end_col_offset; |
| 16243 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16244 | _res = _Py_Tuple ( a , Del , EXTRA ); |
| 16245 | if (_res == NULL && PyErr_Occurred()) { |
| 16246 | p->error_indicator = 1; |
| 16247 | D(p->level--); |
| 16248 | return NULL; |
| 16249 | } |
| 16250 | goto done; |
| 16251 | } |
| 16252 | p->mark = _mark; |
| 16253 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16254 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'")); |
| 16255 | } |
| 16256 | { // '[' del_targets? ']' |
| 16257 | if (p->error_indicator) { |
| 16258 | D(p->level--); |
| 16259 | return NULL; |
| 16260 | } |
| 16261 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); |
| 16262 | Token * _literal; |
| 16263 | Token * _literal_1; |
| 16264 | void *a; |
| 16265 | if ( |
| 16266 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16267 | && |
| 16268 | (a = del_targets_rule(p), 1) // del_targets? |
| 16269 | && |
| 16270 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16271 | ) |
| 16272 | { |
| 16273 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); |
| 16274 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16275 | if (_token == NULL) { |
| 16276 | D(p->level--); |
| 16277 | return NULL; |
| 16278 | } |
| 16279 | int _end_lineno = _token->end_lineno; |
| 16280 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16281 | int _end_col_offset = _token->end_col_offset; |
| 16282 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16283 | _res = _Py_List ( a , Del , EXTRA ); |
| 16284 | if (_res == NULL && PyErr_Occurred()) { |
| 16285 | p->error_indicator = 1; |
| 16286 | D(p->level--); |
| 16287 | return NULL; |
| 16288 | } |
| 16289 | goto done; |
| 16290 | } |
| 16291 | p->mark = _mark; |
| 16292 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16293 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'")); |
| 16294 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16295 | _res = NULL; |
| 16296 | done: |
| 16297 | D(p->level--); |
| 16298 | return _res; |
| 16299 | } |
| 16300 | |
| 16301 | // targets: ','.target+ ','? |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 16302 | static asdl_expr_seq* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16303 | targets_rule(Parser *p) |
| 16304 | { |
| 16305 | D(p->level++); |
| 16306 | if (p->error_indicator) { |
| 16307 | D(p->level--); |
| 16308 | return NULL; |
| 16309 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 16310 | asdl_expr_seq* _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16311 | int _mark = p->mark; |
| 16312 | { // ','.target+ ','? |
| 16313 | if (p->error_indicator) { |
| 16314 | D(p->level--); |
| 16315 | return NULL; |
| 16316 | } |
| 16317 | D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); |
| 16318 | void *_opt_var; |
| 16319 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 16320 | asdl_expr_seq* a; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16321 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 16322 | (a = (asdl_expr_seq*)_gather_140_rule(p)) // ','.target+ |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16323 | && |
| 16324 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
| 16325 | ) |
| 16326 | { |
| 16327 | D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); |
| 16328 | _res = a; |
| 16329 | if (_res == NULL && PyErr_Occurred()) { |
| 16330 | p->error_indicator = 1; |
| 16331 | D(p->level--); |
| 16332 | return NULL; |
| 16333 | } |
| 16334 | goto done; |
| 16335 | } |
| 16336 | p->mark = _mark; |
| 16337 | D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 16338 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?")); |
| 16339 | } |
| 16340 | _res = NULL; |
| 16341 | done: |
| 16342 | D(p->level--); |
| 16343 | return _res; |
| 16344 | } |
| 16345 | |
| 16346 | // target: |
| 16347 | // | t_primary '.' NAME !t_lookahead |
| 16348 | // | t_primary '[' slices ']' !t_lookahead |
| 16349 | // | t_atom |
| 16350 | static expr_ty |
| 16351 | target_rule(Parser *p) |
| 16352 | { |
| 16353 | D(p->level++); |
| 16354 | if (p->error_indicator) { |
| 16355 | D(p->level--); |
| 16356 | return NULL; |
| 16357 | } |
| 16358 | expr_ty _res = NULL; |
| 16359 | if (_PyPegen_is_memoized(p, target_type, &_res)) { |
| 16360 | D(p->level--); |
| 16361 | return _res; |
| 16362 | } |
| 16363 | int _mark = p->mark; |
| 16364 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16365 | p->error_indicator = 1; |
| 16366 | D(p->level--); |
| 16367 | return NULL; |
| 16368 | } |
| 16369 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16370 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16371 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16372 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 16373 | { // t_primary '.' NAME !t_lookahead |
| 16374 | if (p->error_indicator) { |
| 16375 | D(p->level--); |
| 16376 | return NULL; |
| 16377 | } |
| 16378 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 16379 | Token * _literal; |
| 16380 | expr_ty a; |
| 16381 | expr_ty b; |
| 16382 | if ( |
| 16383 | (a = t_primary_rule(p)) // t_primary |
| 16384 | && |
| 16385 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 16386 | && |
| 16387 | (b = _PyPegen_name_token(p)) // NAME |
| 16388 | && |
| 16389 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 16390 | ) |
| 16391 | { |
| 16392 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 16393 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16394 | if (_token == NULL) { |
| 16395 | D(p->level--); |
| 16396 | return NULL; |
| 16397 | } |
| 16398 | int _end_lineno = _token->end_lineno; |
| 16399 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16400 | int _end_col_offset = _token->end_col_offset; |
| 16401 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16402 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 16403 | if (_res == NULL && PyErr_Occurred()) { |
| 16404 | p->error_indicator = 1; |
| 16405 | D(p->level--); |
| 16406 | return NULL; |
| 16407 | } |
| 16408 | goto done; |
| 16409 | } |
| 16410 | p->mark = _mark; |
| 16411 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 16412 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
| 16413 | } |
| 16414 | { // t_primary '[' slices ']' !t_lookahead |
| 16415 | if (p->error_indicator) { |
| 16416 | D(p->level--); |
| 16417 | return NULL; |
| 16418 | } |
| 16419 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 16420 | Token * _literal; |
| 16421 | Token * _literal_1; |
| 16422 | expr_ty a; |
| 16423 | expr_ty b; |
| 16424 | if ( |
| 16425 | (a = t_primary_rule(p)) // t_primary |
| 16426 | && |
| 16427 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16428 | && |
| 16429 | (b = slices_rule(p)) // slices |
| 16430 | && |
| 16431 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16432 | && |
| 16433 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 16434 | ) |
| 16435 | { |
| 16436 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 16437 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16438 | if (_token == NULL) { |
| 16439 | D(p->level--); |
| 16440 | return NULL; |
| 16441 | } |
| 16442 | int _end_lineno = _token->end_lineno; |
| 16443 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16444 | int _end_col_offset = _token->end_col_offset; |
| 16445 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16446 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 16447 | if (_res == NULL && PyErr_Occurred()) { |
| 16448 | p->error_indicator = 1; |
| 16449 | D(p->level--); |
| 16450 | return NULL; |
| 16451 | } |
| 16452 | goto done; |
| 16453 | } |
| 16454 | p->mark = _mark; |
| 16455 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 16456 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
| 16457 | } |
| 16458 | { // t_atom |
| 16459 | if (p->error_indicator) { |
| 16460 | D(p->level--); |
| 16461 | return NULL; |
| 16462 | } |
| 16463 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom")); |
| 16464 | expr_ty t_atom_var; |
| 16465 | if ( |
| 16466 | (t_atom_var = t_atom_rule(p)) // t_atom |
| 16467 | ) |
| 16468 | { |
| 16469 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom")); |
| 16470 | _res = t_atom_var; |
| 16471 | goto done; |
| 16472 | } |
| 16473 | p->mark = _mark; |
| 16474 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 16475 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom")); |
| 16476 | } |
| 16477 | _res = NULL; |
| 16478 | done: |
| 16479 | _PyPegen_insert_memo(p, _mark, target_type, _res); |
| 16480 | D(p->level--); |
| 16481 | return _res; |
| 16482 | } |
| 16483 | |
| 16484 | // Left-recursive |
| 16485 | // t_primary: |
| 16486 | // | t_primary '.' NAME &t_lookahead |
| 16487 | // | t_primary '[' slices ']' &t_lookahead |
| 16488 | // | t_primary genexp &t_lookahead |
| 16489 | // | t_primary '(' arguments? ')' &t_lookahead |
| 16490 | // | atom &t_lookahead |
| 16491 | static expr_ty t_primary_raw(Parser *); |
| 16492 | static expr_ty |
| 16493 | t_primary_rule(Parser *p) |
| 16494 | { |
| 16495 | D(p->level++); |
| 16496 | expr_ty _res = NULL; |
| 16497 | if (_PyPegen_is_memoized(p, t_primary_type, &_res)) { |
| 16498 | D(p->level--); |
| 16499 | return _res; |
| 16500 | } |
| 16501 | int _mark = p->mark; |
| 16502 | int _resmark = p->mark; |
| 16503 | while (1) { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 16504 | int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); |
| 16505 | if (tmpvar_9) { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16506 | D(p->level--); |
| 16507 | return _res; |
| 16508 | } |
| 16509 | p->mark = _mark; |
| 16510 | void *_raw = t_primary_raw(p); |
Lysandros Nikolaou | 02cdfc9 | 2020-10-31 20:31:41 +0200 | [diff] [blame] | 16511 | if (p->error_indicator) |
| 16512 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16513 | if (_raw == NULL || p->mark <= _resmark) |
| 16514 | break; |
| 16515 | _resmark = p->mark; |
| 16516 | _res = _raw; |
| 16517 | } |
| 16518 | p->mark = _resmark; |
| 16519 | D(p->level--); |
| 16520 | return _res; |
| 16521 | } |
| 16522 | static expr_ty |
| 16523 | t_primary_raw(Parser *p) |
| 16524 | { |
| 16525 | D(p->level++); |
| 16526 | if (p->error_indicator) { |
| 16527 | D(p->level--); |
| 16528 | return NULL; |
| 16529 | } |
| 16530 | expr_ty _res = NULL; |
| 16531 | int _mark = p->mark; |
| 16532 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16533 | p->error_indicator = 1; |
| 16534 | D(p->level--); |
| 16535 | return NULL; |
| 16536 | } |
| 16537 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16538 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16539 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16540 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 16541 | { // t_primary '.' NAME &t_lookahead |
| 16542 | if (p->error_indicator) { |
| 16543 | D(p->level--); |
| 16544 | return NULL; |
| 16545 | } |
| 16546 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
| 16547 | Token * _literal; |
| 16548 | expr_ty a; |
| 16549 | expr_ty b; |
| 16550 | if ( |
| 16551 | (a = t_primary_rule(p)) // t_primary |
| 16552 | && |
| 16553 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 16554 | && |
| 16555 | (b = _PyPegen_name_token(p)) // NAME |
| 16556 | && |
| 16557 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16558 | ) |
| 16559 | { |
| 16560 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
| 16561 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16562 | if (_token == NULL) { |
| 16563 | D(p->level--); |
| 16564 | return NULL; |
| 16565 | } |
| 16566 | int _end_lineno = _token->end_lineno; |
| 16567 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16568 | int _end_col_offset = _token->end_col_offset; |
| 16569 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16570 | _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
| 16571 | if (_res == NULL && PyErr_Occurred()) { |
| 16572 | p->error_indicator = 1; |
| 16573 | D(p->level--); |
| 16574 | return NULL; |
| 16575 | } |
| 16576 | goto done; |
| 16577 | } |
| 16578 | p->mark = _mark; |
| 16579 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16580 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
| 16581 | } |
| 16582 | { // t_primary '[' slices ']' &t_lookahead |
| 16583 | if (p->error_indicator) { |
| 16584 | D(p->level--); |
| 16585 | return NULL; |
| 16586 | } |
| 16587 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
| 16588 | Token * _literal; |
| 16589 | Token * _literal_1; |
| 16590 | expr_ty a; |
| 16591 | expr_ty b; |
| 16592 | if ( |
| 16593 | (a = t_primary_rule(p)) // t_primary |
| 16594 | && |
| 16595 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16596 | && |
| 16597 | (b = slices_rule(p)) // slices |
| 16598 | && |
| 16599 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16600 | && |
| 16601 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16602 | ) |
| 16603 | { |
| 16604 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
| 16605 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16606 | if (_token == NULL) { |
| 16607 | D(p->level--); |
| 16608 | return NULL; |
| 16609 | } |
| 16610 | int _end_lineno = _token->end_lineno; |
| 16611 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16612 | int _end_col_offset = _token->end_col_offset; |
| 16613 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16614 | _res = _Py_Subscript ( a , b , Load , EXTRA ); |
| 16615 | if (_res == NULL && PyErr_Occurred()) { |
| 16616 | p->error_indicator = 1; |
| 16617 | D(p->level--); |
| 16618 | return NULL; |
| 16619 | } |
| 16620 | goto done; |
| 16621 | } |
| 16622 | p->mark = _mark; |
| 16623 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16624 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
| 16625 | } |
| 16626 | { // t_primary genexp &t_lookahead |
| 16627 | if (p->error_indicator) { |
| 16628 | D(p->level--); |
| 16629 | return NULL; |
| 16630 | } |
| 16631 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); |
| 16632 | expr_ty a; |
| 16633 | expr_ty b; |
| 16634 | if ( |
| 16635 | (a = t_primary_rule(p)) // t_primary |
| 16636 | && |
| 16637 | (b = genexp_rule(p)) // genexp |
| 16638 | && |
| 16639 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16640 | ) |
| 16641 | { |
| 16642 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); |
| 16643 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16644 | if (_token == NULL) { |
| 16645 | D(p->level--); |
| 16646 | return NULL; |
| 16647 | } |
| 16648 | int _end_lineno = _token->end_lineno; |
| 16649 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16650 | int _end_col_offset = _token->end_col_offset; |
| 16651 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 2e5ca9e | 2020-10-21 22:53:14 +0300 | [diff] [blame] | 16652 | _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] | 16653 | if (_res == NULL && PyErr_Occurred()) { |
| 16654 | p->error_indicator = 1; |
| 16655 | D(p->level--); |
| 16656 | return NULL; |
| 16657 | } |
| 16658 | goto done; |
| 16659 | } |
| 16660 | p->mark = _mark; |
| 16661 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16662 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead")); |
| 16663 | } |
| 16664 | { // t_primary '(' arguments? ')' &t_lookahead |
| 16665 | if (p->error_indicator) { |
| 16666 | D(p->level--); |
| 16667 | return NULL; |
| 16668 | } |
| 16669 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
| 16670 | Token * _literal; |
| 16671 | Token * _literal_1; |
| 16672 | expr_ty a; |
| 16673 | void *b; |
| 16674 | if ( |
| 16675 | (a = t_primary_rule(p)) // t_primary |
| 16676 | && |
| 16677 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16678 | && |
| 16679 | (b = arguments_rule(p), 1) // arguments? |
| 16680 | && |
| 16681 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16682 | && |
| 16683 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16684 | ) |
| 16685 | { |
| 16686 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
| 16687 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16688 | if (_token == NULL) { |
| 16689 | D(p->level--); |
| 16690 | return NULL; |
| 16691 | } |
| 16692 | int _end_lineno = _token->end_lineno; |
| 16693 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16694 | int _end_col_offset = _token->end_col_offset; |
| 16695 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16696 | _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 16697 | if (_res == NULL && PyErr_Occurred()) { |
| 16698 | p->error_indicator = 1; |
| 16699 | D(p->level--); |
| 16700 | return NULL; |
| 16701 | } |
| 16702 | goto done; |
| 16703 | } |
| 16704 | p->mark = _mark; |
| 16705 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16706 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
| 16707 | } |
| 16708 | { // atom &t_lookahead |
| 16709 | if (p->error_indicator) { |
| 16710 | D(p->level--); |
| 16711 | return NULL; |
| 16712 | } |
| 16713 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); |
| 16714 | expr_ty a; |
| 16715 | if ( |
| 16716 | (a = atom_rule(p)) // atom |
| 16717 | && |
| 16718 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 16719 | ) |
| 16720 | { |
| 16721 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); |
| 16722 | _res = a; |
| 16723 | if (_res == NULL && PyErr_Occurred()) { |
| 16724 | p->error_indicator = 1; |
| 16725 | D(p->level--); |
| 16726 | return NULL; |
| 16727 | } |
| 16728 | goto done; |
| 16729 | } |
| 16730 | p->mark = _mark; |
| 16731 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 16732 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead")); |
| 16733 | } |
| 16734 | _res = NULL; |
| 16735 | done: |
| 16736 | D(p->level--); |
| 16737 | return _res; |
| 16738 | } |
| 16739 | |
| 16740 | // t_lookahead: '(' | '[' | '.' |
| 16741 | static void * |
| 16742 | t_lookahead_rule(Parser *p) |
| 16743 | { |
| 16744 | D(p->level++); |
| 16745 | if (p->error_indicator) { |
| 16746 | D(p->level--); |
| 16747 | return NULL; |
| 16748 | } |
| 16749 | void * _res = NULL; |
| 16750 | int _mark = p->mark; |
| 16751 | { // '(' |
| 16752 | if (p->error_indicator) { |
| 16753 | D(p->level--); |
| 16754 | return NULL; |
| 16755 | } |
| 16756 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
| 16757 | Token * _literal; |
| 16758 | if ( |
| 16759 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16760 | ) |
| 16761 | { |
| 16762 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
| 16763 | _res = _literal; |
| 16764 | goto done; |
| 16765 | } |
| 16766 | p->mark = _mark; |
| 16767 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 16768 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
| 16769 | } |
| 16770 | { // '[' |
| 16771 | if (p->error_indicator) { |
| 16772 | D(p->level--); |
| 16773 | return NULL; |
| 16774 | } |
| 16775 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
| 16776 | Token * _literal; |
| 16777 | if ( |
| 16778 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16779 | ) |
| 16780 | { |
| 16781 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
| 16782 | _res = _literal; |
| 16783 | goto done; |
| 16784 | } |
| 16785 | p->mark = _mark; |
| 16786 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 16787 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
| 16788 | } |
| 16789 | { // '.' |
| 16790 | if (p->error_indicator) { |
| 16791 | D(p->level--); |
| 16792 | return NULL; |
| 16793 | } |
| 16794 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 16795 | Token * _literal; |
| 16796 | if ( |
| 16797 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 16798 | ) |
| 16799 | { |
| 16800 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 16801 | _res = _literal; |
| 16802 | goto done; |
| 16803 | } |
| 16804 | p->mark = _mark; |
| 16805 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 16806 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 16807 | } |
| 16808 | _res = NULL; |
| 16809 | done: |
| 16810 | D(p->level--); |
| 16811 | return _res; |
| 16812 | } |
| 16813 | |
| 16814 | // t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']' |
| 16815 | static expr_ty |
| 16816 | t_atom_rule(Parser *p) |
| 16817 | { |
| 16818 | D(p->level++); |
| 16819 | if (p->error_indicator) { |
| 16820 | D(p->level--); |
| 16821 | return NULL; |
| 16822 | } |
| 16823 | expr_ty _res = NULL; |
| 16824 | int _mark = p->mark; |
| 16825 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 16826 | p->error_indicator = 1; |
| 16827 | D(p->level--); |
| 16828 | return NULL; |
| 16829 | } |
| 16830 | int _start_lineno = p->tokens[_mark]->lineno; |
| 16831 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 16832 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 16833 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
| 16834 | { // NAME |
| 16835 | if (p->error_indicator) { |
| 16836 | D(p->level--); |
| 16837 | return NULL; |
| 16838 | } |
| 16839 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 16840 | expr_ty a; |
| 16841 | if ( |
| 16842 | (a = _PyPegen_name_token(p)) // NAME |
| 16843 | ) |
| 16844 | { |
| 16845 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
| 16846 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 16847 | if (_res == NULL && PyErr_Occurred()) { |
| 16848 | p->error_indicator = 1; |
| 16849 | D(p->level--); |
| 16850 | return NULL; |
| 16851 | } |
| 16852 | goto done; |
| 16853 | } |
| 16854 | p->mark = _mark; |
| 16855 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16856 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
| 16857 | } |
| 16858 | { // '(' target ')' |
| 16859 | if (p->error_indicator) { |
| 16860 | D(p->level--); |
| 16861 | return NULL; |
| 16862 | } |
| 16863 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); |
| 16864 | Token * _literal; |
| 16865 | Token * _literal_1; |
| 16866 | expr_ty a; |
| 16867 | if ( |
| 16868 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16869 | && |
| 16870 | (a = target_rule(p)) // target |
| 16871 | && |
| 16872 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16873 | ) |
| 16874 | { |
| 16875 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); |
| 16876 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 16877 | if (_res == NULL && PyErr_Occurred()) { |
| 16878 | p->error_indicator = 1; |
| 16879 | D(p->level--); |
| 16880 | return NULL; |
| 16881 | } |
| 16882 | goto done; |
| 16883 | } |
| 16884 | p->mark = _mark; |
| 16885 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16886 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'")); |
| 16887 | } |
| 16888 | { // '(' targets? ')' |
| 16889 | if (p->error_indicator) { |
| 16890 | D(p->level--); |
| 16891 | return NULL; |
| 16892 | } |
| 16893 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); |
| 16894 | Token * _literal; |
| 16895 | Token * _literal_1; |
| 16896 | void *b; |
| 16897 | if ( |
| 16898 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 16899 | && |
| 16900 | (b = targets_rule(p), 1) // targets? |
| 16901 | && |
| 16902 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 16903 | ) |
| 16904 | { |
| 16905 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); |
| 16906 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16907 | if (_token == NULL) { |
| 16908 | D(p->level--); |
| 16909 | return NULL; |
| 16910 | } |
| 16911 | int _end_lineno = _token->end_lineno; |
| 16912 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16913 | int _end_col_offset = _token->end_col_offset; |
| 16914 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16915 | _res = _Py_Tuple ( b , Store , EXTRA ); |
| 16916 | if (_res == NULL && PyErr_Occurred()) { |
| 16917 | p->error_indicator = 1; |
| 16918 | D(p->level--); |
| 16919 | return NULL; |
| 16920 | } |
| 16921 | goto done; |
| 16922 | } |
| 16923 | p->mark = _mark; |
| 16924 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16925 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'")); |
| 16926 | } |
| 16927 | { // '[' targets? ']' |
| 16928 | if (p->error_indicator) { |
| 16929 | D(p->level--); |
| 16930 | return NULL; |
| 16931 | } |
| 16932 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); |
| 16933 | Token * _literal; |
| 16934 | Token * _literal_1; |
| 16935 | void *b; |
| 16936 | if ( |
| 16937 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 16938 | && |
| 16939 | (b = targets_rule(p), 1) // targets? |
| 16940 | && |
| 16941 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
| 16942 | ) |
| 16943 | { |
| 16944 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); |
| 16945 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 16946 | if (_token == NULL) { |
| 16947 | D(p->level--); |
| 16948 | return NULL; |
| 16949 | } |
| 16950 | int _end_lineno = _token->end_lineno; |
| 16951 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 16952 | int _end_col_offset = _token->end_col_offset; |
| 16953 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 16954 | _res = _Py_List ( b , Store , EXTRA ); |
| 16955 | if (_res == NULL && PyErr_Occurred()) { |
| 16956 | p->error_indicator = 1; |
| 16957 | D(p->level--); |
| 16958 | return NULL; |
| 16959 | } |
| 16960 | goto done; |
| 16961 | } |
| 16962 | p->mark = _mark; |
| 16963 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 16964 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'")); |
| 16965 | } |
| 16966 | _res = NULL; |
| 16967 | done: |
| 16968 | D(p->level--); |
| 16969 | return _res; |
| 16970 | } |
| 16971 | |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 16972 | // invalid_arguments: |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16973 | // | args ',' '*' |
| 16974 | // | expression for_if_clauses ',' [args | expression for_if_clauses] |
| 16975 | // | args for_if_clauses |
| 16976 | // | args ',' expression for_if_clauses |
| 16977 | // | args ',' args |
| 16978 | static void * |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 16979 | invalid_arguments_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 16980 | { |
| 16981 | D(p->level++); |
| 16982 | if (p->error_indicator) { |
| 16983 | D(p->level--); |
| 16984 | return NULL; |
| 16985 | } |
| 16986 | void * _res = NULL; |
| 16987 | int _mark = p->mark; |
| 16988 | { // args ',' '*' |
| 16989 | if (p->error_indicator) { |
| 16990 | D(p->level--); |
| 16991 | return NULL; |
| 16992 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 16993 | 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] | 16994 | Token * _literal; |
| 16995 | Token * _literal_1; |
| 16996 | expr_ty args_var; |
| 16997 | if ( |
| 16998 | (args_var = args_rule(p)) // args |
| 16999 | && |
| 17000 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17001 | && |
| 17002 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
| 17003 | ) |
| 17004 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17005 | 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] | 17006 | _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" ); |
| 17007 | if (_res == NULL && PyErr_Occurred()) { |
| 17008 | p->error_indicator = 1; |
| 17009 | D(p->level--); |
| 17010 | return NULL; |
| 17011 | } |
| 17012 | goto done; |
| 17013 | } |
| 17014 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17015 | 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] | 17016 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'")); |
| 17017 | } |
| 17018 | { // expression for_if_clauses ',' [args | expression for_if_clauses] |
| 17019 | if (p->error_indicator) { |
| 17020 | D(p->level--); |
| 17021 | return NULL; |
| 17022 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17023 | 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] | 17024 | Token * _literal; |
| 17025 | void *_opt_var; |
| 17026 | UNUSED(_opt_var); // Silence compiler warnings |
| 17027 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17028 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17029 | if ( |
| 17030 | (a = expression_rule(p)) // expression |
| 17031 | && |
| 17032 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17033 | && |
| 17034 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17035 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17036 | (_opt_var = _tmp_142_rule(p), 1) // [args | expression for_if_clauses] |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17037 | ) |
| 17038 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17039 | 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] | 17040 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); |
| 17041 | if (_res == NULL && PyErr_Occurred()) { |
| 17042 | p->error_indicator = 1; |
| 17043 | D(p->level--); |
| 17044 | return NULL; |
| 17045 | } |
| 17046 | goto done; |
| 17047 | } |
| 17048 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17049 | 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] | 17050 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); |
| 17051 | } |
| 17052 | { // args for_if_clauses |
| 17053 | if (p->error_indicator) { |
| 17054 | D(p->level--); |
| 17055 | return NULL; |
| 17056 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17057 | 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] | 17058 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17059 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17060 | if ( |
| 17061 | (a = args_rule(p)) // args |
| 17062 | && |
| 17063 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17064 | ) |
| 17065 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17066 | 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] | 17067 | _res = _PyPegen_nonparen_genexp_in_call ( p , a ); |
| 17068 | if (_res == NULL && PyErr_Occurred()) { |
| 17069 | p->error_indicator = 1; |
| 17070 | D(p->level--); |
| 17071 | return NULL; |
| 17072 | } |
| 17073 | goto done; |
| 17074 | } |
| 17075 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17076 | 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] | 17077 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses")); |
| 17078 | } |
| 17079 | { // args ',' expression for_if_clauses |
| 17080 | if (p->error_indicator) { |
| 17081 | D(p->level--); |
| 17082 | return NULL; |
| 17083 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17084 | 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] | 17085 | Token * _literal; |
| 17086 | expr_ty a; |
| 17087 | expr_ty args_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17088 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17089 | if ( |
| 17090 | (args_var = args_rule(p)) // args |
| 17091 | && |
| 17092 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17093 | && |
| 17094 | (a = expression_rule(p)) // expression |
| 17095 | && |
| 17096 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17097 | ) |
| 17098 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17099 | 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] | 17100 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); |
| 17101 | if (_res == NULL && PyErr_Occurred()) { |
| 17102 | p->error_indicator = 1; |
| 17103 | D(p->level--); |
| 17104 | return NULL; |
| 17105 | } |
| 17106 | goto done; |
| 17107 | } |
| 17108 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17109 | 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] | 17110 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses")); |
| 17111 | } |
| 17112 | { // args ',' args |
| 17113 | if (p->error_indicator) { |
| 17114 | D(p->level--); |
| 17115 | return NULL; |
| 17116 | } |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17117 | 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] | 17118 | Token * _literal; |
| 17119 | expr_ty a; |
| 17120 | expr_ty args_var; |
| 17121 | if ( |
| 17122 | (a = args_rule(p)) // args |
| 17123 | && |
| 17124 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17125 | && |
| 17126 | (args_var = args_rule(p)) // args |
| 17127 | ) |
| 17128 | { |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17129 | 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] | 17130 | _res = _PyPegen_arguments_parsing_error ( p , a ); |
| 17131 | if (_res == NULL && PyErr_Occurred()) { |
| 17132 | p->error_indicator = 1; |
| 17133 | D(p->level--); |
| 17134 | return NULL; |
| 17135 | } |
| 17136 | goto done; |
| 17137 | } |
| 17138 | p->mark = _mark; |
Lysandros Nikolaou | bca7014 | 2020-10-27 00:42:04 +0200 | [diff] [blame] | 17139 | 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] | 17140 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args")); |
| 17141 | } |
| 17142 | _res = NULL; |
| 17143 | done: |
| 17144 | D(p->level--); |
| 17145 | return _res; |
| 17146 | } |
| 17147 | |
| 17148 | // invalid_kwarg: expression '=' |
| 17149 | static void * |
| 17150 | invalid_kwarg_rule(Parser *p) |
| 17151 | { |
| 17152 | D(p->level++); |
| 17153 | if (p->error_indicator) { |
| 17154 | D(p->level--); |
| 17155 | return NULL; |
| 17156 | } |
| 17157 | void * _res = NULL; |
| 17158 | int _mark = p->mark; |
| 17159 | { // expression '=' |
| 17160 | if (p->error_indicator) { |
| 17161 | D(p->level--); |
| 17162 | return NULL; |
| 17163 | } |
| 17164 | 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] | 17165 | Token * a; |
| 17166 | expr_ty expression_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17167 | if ( |
Pablo Galindo | 43c4fb6 | 2020-12-13 16:46:48 +0000 | [diff] [blame] | 17168 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17169 | && |
Pablo Galindo | 43c4fb6 | 2020-12-13 16:46:48 +0000 | [diff] [blame] | 17170 | (a = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17171 | ) |
| 17172 | { |
| 17173 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='")); |
| 17174 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" ); |
| 17175 | if (_res == NULL && PyErr_Occurred()) { |
| 17176 | p->error_indicator = 1; |
| 17177 | D(p->level--); |
| 17178 | return NULL; |
| 17179 | } |
| 17180 | goto done; |
| 17181 | } |
| 17182 | p->mark = _mark; |
| 17183 | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', |
| 17184 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='")); |
| 17185 | } |
| 17186 | _res = NULL; |
| 17187 | done: |
| 17188 | D(p->level--); |
| 17189 | return _res; |
| 17190 | } |
| 17191 | |
| 17192 | // invalid_named_expression: expression ':=' expression |
| 17193 | static void * |
| 17194 | invalid_named_expression_rule(Parser *p) |
| 17195 | { |
| 17196 | D(p->level++); |
| 17197 | if (p->error_indicator) { |
| 17198 | D(p->level--); |
| 17199 | return NULL; |
| 17200 | } |
| 17201 | void * _res = NULL; |
| 17202 | int _mark = p->mark; |
| 17203 | { // expression ':=' expression |
| 17204 | if (p->error_indicator) { |
| 17205 | D(p->level--); |
| 17206 | return NULL; |
| 17207 | } |
| 17208 | D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); |
| 17209 | Token * _literal; |
| 17210 | expr_ty a; |
| 17211 | expr_ty expression_var; |
| 17212 | if ( |
| 17213 | (a = expression_rule(p)) // expression |
| 17214 | && |
| 17215 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
| 17216 | && |
| 17217 | (expression_var = expression_rule(p)) // expression |
| 17218 | ) |
| 17219 | { |
| 17220 | D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); |
| 17221 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) ); |
| 17222 | if (_res == NULL && PyErr_Occurred()) { |
| 17223 | p->error_indicator = 1; |
| 17224 | D(p->level--); |
| 17225 | return NULL; |
| 17226 | } |
| 17227 | goto done; |
| 17228 | } |
| 17229 | p->mark = _mark; |
| 17230 | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 17231 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression")); |
| 17232 | } |
| 17233 | _res = NULL; |
| 17234 | done: |
| 17235 | D(p->level--); |
| 17236 | return _res; |
| 17237 | } |
| 17238 | |
| 17239 | // invalid_assignment: |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17240 | // | invalid_ann_assign_target ':' expression |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17241 | // | star_named_expression ',' star_named_expressions* ':' expression |
| 17242 | // | expression ':' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17243 | // | ((star_targets '='))* star_expressions '=' |
| 17244 | // | ((star_targets '='))* yield_expr '=' |
| 17245 | // | star_expressions augassign (yield_expr | star_expressions) |
| 17246 | static void * |
| 17247 | invalid_assignment_rule(Parser *p) |
| 17248 | { |
| 17249 | D(p->level++); |
| 17250 | if (p->error_indicator) { |
| 17251 | D(p->level--); |
| 17252 | return NULL; |
| 17253 | } |
| 17254 | void * _res = NULL; |
| 17255 | int _mark = p->mark; |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17256 | { // invalid_ann_assign_target ':' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17257 | if (p->error_indicator) { |
| 17258 | D(p->level--); |
| 17259 | return NULL; |
| 17260 | } |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17261 | 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] | 17262 | Token * _literal; |
| 17263 | expr_ty a; |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17264 | expr_ty expression_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17265 | if ( |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17266 | (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17267 | && |
| 17268 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17269 | && |
| 17270 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17271 | ) |
| 17272 | { |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17273 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression")); |
| 17274 | _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] | 17275 | if (_res == NULL && PyErr_Occurred()) { |
| 17276 | p->error_indicator = 1; |
| 17277 | D(p->level--); |
| 17278 | return NULL; |
| 17279 | } |
| 17280 | goto done; |
| 17281 | } |
| 17282 | p->mark = _mark; |
| 17283 | 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] | 17284 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17285 | } |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17286 | { // star_named_expression ',' star_named_expressions* ':' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17287 | if (p->error_indicator) { |
| 17288 | D(p->level--); |
| 17289 | return NULL; |
| 17290 | } |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17291 | 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] | 17292 | Token * _literal; |
| 17293 | Token * _literal_1; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17294 | asdl_seq * _loop0_143_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17295 | expr_ty a; |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17296 | expr_ty expression_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17297 | if ( |
| 17298 | (a = star_named_expression_rule(p)) // star_named_expression |
| 17299 | && |
| 17300 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17301 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17302 | (_loop0_143_var = _loop0_143_rule(p)) // star_named_expressions* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17303 | && |
| 17304 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17305 | && |
| 17306 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17307 | ) |
| 17308 | { |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17309 | 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] | 17310 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); |
| 17311 | if (_res == NULL && PyErr_Occurred()) { |
| 17312 | p->error_indicator = 1; |
| 17313 | D(p->level--); |
| 17314 | return NULL; |
| 17315 | } |
| 17316 | goto done; |
| 17317 | } |
| 17318 | p->mark = _mark; |
| 17319 | 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] | 17320 | 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] | 17321 | } |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17322 | { // expression ':' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17323 | if (p->error_indicator) { |
| 17324 | D(p->level--); |
| 17325 | return NULL; |
| 17326 | } |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17327 | 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] | 17328 | Token * _literal; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17329 | expr_ty a; |
| 17330 | expr_ty expression_var; |
| 17331 | if ( |
| 17332 | (a = expression_rule(p)) // expression |
| 17333 | && |
| 17334 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 17335 | && |
| 17336 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17337 | ) |
| 17338 | { |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 17339 | 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] | 17340 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" ); |
| 17341 | if (_res == NULL && PyErr_Occurred()) { |
| 17342 | p->error_indicator = 1; |
| 17343 | D(p->level--); |
| 17344 | return NULL; |
| 17345 | } |
| 17346 | goto done; |
| 17347 | } |
| 17348 | p->mark = _mark; |
| 17349 | 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] | 17350 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17351 | } |
| 17352 | { // ((star_targets '='))* star_expressions '=' |
| 17353 | if (p->error_indicator) { |
| 17354 | D(p->level--); |
| 17355 | return NULL; |
| 17356 | } |
| 17357 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
| 17358 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17359 | asdl_seq * _loop0_144_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17360 | expr_ty a; |
| 17361 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17362 | (_loop0_144_var = _loop0_144_rule(p)) // ((star_targets '='))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17363 | && |
| 17364 | (a = star_expressions_rule(p)) // star_expressions |
| 17365 | && |
| 17366 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 17367 | ) |
| 17368 | { |
| 17369 | 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] | 17370 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17371 | if (_res == NULL && PyErr_Occurred()) { |
| 17372 | p->error_indicator = 1; |
| 17373 | D(p->level--); |
| 17374 | return NULL; |
| 17375 | } |
| 17376 | goto done; |
| 17377 | } |
| 17378 | p->mark = _mark; |
| 17379 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 17380 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
| 17381 | } |
| 17382 | { // ((star_targets '='))* yield_expr '=' |
| 17383 | if (p->error_indicator) { |
| 17384 | D(p->level--); |
| 17385 | return NULL; |
| 17386 | } |
| 17387 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
| 17388 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17389 | asdl_seq * _loop0_145_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17390 | expr_ty a; |
| 17391 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17392 | (_loop0_145_var = _loop0_145_rule(p)) // ((star_targets '='))* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17393 | && |
| 17394 | (a = yield_expr_rule(p)) // yield_expr |
| 17395 | && |
| 17396 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 17397 | ) |
| 17398 | { |
| 17399 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
| 17400 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" ); |
| 17401 | if (_res == NULL && PyErr_Occurred()) { |
| 17402 | p->error_indicator = 1; |
| 17403 | D(p->level--); |
| 17404 | return NULL; |
| 17405 | } |
| 17406 | goto done; |
| 17407 | } |
| 17408 | p->mark = _mark; |
| 17409 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 17410 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
| 17411 | } |
| 17412 | { // star_expressions augassign (yield_expr | star_expressions) |
| 17413 | if (p->error_indicator) { |
| 17414 | D(p->level--); |
| 17415 | return NULL; |
| 17416 | } |
| 17417 | 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] | 17418 | void *_tmp_146_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17419 | expr_ty a; |
| 17420 | AugOperator* augassign_var; |
| 17421 | if ( |
| 17422 | (a = star_expressions_rule(p)) // star_expressions |
| 17423 | && |
| 17424 | (augassign_var = augassign_rule(p)) // augassign |
| 17425 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17426 | (_tmp_146_var = _tmp_146_rule(p)) // yield_expr | star_expressions |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17427 | ) |
| 17428 | { |
| 17429 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
| 17430 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) ); |
| 17431 | if (_res == NULL && PyErr_Occurred()) { |
| 17432 | p->error_indicator = 1; |
| 17433 | D(p->level--); |
| 17434 | return NULL; |
| 17435 | } |
| 17436 | goto done; |
| 17437 | } |
| 17438 | p->mark = _mark; |
| 17439 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 17440 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
| 17441 | } |
| 17442 | _res = NULL; |
| 17443 | done: |
| 17444 | D(p->level--); |
| 17445 | return _res; |
| 17446 | } |
| 17447 | |
Batuhan Taskaya | c8f29ad | 2020-06-27 21:33:08 +0300 | [diff] [blame] | 17448 | // invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')' |
| 17449 | static expr_ty |
| 17450 | invalid_ann_assign_target_rule(Parser *p) |
| 17451 | { |
| 17452 | D(p->level++); |
| 17453 | if (p->error_indicator) { |
| 17454 | D(p->level--); |
| 17455 | return NULL; |
| 17456 | } |
| 17457 | expr_ty _res = NULL; |
| 17458 | int _mark = p->mark; |
| 17459 | { // list |
| 17460 | if (p->error_indicator) { |
| 17461 | D(p->level--); |
| 17462 | return NULL; |
| 17463 | } |
| 17464 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); |
| 17465 | expr_ty list_var; |
| 17466 | if ( |
| 17467 | (list_var = list_rule(p)) // list |
| 17468 | ) |
| 17469 | { |
| 17470 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); |
| 17471 | _res = list_var; |
| 17472 | goto done; |
| 17473 | } |
| 17474 | p->mark = _mark; |
| 17475 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 17476 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
| 17477 | } |
| 17478 | { // tuple |
| 17479 | if (p->error_indicator) { |
| 17480 | D(p->level--); |
| 17481 | return NULL; |
| 17482 | } |
| 17483 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); |
| 17484 | expr_ty tuple_var; |
| 17485 | if ( |
| 17486 | (tuple_var = tuple_rule(p)) // tuple |
| 17487 | ) |
| 17488 | { |
| 17489 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); |
| 17490 | _res = tuple_var; |
| 17491 | goto done; |
| 17492 | } |
| 17493 | p->mark = _mark; |
| 17494 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 17495 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
| 17496 | } |
| 17497 | { // '(' invalid_ann_assign_target ')' |
| 17498 | if (p->error_indicator) { |
| 17499 | D(p->level--); |
| 17500 | return NULL; |
| 17501 | } |
| 17502 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
| 17503 | Token * _literal; |
| 17504 | Token * _literal_1; |
| 17505 | expr_ty a; |
| 17506 | if ( |
| 17507 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 17508 | && |
| 17509 | (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target |
| 17510 | && |
| 17511 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 17512 | ) |
| 17513 | { |
| 17514 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
| 17515 | _res = a; |
| 17516 | if (_res == NULL && PyErr_Occurred()) { |
| 17517 | p->error_indicator = 1; |
| 17518 | D(p->level--); |
| 17519 | return NULL; |
| 17520 | } |
| 17521 | goto done; |
| 17522 | } |
| 17523 | p->mark = _mark; |
| 17524 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 17525 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
| 17526 | } |
| 17527 | _res = NULL; |
| 17528 | done: |
| 17529 | D(p->level--); |
| 17530 | return _res; |
| 17531 | } |
| 17532 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 17533 | // invalid_del_stmt: 'del' star_expressions |
| 17534 | static void * |
| 17535 | invalid_del_stmt_rule(Parser *p) |
| 17536 | { |
| 17537 | D(p->level++); |
| 17538 | if (p->error_indicator) { |
| 17539 | D(p->level--); |
| 17540 | return NULL; |
| 17541 | } |
| 17542 | void * _res = NULL; |
| 17543 | int _mark = p->mark; |
| 17544 | { // 'del' star_expressions |
| 17545 | if (p->error_indicator) { |
| 17546 | D(p->level--); |
| 17547 | return NULL; |
| 17548 | } |
| 17549 | D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions")); |
| 17550 | Token * _keyword; |
| 17551 | expr_ty a; |
| 17552 | if ( |
| 17553 | (_keyword = _PyPegen_expect_token(p, 503)) // token='del' |
| 17554 | && |
| 17555 | (a = star_expressions_rule(p)) // star_expressions |
| 17556 | ) |
| 17557 | { |
| 17558 | 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] | 17559 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a ); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 17560 | if (_res == NULL && PyErr_Occurred()) { |
| 17561 | p->error_indicator = 1; |
| 17562 | D(p->level--); |
| 17563 | return NULL; |
| 17564 | } |
| 17565 | goto done; |
| 17566 | } |
| 17567 | p->mark = _mark; |
| 17568 | D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 17569 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions")); |
| 17570 | } |
| 17571 | _res = NULL; |
| 17572 | done: |
| 17573 | D(p->level--); |
| 17574 | return _res; |
| 17575 | } |
| 17576 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17577 | // invalid_block: NEWLINE !INDENT |
| 17578 | static void * |
| 17579 | invalid_block_rule(Parser *p) |
| 17580 | { |
| 17581 | D(p->level++); |
| 17582 | if (p->error_indicator) { |
| 17583 | D(p->level--); |
| 17584 | return NULL; |
| 17585 | } |
| 17586 | void * _res = NULL; |
| 17587 | int _mark = p->mark; |
| 17588 | { // NEWLINE !INDENT |
| 17589 | if (p->error_indicator) { |
| 17590 | D(p->level--); |
| 17591 | return NULL; |
| 17592 | } |
| 17593 | D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); |
| 17594 | Token * newline_var; |
| 17595 | if ( |
| 17596 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 17597 | && |
| 17598 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
| 17599 | ) |
| 17600 | { |
| 17601 | D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); |
| 17602 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block" ); |
| 17603 | if (_res == NULL && PyErr_Occurred()) { |
| 17604 | p->error_indicator = 1; |
| 17605 | D(p->level--); |
| 17606 | return NULL; |
| 17607 | } |
| 17608 | goto done; |
| 17609 | } |
| 17610 | p->mark = _mark; |
| 17611 | D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 17612 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT")); |
| 17613 | } |
| 17614 | _res = NULL; |
| 17615 | done: |
| 17616 | D(p->level--); |
| 17617 | return _res; |
| 17618 | } |
| 17619 | |
Lysandros Nikolaou | 15acc4e | 2020-10-27 20:54:20 +0200 | [diff] [blame] | 17620 | // Left-recursive |
| 17621 | // invalid_primary: primary '{' |
| 17622 | static void * |
| 17623 | invalid_primary_rule(Parser *p) |
| 17624 | { |
| 17625 | D(p->level++); |
| 17626 | if (p->error_indicator) { |
| 17627 | D(p->level--); |
| 17628 | return NULL; |
| 17629 | } |
| 17630 | void * _res = NULL; |
| 17631 | int _mark = p->mark; |
| 17632 | { // primary '{' |
| 17633 | if (p->error_indicator) { |
| 17634 | D(p->level--); |
| 17635 | return NULL; |
| 17636 | } |
| 17637 | D(fprintf(stderr, "%*c> invalid_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '{'")); |
| 17638 | Token * a; |
| 17639 | expr_ty primary_var; |
| 17640 | if ( |
| 17641 | (primary_var = primary_rule(p)) // primary |
| 17642 | && |
| 17643 | (a = _PyPegen_expect_token(p, 25)) // token='{' |
| 17644 | ) |
| 17645 | { |
| 17646 | D(fprintf(stderr, "%*c+ invalid_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '{'")); |
| 17647 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid syntax" ); |
| 17648 | if (_res == NULL && PyErr_Occurred()) { |
| 17649 | p->error_indicator = 1; |
| 17650 | D(p->level--); |
| 17651 | return NULL; |
| 17652 | } |
| 17653 | goto done; |
| 17654 | } |
| 17655 | p->mark = _mark; |
| 17656 | D(fprintf(stderr, "%*c%s invalid_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 17657 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '{'")); |
| 17658 | } |
| 17659 | _res = NULL; |
| 17660 | done: |
| 17661 | D(p->level--); |
| 17662 | return _res; |
| 17663 | } |
| 17664 | |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17665 | // invalid_comprehension: |
| 17666 | // | ('[' | '(' | '{') starred_expression for_if_clauses |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17667 | // | ('[' | '{') star_named_expression ',' star_named_expressions? for_if_clauses |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17668 | static void * |
| 17669 | invalid_comprehension_rule(Parser *p) |
| 17670 | { |
| 17671 | D(p->level++); |
| 17672 | if (p->error_indicator) { |
| 17673 | D(p->level--); |
| 17674 | return NULL; |
| 17675 | } |
| 17676 | void * _res = NULL; |
| 17677 | int _mark = p->mark; |
| 17678 | { // ('[' | '(' | '{') starred_expression for_if_clauses |
| 17679 | if (p->error_indicator) { |
| 17680 | D(p->level--); |
| 17681 | return NULL; |
| 17682 | } |
| 17683 | 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] | 17684 | void *_tmp_147_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17685 | expr_ty a; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17686 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17687 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17688 | (_tmp_147_var = _tmp_147_rule(p)) // '[' | '(' | '{' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17689 | && |
| 17690 | (a = starred_expression_rule(p)) // starred_expression |
| 17691 | && |
| 17692 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17693 | ) |
| 17694 | { |
| 17695 | D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
| 17696 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" ); |
| 17697 | if (_res == NULL && PyErr_Occurred()) { |
| 17698 | p->error_indicator = 1; |
| 17699 | D(p->level--); |
| 17700 | return NULL; |
| 17701 | } |
| 17702 | goto done; |
| 17703 | } |
| 17704 | p->mark = _mark; |
| 17705 | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
| 17706 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
| 17707 | } |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17708 | { // ('[' | '{') star_named_expression ',' star_named_expressions? for_if_clauses |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17709 | if (p->error_indicator) { |
| 17710 | D(p->level--); |
| 17711 | return NULL; |
| 17712 | } |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17713 | 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] | 17714 | Token * _literal; |
| 17715 | void *_opt_var; |
| 17716 | UNUSED(_opt_var); // Silence compiler warnings |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17717 | void *_tmp_148_var; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17718 | expr_ty a; |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17719 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17720 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17721 | (_tmp_148_var = _tmp_148_rule(p)) // '[' | '{' |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17722 | && |
| 17723 | (a = star_named_expression_rule(p)) // star_named_expression |
| 17724 | && |
| 17725 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 17726 | && |
| 17727 | (_opt_var = star_named_expressions_rule(p), 1) // star_named_expressions? |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17728 | && |
| 17729 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 17730 | ) |
| 17731 | { |
Pablo Galindo | d4e6ed7 | 2021-02-03 23:29:26 +0000 | [diff] [blame] | 17732 | 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] | 17733 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "did you forget parentheses around the comprehension target?" ); |
| 17734 | if (_res == NULL && PyErr_Occurred()) { |
| 17735 | p->error_indicator = 1; |
| 17736 | D(p->level--); |
| 17737 | return NULL; |
| 17738 | } |
| 17739 | goto done; |
| 17740 | } |
| 17741 | p->mark = _mark; |
| 17742 | 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] | 17743 | 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] | 17744 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17745 | _res = NULL; |
| 17746 | done: |
| 17747 | D(p->level--); |
| 17748 | return _res; |
| 17749 | } |
| 17750 | |
| 17751 | // invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}' |
| 17752 | static void * |
| 17753 | invalid_dict_comprehension_rule(Parser *p) |
| 17754 | { |
| 17755 | D(p->level++); |
| 17756 | if (p->error_indicator) { |
| 17757 | D(p->level--); |
| 17758 | return NULL; |
| 17759 | } |
| 17760 | void * _res = NULL; |
| 17761 | int _mark = p->mark; |
| 17762 | { // '{' '**' bitwise_or for_if_clauses '}' |
| 17763 | if (p->error_indicator) { |
| 17764 | D(p->level--); |
| 17765 | return NULL; |
| 17766 | } |
| 17767 | D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
| 17768 | Token * _literal; |
| 17769 | Token * _literal_1; |
| 17770 | Token * a; |
| 17771 | expr_ty bitwise_or_var; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 17772 | asdl_comprehension_seq* for_if_clauses_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17773 | if ( |
| 17774 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 17775 | && |
| 17776 | (a = _PyPegen_expect_token(p, 35)) // token='**' |
| 17777 | && |
| 17778 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
| 17779 | && |
| 17780 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 17781 | && |
| 17782 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 17783 | ) |
| 17784 | { |
| 17785 | D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
| 17786 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" ); |
| 17787 | if (_res == NULL && PyErr_Occurred()) { |
| 17788 | p->error_indicator = 1; |
| 17789 | D(p->level--); |
| 17790 | return NULL; |
| 17791 | } |
| 17792 | goto done; |
| 17793 | } |
| 17794 | p->mark = _mark; |
| 17795 | D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
| 17796 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
| 17797 | } |
| 17798 | _res = NULL; |
| 17799 | done: |
| 17800 | D(p->level--); |
| 17801 | return _res; |
| 17802 | } |
| 17803 | |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17804 | // invalid_parameters: param_no_default* invalid_parameters_helper param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17805 | static void * |
| 17806 | invalid_parameters_rule(Parser *p) |
| 17807 | { |
| 17808 | D(p->level++); |
| 17809 | if (p->error_indicator) { |
| 17810 | D(p->level--); |
| 17811 | return NULL; |
| 17812 | } |
| 17813 | void * _res = NULL; |
| 17814 | int _mark = p->mark; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17815 | { // param_no_default* invalid_parameters_helper param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17816 | if (p->error_indicator) { |
| 17817 | D(p->level--); |
| 17818 | return NULL; |
| 17819 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17820 | 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] | 17821 | asdl_seq * _loop0_149_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17822 | void *invalid_parameters_helper_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17823 | arg_ty param_no_default_var; |
| 17824 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17825 | (_loop0_149_var = _loop0_149_rule(p)) // param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17826 | && |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17827 | (invalid_parameters_helper_var = invalid_parameters_helper_rule(p)) // invalid_parameters_helper |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17828 | && |
| 17829 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 17830 | ) |
| 17831 | { |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17832 | 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] | 17833 | _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); |
| 17834 | if (_res == NULL && PyErr_Occurred()) { |
| 17835 | p->error_indicator = 1; |
| 17836 | D(p->level--); |
| 17837 | return NULL; |
| 17838 | } |
| 17839 | goto done; |
| 17840 | } |
| 17841 | p->mark = _mark; |
| 17842 | 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] | 17843 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default")); |
| 17844 | } |
| 17845 | _res = NULL; |
| 17846 | done: |
| 17847 | D(p->level--); |
| 17848 | return _res; |
| 17849 | } |
| 17850 | |
| 17851 | // invalid_parameters_helper: slash_with_default | param_with_default+ |
| 17852 | static void * |
| 17853 | invalid_parameters_helper_rule(Parser *p) |
| 17854 | { |
| 17855 | D(p->level++); |
| 17856 | if (p->error_indicator) { |
| 17857 | D(p->level--); |
| 17858 | return NULL; |
| 17859 | } |
| 17860 | void * _res = NULL; |
| 17861 | int _mark = p->mark; |
| 17862 | { // slash_with_default |
| 17863 | if (p->error_indicator) { |
| 17864 | D(p->level--); |
| 17865 | return NULL; |
| 17866 | } |
| 17867 | D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
| 17868 | SlashWithDefault* a; |
| 17869 | if ( |
| 17870 | (a = slash_with_default_rule(p)) // slash_with_default |
| 17871 | ) |
| 17872 | { |
| 17873 | D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
| 17874 | _res = _PyPegen_singleton_seq ( p , a ); |
| 17875 | if (_res == NULL && PyErr_Occurred()) { |
| 17876 | p->error_indicator = 1; |
| 17877 | D(p->level--); |
| 17878 | return NULL; |
| 17879 | } |
| 17880 | goto done; |
| 17881 | } |
| 17882 | p->mark = _mark; |
| 17883 | D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
| 17884 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); |
| 17885 | } |
| 17886 | { // param_with_default+ |
| 17887 | if (p->error_indicator) { |
| 17888 | D(p->level--); |
| 17889 | return NULL; |
| 17890 | } |
| 17891 | 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] | 17892 | asdl_seq * _loop1_150_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17893 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17894 | (_loop1_150_var = _loop1_150_rule(p)) // param_with_default+ |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17895 | ) |
| 17896 | { |
| 17897 | 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] | 17898 | _res = _loop1_150_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17899 | goto done; |
| 17900 | } |
| 17901 | p->mark = _mark; |
| 17902 | D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
| 17903 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17904 | } |
| 17905 | _res = NULL; |
| 17906 | done: |
| 17907 | D(p->level--); |
| 17908 | return _res; |
| 17909 | } |
| 17910 | |
| 17911 | // invalid_lambda_parameters: |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17912 | // | lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17913 | static void * |
| 17914 | invalid_lambda_parameters_rule(Parser *p) |
| 17915 | { |
| 17916 | D(p->level++); |
| 17917 | if (p->error_indicator) { |
| 17918 | D(p->level--); |
| 17919 | return NULL; |
| 17920 | } |
| 17921 | void * _res = NULL; |
| 17922 | int _mark = p->mark; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17923 | { // lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17924 | if (p->error_indicator) { |
| 17925 | D(p->level--); |
| 17926 | return NULL; |
| 17927 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17928 | 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] | 17929 | asdl_seq * _loop0_151_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17930 | void *invalid_lambda_parameters_helper_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17931 | arg_ty lambda_param_no_default_var; |
| 17932 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 17933 | (_loop0_151_var = _loop0_151_rule(p)) // lambda_param_no_default* |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 17934 | && |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17935 | (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] | 17936 | && |
| 17937 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 17938 | ) |
| 17939 | { |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 17940 | 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] | 17941 | _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); |
| 17942 | if (_res == NULL && PyErr_Occurred()) { |
| 17943 | p->error_indicator = 1; |
| 17944 | D(p->level--); |
| 17945 | return NULL; |
| 17946 | } |
| 17947 | goto done; |
| 17948 | } |
| 17949 | p->mark = _mark; |
| 17950 | 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] | 17951 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); |
| 17952 | } |
| 17953 | _res = NULL; |
| 17954 | done: |
| 17955 | D(p->level--); |
| 17956 | return _res; |
| 17957 | } |
| 17958 | |
| 17959 | // invalid_lambda_parameters_helper: |
| 17960 | // | lambda_slash_with_default |
| 17961 | // | lambda_param_with_default+ |
| 17962 | static void * |
| 17963 | invalid_lambda_parameters_helper_rule(Parser *p) |
| 17964 | { |
| 17965 | D(p->level++); |
| 17966 | if (p->error_indicator) { |
| 17967 | D(p->level--); |
| 17968 | return NULL; |
| 17969 | } |
| 17970 | void * _res = NULL; |
| 17971 | int _mark = p->mark; |
| 17972 | { // lambda_slash_with_default |
| 17973 | if (p->error_indicator) { |
| 17974 | D(p->level--); |
| 17975 | return NULL; |
| 17976 | } |
| 17977 | D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); |
| 17978 | SlashWithDefault* a; |
| 17979 | if ( |
| 17980 | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
| 17981 | ) |
| 17982 | { |
| 17983 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); |
| 17984 | _res = _PyPegen_singleton_seq ( p , a ); |
| 17985 | if (_res == NULL && PyErr_Occurred()) { |
| 17986 | p->error_indicator = 1; |
| 17987 | D(p->level--); |
| 17988 | return NULL; |
| 17989 | } |
| 17990 | goto done; |
| 17991 | } |
| 17992 | p->mark = _mark; |
| 17993 | D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
| 17994 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); |
| 17995 | } |
| 17996 | { // lambda_param_with_default+ |
| 17997 | if (p->error_indicator) { |
| 17998 | D(p->level--); |
| 17999 | return NULL; |
| 18000 | } |
| 18001 | 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] | 18002 | asdl_seq * _loop1_152_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 18003 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18004 | (_loop1_152_var = _loop1_152_rule(p)) // lambda_param_with_default+ |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 18005 | ) |
| 18006 | { |
| 18007 | 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] | 18008 | _res = _loop1_152_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 18009 | goto done; |
| 18010 | } |
| 18011 | p->mark = _mark; |
| 18012 | D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
| 18013 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18014 | } |
| 18015 | _res = NULL; |
| 18016 | done: |
| 18017 | D(p->level--); |
| 18018 | return _res; |
| 18019 | } |
| 18020 | |
| 18021 | // invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT |
| 18022 | static void * |
| 18023 | invalid_star_etc_rule(Parser *p) |
| 18024 | { |
| 18025 | D(p->level++); |
| 18026 | if (p->error_indicator) { |
| 18027 | D(p->level--); |
| 18028 | return NULL; |
| 18029 | } |
| 18030 | void * _res = NULL; |
| 18031 | int _mark = p->mark; |
| 18032 | { // '*' (')' | ',' (')' | '**')) |
| 18033 | if (p->error_indicator) { |
| 18034 | D(p->level--); |
| 18035 | return NULL; |
| 18036 | } |
| 18037 | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
| 18038 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18039 | void *_tmp_153_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18040 | if ( |
| 18041 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 18042 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18043 | (_tmp_153_var = _tmp_153_rule(p)) // ')' | ',' (')' | '**') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18044 | ) |
| 18045 | { |
| 18046 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
| 18047 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
| 18048 | if (_res == NULL && PyErr_Occurred()) { |
| 18049 | p->error_indicator = 1; |
| 18050 | D(p->level--); |
| 18051 | return NULL; |
| 18052 | } |
| 18053 | goto done; |
| 18054 | } |
| 18055 | p->mark = _mark; |
| 18056 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 18057 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
| 18058 | } |
| 18059 | { // '*' ',' TYPE_COMMENT |
| 18060 | if (p->error_indicator) { |
| 18061 | D(p->level--); |
| 18062 | return NULL; |
| 18063 | } |
| 18064 | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
| 18065 | Token * _literal; |
| 18066 | Token * _literal_1; |
| 18067 | Token * type_comment_var; |
| 18068 | if ( |
| 18069 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 18070 | && |
| 18071 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 18072 | && |
| 18073 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 18074 | ) |
| 18075 | { |
| 18076 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
| 18077 | _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" ); |
| 18078 | if (_res == NULL && PyErr_Occurred()) { |
| 18079 | p->error_indicator = 1; |
| 18080 | D(p->level--); |
| 18081 | return NULL; |
| 18082 | } |
| 18083 | goto done; |
| 18084 | } |
| 18085 | p->mark = _mark; |
| 18086 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 18087 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
| 18088 | } |
| 18089 | _res = NULL; |
| 18090 | done: |
| 18091 | D(p->level--); |
| 18092 | return _res; |
| 18093 | } |
| 18094 | |
| 18095 | // invalid_lambda_star_etc: '*' (':' | ',' (':' | '**')) |
| 18096 | static void * |
| 18097 | invalid_lambda_star_etc_rule(Parser *p) |
| 18098 | { |
| 18099 | D(p->level++); |
| 18100 | if (p->error_indicator) { |
| 18101 | D(p->level--); |
| 18102 | return NULL; |
| 18103 | } |
| 18104 | void * _res = NULL; |
| 18105 | int _mark = p->mark; |
| 18106 | { // '*' (':' | ',' (':' | '**')) |
| 18107 | if (p->error_indicator) { |
| 18108 | D(p->level--); |
| 18109 | return NULL; |
| 18110 | } |
| 18111 | D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
| 18112 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18113 | void *_tmp_154_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18114 | if ( |
| 18115 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 18116 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18117 | (_tmp_154_var = _tmp_154_rule(p)) // ':' | ',' (':' | '**') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18118 | ) |
| 18119 | { |
| 18120 | D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
| 18121 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
| 18122 | if (_res == NULL && PyErr_Occurred()) { |
| 18123 | p->error_indicator = 1; |
| 18124 | D(p->level--); |
| 18125 | return NULL; |
| 18126 | } |
| 18127 | goto done; |
| 18128 | } |
| 18129 | p->mark = _mark; |
| 18130 | D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 18131 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
| 18132 | } |
| 18133 | _res = NULL; |
| 18134 | done: |
| 18135 | D(p->level--); |
| 18136 | return _res; |
| 18137 | } |
| 18138 | |
| 18139 | // invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
| 18140 | static void * |
| 18141 | invalid_double_type_comments_rule(Parser *p) |
| 18142 | { |
| 18143 | D(p->level++); |
| 18144 | if (p->error_indicator) { |
| 18145 | D(p->level--); |
| 18146 | return NULL; |
| 18147 | } |
| 18148 | void * _res = NULL; |
| 18149 | int _mark = p->mark; |
| 18150 | { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
| 18151 | if (p->error_indicator) { |
| 18152 | D(p->level--); |
| 18153 | return NULL; |
| 18154 | } |
| 18155 | D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); |
| 18156 | Token * indent_var; |
| 18157 | Token * newline_var; |
| 18158 | Token * newline_var_1; |
| 18159 | Token * type_comment_var; |
| 18160 | Token * type_comment_var_1; |
| 18161 | if ( |
| 18162 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 18163 | && |
| 18164 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 18165 | && |
| 18166 | (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 18167 | && |
| 18168 | (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 18169 | && |
| 18170 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
| 18171 | ) |
| 18172 | { |
| 18173 | 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")); |
| 18174 | _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" ); |
| 18175 | if (_res == NULL && PyErr_Occurred()) { |
| 18176 | p->error_indicator = 1; |
| 18177 | D(p->level--); |
| 18178 | return NULL; |
| 18179 | } |
| 18180 | goto done; |
| 18181 | } |
| 18182 | p->mark = _mark; |
| 18183 | D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ', |
| 18184 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); |
| 18185 | } |
| 18186 | _res = NULL; |
| 18187 | done: |
| 18188 | D(p->level--); |
| 18189 | return _res; |
| 18190 | } |
| 18191 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18192 | // invalid_with_item: expression 'as' expression &(',' | ')' | ':') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18193 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18194 | invalid_with_item_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18195 | { |
| 18196 | D(p->level++); |
| 18197 | if (p->error_indicator) { |
| 18198 | D(p->level--); |
| 18199 | return NULL; |
| 18200 | } |
| 18201 | void * _res = NULL; |
| 18202 | int _mark = p->mark; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18203 | { // expression 'as' expression &(',' | ')' | ':') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18204 | if (p->error_indicator) { |
| 18205 | D(p->level--); |
| 18206 | return NULL; |
| 18207 | } |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18208 | 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] | 18209 | Token * _keyword; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18210 | expr_ty a; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18211 | expr_ty expression_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18212 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18213 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18214 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18215 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 18216 | && |
| 18217 | (a = expression_rule(p)) // expression |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18218 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18219 | _PyPegen_lookahead(1, _tmp_155_rule, p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18220 | ) |
| 18221 | { |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18222 | 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] | 18223 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a ); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18224 | if (_res == NULL && PyErr_Occurred()) { |
| 18225 | p->error_indicator = 1; |
| 18226 | D(p->level--); |
| 18227 | return NULL; |
| 18228 | } |
| 18229 | goto done; |
| 18230 | } |
| 18231 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18232 | 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] | 18233 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18234 | } |
| 18235 | _res = NULL; |
| 18236 | done: |
| 18237 | D(p->level--); |
| 18238 | return _res; |
| 18239 | } |
| 18240 | |
| 18241 | // invalid_for_target: ASYNC? 'for' star_expressions |
| 18242 | static void * |
| 18243 | invalid_for_target_rule(Parser *p) |
| 18244 | { |
| 18245 | D(p->level++); |
| 18246 | if (p->error_indicator) { |
| 18247 | D(p->level--); |
| 18248 | return NULL; |
| 18249 | } |
| 18250 | void * _res = NULL; |
| 18251 | int _mark = p->mark; |
| 18252 | { // ASYNC? 'for' star_expressions |
| 18253 | if (p->error_indicator) { |
| 18254 | D(p->level--); |
| 18255 | return NULL; |
| 18256 | } |
| 18257 | D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions")); |
| 18258 | Token * _keyword; |
| 18259 | void *_opt_var; |
| 18260 | UNUSED(_opt_var); // Silence compiler warnings |
| 18261 | expr_ty a; |
| 18262 | if ( |
| 18263 | (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC? |
| 18264 | && |
| 18265 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 18266 | && |
| 18267 | (a = star_expressions_rule(p)) // star_expressions |
| 18268 | ) |
| 18269 | { |
| 18270 | 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] | 18271 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a ); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 18272 | if (_res == NULL && PyErr_Occurred()) { |
| 18273 | p->error_indicator = 1; |
| 18274 | D(p->level--); |
| 18275 | return NULL; |
| 18276 | } |
| 18277 | goto done; |
| 18278 | } |
| 18279 | p->mark = _mark; |
| 18280 | D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 18281 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions")); |
| 18282 | } |
| 18283 | _res = NULL; |
| 18284 | done: |
| 18285 | D(p->level--); |
| 18286 | return _res; |
| 18287 | } |
| 18288 | |
| 18289 | // invalid_group: '(' starred_expression ')' |
| 18290 | static void * |
| 18291 | invalid_group_rule(Parser *p) |
| 18292 | { |
| 18293 | D(p->level++); |
| 18294 | if (p->error_indicator) { |
| 18295 | D(p->level--); |
| 18296 | return NULL; |
| 18297 | } |
| 18298 | void * _res = NULL; |
| 18299 | int _mark = p->mark; |
| 18300 | { // '(' starred_expression ')' |
| 18301 | if (p->error_indicator) { |
| 18302 | D(p->level--); |
| 18303 | return NULL; |
| 18304 | } |
| 18305 | D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'")); |
| 18306 | Token * _literal; |
| 18307 | Token * _literal_1; |
| 18308 | expr_ty a; |
| 18309 | if ( |
| 18310 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 18311 | && |
| 18312 | (a = starred_expression_rule(p)) // starred_expression |
| 18313 | && |
| 18314 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 18315 | ) |
| 18316 | { |
| 18317 | D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'")); |
| 18318 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" ); |
| 18319 | if (_res == NULL && PyErr_Occurred()) { |
| 18320 | p->error_indicator = 1; |
| 18321 | D(p->level--); |
| 18322 | return NULL; |
| 18323 | } |
| 18324 | goto done; |
| 18325 | } |
| 18326 | p->mark = _mark; |
| 18327 | D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ', |
| 18328 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18329 | } |
| 18330 | _res = NULL; |
| 18331 | done: |
| 18332 | D(p->level--); |
| 18333 | return _res; |
| 18334 | } |
| 18335 | |
| 18336 | // invalid_import_from_targets: import_from_as_names ',' |
| 18337 | static void * |
| 18338 | invalid_import_from_targets_rule(Parser *p) |
| 18339 | { |
| 18340 | D(p->level++); |
| 18341 | if (p->error_indicator) { |
| 18342 | D(p->level--); |
| 18343 | return NULL; |
| 18344 | } |
| 18345 | void * _res = NULL; |
| 18346 | int _mark = p->mark; |
| 18347 | { // import_from_as_names ',' |
| 18348 | if (p->error_indicator) { |
| 18349 | D(p->level--); |
| 18350 | return NULL; |
| 18351 | } |
| 18352 | D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); |
| 18353 | Token * _literal; |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18354 | asdl_alias_seq* import_from_as_names_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18355 | if ( |
| 18356 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
| 18357 | && |
| 18358 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 18359 | ) |
| 18360 | { |
| 18361 | D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); |
| 18362 | _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" ); |
| 18363 | if (_res == NULL && PyErr_Occurred()) { |
| 18364 | p->error_indicator = 1; |
| 18365 | D(p->level--); |
| 18366 | return NULL; |
| 18367 | } |
| 18368 | goto done; |
| 18369 | } |
| 18370 | p->mark = _mark; |
| 18371 | D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 18372 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','")); |
| 18373 | } |
| 18374 | _res = NULL; |
| 18375 | done: |
| 18376 | D(p->level--); |
| 18377 | return _res; |
| 18378 | } |
| 18379 | |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18380 | // invalid_with_stmt: |
| 18381 | // | ASYNC? 'with' ','.(expression ['as' star_target])+ &&':' |
| 18382 | // | ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':' |
| 18383 | static void * |
| 18384 | invalid_with_stmt_rule(Parser *p) |
| 18385 | { |
| 18386 | D(p->level++); |
| 18387 | if (p->error_indicator) { |
| 18388 | D(p->level--); |
| 18389 | return NULL; |
| 18390 | } |
| 18391 | void * _res = NULL; |
| 18392 | int _mark = p->mark; |
| 18393 | { // ASYNC? 'with' ','.(expression ['as' star_target])+ &&':' |
| 18394 | if (p->error_indicator) { |
| 18395 | D(p->level--); |
| 18396 | return NULL; |
| 18397 | } |
| 18398 | 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] | 18399 | asdl_seq * _gather_156_var; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18400 | Token * _keyword; |
| 18401 | Token * _literal; |
| 18402 | void *_opt_var; |
| 18403 | UNUSED(_opt_var); // Silence compiler warnings |
| 18404 | if ( |
| 18405 | (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC? |
| 18406 | && |
| 18407 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 18408 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18409 | (_gather_156_var = _gather_156_rule(p)) // ','.(expression ['as' star_target])+ |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18410 | && |
| 18411 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
| 18412 | ) |
| 18413 | { |
| 18414 | 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] | 18415 | _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _gather_156_var, _literal); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18416 | goto done; |
| 18417 | } |
| 18418 | p->mark = _mark; |
| 18419 | D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 18420 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'")); |
| 18421 | } |
| 18422 | { // ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':' |
| 18423 | if (p->error_indicator) { |
| 18424 | D(p->level--); |
| 18425 | return NULL; |
| 18426 | } |
| 18427 | 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] | 18428 | asdl_seq * _gather_158_var; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18429 | Token * _keyword; |
| 18430 | Token * _literal; |
| 18431 | Token * _literal_1; |
| 18432 | Token * _literal_2; |
| 18433 | void *_opt_var; |
| 18434 | UNUSED(_opt_var); // Silence compiler warnings |
| 18435 | void *_opt_var_1; |
| 18436 | UNUSED(_opt_var_1); // Silence compiler warnings |
| 18437 | if ( |
| 18438 | (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC? |
| 18439 | && |
| 18440 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 18441 | && |
| 18442 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 18443 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18444 | (_gather_158_var = _gather_158_rule(p)) // ','.(expressions ['as' star_target])+ |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 18445 | && |
| 18446 | (_opt_var_1 = _PyPegen_expect_token(p, 12), 1) // ','? |
| 18447 | && |
| 18448 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 18449 | && |
| 18450 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
| 18451 | ) |
| 18452 | { |
| 18453 | 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] | 18454 | _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] | 18455 | goto done; |
| 18456 | } |
| 18457 | p->mark = _mark; |
| 18458 | D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 18459 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'")); |
| 18460 | } |
| 18461 | _res = NULL; |
| 18462 | done: |
| 18463 | D(p->level--); |
| 18464 | return _res; |
| 18465 | } |
| 18466 | |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 18467 | // invalid_except_block: |
| 18468 | // | 'except' expression ',' expressions ['as' NAME] ':' |
| 18469 | // | 'except' expression ['as' NAME] &&':' |
| 18470 | // | 'except' &&':' |
| 18471 | static void * |
| 18472 | invalid_except_block_rule(Parser *p) |
| 18473 | { |
| 18474 | D(p->level++); |
| 18475 | if (p->error_indicator) { |
| 18476 | D(p->level--); |
| 18477 | return NULL; |
| 18478 | } |
| 18479 | void * _res = NULL; |
| 18480 | int _mark = p->mark; |
| 18481 | { // 'except' expression ',' expressions ['as' NAME] ':' |
| 18482 | if (p->error_indicator) { |
| 18483 | D(p->level--); |
| 18484 | return NULL; |
| 18485 | } |
| 18486 | D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); |
| 18487 | Token * _keyword; |
| 18488 | Token * _literal; |
| 18489 | Token * _literal_1; |
| 18490 | void *_opt_var; |
| 18491 | UNUSED(_opt_var); // Silence compiler warnings |
| 18492 | expr_ty a; |
| 18493 | expr_ty expressions_var; |
| 18494 | if ( |
| 18495 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
| 18496 | && |
| 18497 | (a = expression_rule(p)) // expression |
| 18498 | && |
| 18499 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 18500 | && |
| 18501 | (expressions_var = expressions_rule(p)) // expressions |
| 18502 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18503 | (_opt_var = _tmp_160_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 18504 | && |
| 18505 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
| 18506 | ) |
| 18507 | { |
| 18508 | D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); |
| 18509 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "exception group must be parenthesized" ); |
| 18510 | if (_res == NULL && PyErr_Occurred()) { |
| 18511 | p->error_indicator = 1; |
| 18512 | D(p->level--); |
| 18513 | return NULL; |
| 18514 | } |
| 18515 | goto done; |
| 18516 | } |
| 18517 | p->mark = _mark; |
| 18518 | D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 18519 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); |
| 18520 | } |
| 18521 | { // 'except' expression ['as' NAME] &&':' |
| 18522 | if (p->error_indicator) { |
| 18523 | D(p->level--); |
| 18524 | return NULL; |
| 18525 | } |
| 18526 | D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] &&':'")); |
| 18527 | Token * _keyword; |
| 18528 | Token * _literal; |
| 18529 | void *_opt_var; |
| 18530 | UNUSED(_opt_var); // Silence compiler warnings |
| 18531 | expr_ty expression_var; |
| 18532 | if ( |
| 18533 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
| 18534 | && |
| 18535 | (expression_var = expression_rule(p)) // expression |
| 18536 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 18537 | (_opt_var = _tmp_161_rule(p), 1) // ['as' NAME] |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 18538 | && |
| 18539 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
| 18540 | ) |
| 18541 | { |
| 18542 | D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] &&':'")); |
| 18543 | _res = _PyPegen_dummy_name(p, _keyword, expression_var, _opt_var, _literal); |
| 18544 | goto done; |
| 18545 | } |
| 18546 | p->mark = _mark; |
| 18547 | D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 18548 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] &&':'")); |
| 18549 | } |
| 18550 | { // 'except' &&':' |
| 18551 | if (p->error_indicator) { |
| 18552 | D(p->level--); |
| 18553 | return NULL; |
| 18554 | } |
| 18555 | D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' &&':'")); |
| 18556 | Token * _keyword; |
| 18557 | Token * _literal; |
| 18558 | if ( |
| 18559 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
| 18560 | && |
| 18561 | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
| 18562 | ) |
| 18563 | { |
| 18564 | D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' &&':'")); |
| 18565 | _res = _PyPegen_dummy_name(p, _keyword, _literal); |
| 18566 | goto done; |
| 18567 | } |
| 18568 | p->mark = _mark; |
| 18569 | D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 18570 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' &&':'")); |
| 18571 | } |
| 18572 | _res = NULL; |
| 18573 | done: |
| 18574 | D(p->level--); |
| 18575 | return _res; |
| 18576 | } |
| 18577 | |
Pablo Galindo | 08fb8ac | 2021-03-18 01:03:11 +0000 | [diff] [blame] | 18578 | // invalid_match_stmt: "match" subject_expr !':' |
| 18579 | static void * |
| 18580 | invalid_match_stmt_rule(Parser *p) |
| 18581 | { |
| 18582 | D(p->level++); |
| 18583 | if (p->error_indicator) { |
| 18584 | D(p->level--); |
| 18585 | return NULL; |
| 18586 | } |
| 18587 | void * _res = NULL; |
| 18588 | int _mark = p->mark; |
| 18589 | { // "match" subject_expr !':' |
| 18590 | if (p->error_indicator) { |
| 18591 | D(p->level--); |
| 18592 | return NULL; |
| 18593 | } |
| 18594 | D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr !':'")); |
| 18595 | expr_ty _keyword; |
| 18596 | expr_ty subject_expr_var; |
| 18597 | if ( |
| 18598 | (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' |
| 18599 | && |
| 18600 | (subject_expr_var = subject_expr_rule(p)) // subject_expr |
| 18601 | && |
| 18602 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=':' |
| 18603 | ) |
| 18604 | { |
| 18605 | D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr !':'")); |
| 18606 | _res = CHECK_VERSION ( void * , 10 , "Pattern matching is" , RAISE_SYNTAX_ERROR ( "expected ':'" ) ); |
| 18607 | if (_res == NULL && PyErr_Occurred()) { |
| 18608 | p->error_indicator = 1; |
| 18609 | D(p->level--); |
| 18610 | return NULL; |
| 18611 | } |
| 18612 | goto done; |
| 18613 | } |
| 18614 | p->mark = _mark; |
| 18615 | D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 18616 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr !':'")); |
| 18617 | } |
| 18618 | _res = NULL; |
| 18619 | done: |
| 18620 | D(p->level--); |
| 18621 | return _res; |
| 18622 | } |
| 18623 | |
| 18624 | // invalid_case_block: "case" patterns guard? !':' |
| 18625 | static void * |
| 18626 | invalid_case_block_rule(Parser *p) |
| 18627 | { |
| 18628 | D(p->level++); |
| 18629 | if (p->error_indicator) { |
| 18630 | D(p->level--); |
| 18631 | return NULL; |
| 18632 | } |
| 18633 | void * _res = NULL; |
| 18634 | int _mark = p->mark; |
| 18635 | { // "case" patterns guard? !':' |
| 18636 | if (p->error_indicator) { |
| 18637 | D(p->level--); |
| 18638 | return NULL; |
| 18639 | } |
| 18640 | D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? !':'")); |
| 18641 | expr_ty _keyword; |
| 18642 | void *_opt_var; |
| 18643 | UNUSED(_opt_var); // Silence compiler warnings |
| 18644 | expr_ty patterns_var; |
| 18645 | if ( |
| 18646 | (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' |
| 18647 | && |
| 18648 | (patterns_var = patterns_rule(p)) // patterns |
| 18649 | && |
| 18650 | (_opt_var = guard_rule(p), 1) // guard? |
| 18651 | && |
| 18652 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=':' |
| 18653 | ) |
| 18654 | { |
| 18655 | D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? !':'")); |
| 18656 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
| 18657 | if (_res == NULL && PyErr_Occurred()) { |
| 18658 | p->error_indicator = 1; |
| 18659 | D(p->level--); |
| 18660 | return NULL; |
| 18661 | } |
| 18662 | goto done; |
| 18663 | } |
| 18664 | p->mark = _mark; |
| 18665 | D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 18666 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? !':'")); |
| 18667 | } |
| 18668 | _res = NULL; |
| 18669 | done: |
| 18670 | D(p->level--); |
| 18671 | return _res; |
| 18672 | } |
| 18673 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18674 | // _loop0_1: NEWLINE |
| 18675 | static asdl_seq * |
| 18676 | _loop0_1_rule(Parser *p) |
| 18677 | { |
| 18678 | D(p->level++); |
| 18679 | if (p->error_indicator) { |
| 18680 | D(p->level--); |
| 18681 | return NULL; |
| 18682 | } |
| 18683 | void *_res = NULL; |
| 18684 | int _mark = p->mark; |
| 18685 | int _start_mark = p->mark; |
| 18686 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18687 | if (!_children) { |
| 18688 | p->error_indicator = 1; |
| 18689 | PyErr_NoMemory(); |
| 18690 | D(p->level--); |
| 18691 | return NULL; |
| 18692 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 18693 | Py_ssize_t _children_capacity = 1; |
| 18694 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18695 | { // NEWLINE |
| 18696 | if (p->error_indicator) { |
| 18697 | D(p->level--); |
| 18698 | return NULL; |
| 18699 | } |
| 18700 | D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 18701 | Token * newline_var; |
| 18702 | while ( |
| 18703 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 18704 | ) |
| 18705 | { |
| 18706 | _res = newline_var; |
| 18707 | if (_n == _children_capacity) { |
| 18708 | _children_capacity *= 2; |
| 18709 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18710 | if (!_new_children) { |
| 18711 | p->error_indicator = 1; |
| 18712 | PyErr_NoMemory(); |
| 18713 | D(p->level--); |
| 18714 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18715 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18716 | _children = _new_children; |
| 18717 | } |
| 18718 | _children[_n++] = _res; |
| 18719 | _mark = p->mark; |
| 18720 | } |
| 18721 | p->mark = _mark; |
| 18722 | D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ', |
| 18723 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
| 18724 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18725 | 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] | 18726 | if (!_seq) { |
| 18727 | PyMem_Free(_children); |
| 18728 | p->error_indicator = 1; |
| 18729 | PyErr_NoMemory(); |
| 18730 | D(p->level--); |
| 18731 | return NULL; |
| 18732 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18733 | 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] | 18734 | PyMem_Free(_children); |
| 18735 | _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq); |
| 18736 | D(p->level--); |
| 18737 | return _seq; |
| 18738 | } |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18739 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18740 | // _loop0_2: NEWLINE |
| 18741 | static asdl_seq * |
| 18742 | _loop0_2_rule(Parser *p) |
| 18743 | { |
| 18744 | D(p->level++); |
| 18745 | if (p->error_indicator) { |
| 18746 | D(p->level--); |
| 18747 | return NULL; |
| 18748 | } |
| 18749 | void *_res = NULL; |
| 18750 | int _mark = p->mark; |
| 18751 | int _start_mark = p->mark; |
| 18752 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18753 | if (!_children) { |
| 18754 | p->error_indicator = 1; |
| 18755 | PyErr_NoMemory(); |
| 18756 | D(p->level--); |
| 18757 | return NULL; |
| 18758 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 18759 | Py_ssize_t _children_capacity = 1; |
| 18760 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18761 | { // NEWLINE |
| 18762 | if (p->error_indicator) { |
| 18763 | D(p->level--); |
| 18764 | return NULL; |
| 18765 | } |
| 18766 | D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 18767 | Token * newline_var; |
| 18768 | while ( |
| 18769 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 18770 | ) |
| 18771 | { |
| 18772 | _res = newline_var; |
| 18773 | if (_n == _children_capacity) { |
| 18774 | _children_capacity *= 2; |
| 18775 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18776 | if (!_new_children) { |
| 18777 | p->error_indicator = 1; |
| 18778 | PyErr_NoMemory(); |
| 18779 | D(p->level--); |
| 18780 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18781 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18782 | _children = _new_children; |
| 18783 | } |
| 18784 | _children[_n++] = _res; |
| 18785 | _mark = p->mark; |
| 18786 | } |
| 18787 | p->mark = _mark; |
| 18788 | D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ', |
| 18789 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
| 18790 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18791 | 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] | 18792 | if (!_seq) { |
| 18793 | PyMem_Free(_children); |
| 18794 | p->error_indicator = 1; |
| 18795 | PyErr_NoMemory(); |
| 18796 | D(p->level--); |
| 18797 | return NULL; |
| 18798 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18799 | 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] | 18800 | PyMem_Free(_children); |
| 18801 | _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq); |
| 18802 | D(p->level--); |
| 18803 | return _seq; |
| 18804 | } |
| 18805 | |
| 18806 | // _loop0_4: ',' expression |
| 18807 | static asdl_seq * |
| 18808 | _loop0_4_rule(Parser *p) |
| 18809 | { |
| 18810 | D(p->level++); |
| 18811 | if (p->error_indicator) { |
| 18812 | D(p->level--); |
| 18813 | return NULL; |
| 18814 | } |
| 18815 | void *_res = NULL; |
| 18816 | int _mark = p->mark; |
| 18817 | int _start_mark = p->mark; |
| 18818 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18819 | if (!_children) { |
| 18820 | p->error_indicator = 1; |
| 18821 | PyErr_NoMemory(); |
| 18822 | D(p->level--); |
| 18823 | return NULL; |
| 18824 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 18825 | Py_ssize_t _children_capacity = 1; |
| 18826 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18827 | { // ',' expression |
| 18828 | if (p->error_indicator) { |
| 18829 | D(p->level--); |
| 18830 | return NULL; |
| 18831 | } |
| 18832 | D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 18833 | Token * _literal; |
| 18834 | expr_ty elem; |
| 18835 | while ( |
| 18836 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 18837 | && |
| 18838 | (elem = expression_rule(p)) // expression |
| 18839 | ) |
| 18840 | { |
| 18841 | _res = elem; |
| 18842 | if (_res == NULL && PyErr_Occurred()) { |
| 18843 | p->error_indicator = 1; |
| 18844 | PyMem_Free(_children); |
| 18845 | D(p->level--); |
| 18846 | return NULL; |
| 18847 | } |
| 18848 | if (_n == _children_capacity) { |
| 18849 | _children_capacity *= 2; |
| 18850 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18851 | if (!_new_children) { |
| 18852 | p->error_indicator = 1; |
| 18853 | PyErr_NoMemory(); |
| 18854 | D(p->level--); |
| 18855 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18856 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18857 | _children = _new_children; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18858 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18859 | _children[_n++] = _res; |
| 18860 | _mark = p->mark; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18861 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18862 | p->mark = _mark; |
| 18863 | D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ', |
| 18864 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18865 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18866 | 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] | 18867 | if (!_seq) { |
| 18868 | PyMem_Free(_children); |
| 18869 | p->error_indicator = 1; |
| 18870 | PyErr_NoMemory(); |
| 18871 | D(p->level--); |
| 18872 | return NULL; |
| 18873 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18874 | 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] | 18875 | PyMem_Free(_children); |
| 18876 | _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq); |
| 18877 | D(p->level--); |
| 18878 | return _seq; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18879 | } |
| 18880 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18881 | // _gather_3: expression _loop0_4 |
| 18882 | static asdl_seq * |
| 18883 | _gather_3_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18884 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18885 | D(p->level++); |
| 18886 | if (p->error_indicator) { |
| 18887 | D(p->level--); |
| 18888 | return NULL; |
| 18889 | } |
| 18890 | asdl_seq * _res = NULL; |
| 18891 | int _mark = p->mark; |
| 18892 | { // expression _loop0_4 |
| 18893 | if (p->error_indicator) { |
| 18894 | D(p->level--); |
| 18895 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18896 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18897 | D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); |
| 18898 | expr_ty elem; |
| 18899 | asdl_seq * seq; |
| 18900 | if ( |
| 18901 | (elem = expression_rule(p)) // expression |
| 18902 | && |
| 18903 | (seq = _loop0_4_rule(p)) // _loop0_4 |
| 18904 | ) |
| 18905 | { |
| 18906 | D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); |
| 18907 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 18908 | goto done; |
| 18909 | } |
| 18910 | p->mark = _mark; |
| 18911 | D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ', |
| 18912 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4")); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18913 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18914 | _res = NULL; |
| 18915 | done: |
| 18916 | D(p->level--); |
| 18917 | return _res; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18918 | } |
| 18919 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18920 | // _loop0_6: ',' expression |
| 18921 | static asdl_seq * |
| 18922 | _loop0_6_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18923 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18924 | D(p->level++); |
| 18925 | if (p->error_indicator) { |
| 18926 | D(p->level--); |
| 18927 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18928 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18929 | void *_res = NULL; |
| 18930 | int _mark = p->mark; |
| 18931 | int _start_mark = p->mark; |
| 18932 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18933 | if (!_children) { |
| 18934 | p->error_indicator = 1; |
| 18935 | PyErr_NoMemory(); |
| 18936 | D(p->level--); |
| 18937 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 18938 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 18939 | Py_ssize_t _children_capacity = 1; |
| 18940 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18941 | { // ',' expression |
| 18942 | if (p->error_indicator) { |
| 18943 | D(p->level--); |
| 18944 | return NULL; |
| 18945 | } |
| 18946 | D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 18947 | Token * _literal; |
| 18948 | expr_ty elem; |
| 18949 | while ( |
| 18950 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 18951 | && |
| 18952 | (elem = expression_rule(p)) // expression |
| 18953 | ) |
| 18954 | { |
| 18955 | _res = elem; |
| 18956 | if (_res == NULL && PyErr_Occurred()) { |
| 18957 | p->error_indicator = 1; |
| 18958 | PyMem_Free(_children); |
| 18959 | D(p->level--); |
| 18960 | return NULL; |
| 18961 | } |
| 18962 | if (_n == _children_capacity) { |
| 18963 | _children_capacity *= 2; |
| 18964 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18965 | if (!_new_children) { |
| 18966 | p->error_indicator = 1; |
| 18967 | PyErr_NoMemory(); |
| 18968 | D(p->level--); |
| 18969 | return NULL; |
| 18970 | } |
| 18971 | _children = _new_children; |
| 18972 | } |
| 18973 | _children[_n++] = _res; |
| 18974 | _mark = p->mark; |
| 18975 | } |
| 18976 | p->mark = _mark; |
| 18977 | D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ', |
| 18978 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 18979 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18980 | 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] | 18981 | if (!_seq) { |
| 18982 | PyMem_Free(_children); |
| 18983 | p->error_indicator = 1; |
| 18984 | PyErr_NoMemory(); |
| 18985 | D(p->level--); |
| 18986 | return NULL; |
| 18987 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 18988 | 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] | 18989 | PyMem_Free(_children); |
| 18990 | _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq); |
| 18991 | D(p->level--); |
| 18992 | return _seq; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18993 | } |
| 18994 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18995 | // _gather_5: expression _loop0_6 |
| 18996 | static asdl_seq * |
| 18997 | _gather_5_rule(Parser *p) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 18998 | { |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 18999 | D(p->level++); |
| 19000 | if (p->error_indicator) { |
| 19001 | D(p->level--); |
| 19002 | return NULL; |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 19003 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19004 | asdl_seq * _res = NULL; |
| 19005 | int _mark = p->mark; |
| 19006 | { // expression _loop0_6 |
| 19007 | if (p->error_indicator) { |
| 19008 | D(p->level--); |
| 19009 | return NULL; |
| 19010 | } |
| 19011 | D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); |
| 19012 | expr_ty elem; |
| 19013 | asdl_seq * seq; |
| 19014 | if ( |
| 19015 | (elem = expression_rule(p)) // expression |
| 19016 | && |
| 19017 | (seq = _loop0_6_rule(p)) // _loop0_6 |
| 19018 | ) |
| 19019 | { |
| 19020 | D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); |
| 19021 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 19022 | goto done; |
| 19023 | } |
| 19024 | p->mark = _mark; |
| 19025 | D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ', |
| 19026 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6")); |
| 19027 | } |
| 19028 | _res = NULL; |
| 19029 | done: |
| 19030 | D(p->level--); |
| 19031 | return _res; |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19032 | } |
| 19033 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19034 | // _loop0_8: ',' expression |
| 19035 | static asdl_seq * |
| 19036 | _loop0_8_rule(Parser *p) |
| 19037 | { |
| 19038 | D(p->level++); |
| 19039 | if (p->error_indicator) { |
| 19040 | D(p->level--); |
| 19041 | return NULL; |
| 19042 | } |
| 19043 | void *_res = NULL; |
| 19044 | int _mark = p->mark; |
| 19045 | int _start_mark = p->mark; |
| 19046 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19047 | if (!_children) { |
| 19048 | p->error_indicator = 1; |
| 19049 | PyErr_NoMemory(); |
| 19050 | D(p->level--); |
| 19051 | return NULL; |
| 19052 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19053 | Py_ssize_t _children_capacity = 1; |
| 19054 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19055 | { // ',' expression |
| 19056 | if (p->error_indicator) { |
| 19057 | D(p->level--); |
| 19058 | return NULL; |
| 19059 | } |
| 19060 | D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 19061 | Token * _literal; |
| 19062 | expr_ty elem; |
| 19063 | while ( |
| 19064 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 19065 | && |
| 19066 | (elem = expression_rule(p)) // expression |
| 19067 | ) |
| 19068 | { |
| 19069 | _res = elem; |
| 19070 | if (_res == NULL && PyErr_Occurred()) { |
| 19071 | p->error_indicator = 1; |
| 19072 | PyMem_Free(_children); |
| 19073 | D(p->level--); |
| 19074 | return NULL; |
| 19075 | } |
| 19076 | if (_n == _children_capacity) { |
| 19077 | _children_capacity *= 2; |
| 19078 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19079 | if (!_new_children) { |
| 19080 | p->error_indicator = 1; |
| 19081 | PyErr_NoMemory(); |
| 19082 | D(p->level--); |
| 19083 | return NULL; |
| 19084 | } |
| 19085 | _children = _new_children; |
| 19086 | } |
| 19087 | _children[_n++] = _res; |
| 19088 | _mark = p->mark; |
| 19089 | } |
| 19090 | p->mark = _mark; |
| 19091 | D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ', |
| 19092 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 19093 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19094 | 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] | 19095 | if (!_seq) { |
| 19096 | PyMem_Free(_children); |
| 19097 | p->error_indicator = 1; |
| 19098 | PyErr_NoMemory(); |
| 19099 | D(p->level--); |
| 19100 | return NULL; |
| 19101 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19102 | 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] | 19103 | PyMem_Free(_children); |
| 19104 | _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq); |
| 19105 | D(p->level--); |
| 19106 | return _seq; |
| 19107 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19108 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19109 | // _gather_7: expression _loop0_8 |
| 19110 | static asdl_seq * |
| 19111 | _gather_7_rule(Parser *p) |
| 19112 | { |
| 19113 | D(p->level++); |
| 19114 | if (p->error_indicator) { |
| 19115 | D(p->level--); |
| 19116 | return NULL; |
| 19117 | } |
| 19118 | asdl_seq * _res = NULL; |
| 19119 | int _mark = p->mark; |
| 19120 | { // expression _loop0_8 |
| 19121 | if (p->error_indicator) { |
| 19122 | D(p->level--); |
| 19123 | return NULL; |
| 19124 | } |
| 19125 | D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); |
| 19126 | expr_ty elem; |
| 19127 | asdl_seq * seq; |
| 19128 | if ( |
| 19129 | (elem = expression_rule(p)) // expression |
| 19130 | && |
| 19131 | (seq = _loop0_8_rule(p)) // _loop0_8 |
| 19132 | ) |
| 19133 | { |
| 19134 | D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); |
| 19135 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 19136 | goto done; |
| 19137 | } |
| 19138 | p->mark = _mark; |
| 19139 | D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ', |
| 19140 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8")); |
| 19141 | } |
| 19142 | _res = NULL; |
| 19143 | done: |
| 19144 | D(p->level--); |
| 19145 | return _res; |
| 19146 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19147 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19148 | // _loop0_10: ',' expression |
| 19149 | static asdl_seq * |
| 19150 | _loop0_10_rule(Parser *p) |
| 19151 | { |
| 19152 | D(p->level++); |
| 19153 | if (p->error_indicator) { |
| 19154 | D(p->level--); |
| 19155 | return NULL; |
| 19156 | } |
| 19157 | void *_res = NULL; |
| 19158 | int _mark = p->mark; |
| 19159 | int _start_mark = p->mark; |
| 19160 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19161 | if (!_children) { |
| 19162 | p->error_indicator = 1; |
| 19163 | PyErr_NoMemory(); |
| 19164 | D(p->level--); |
| 19165 | return NULL; |
| 19166 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19167 | Py_ssize_t _children_capacity = 1; |
| 19168 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19169 | { // ',' expression |
| 19170 | if (p->error_indicator) { |
| 19171 | D(p->level--); |
| 19172 | return NULL; |
| 19173 | } |
| 19174 | D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 19175 | Token * _literal; |
| 19176 | expr_ty elem; |
| 19177 | while ( |
| 19178 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 19179 | && |
| 19180 | (elem = expression_rule(p)) // expression |
| 19181 | ) |
| 19182 | { |
| 19183 | _res = elem; |
| 19184 | if (_res == NULL && PyErr_Occurred()) { |
| 19185 | p->error_indicator = 1; |
| 19186 | PyMem_Free(_children); |
| 19187 | D(p->level--); |
| 19188 | return NULL; |
| 19189 | } |
| 19190 | if (_n == _children_capacity) { |
| 19191 | _children_capacity *= 2; |
| 19192 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19193 | if (!_new_children) { |
| 19194 | p->error_indicator = 1; |
| 19195 | PyErr_NoMemory(); |
| 19196 | D(p->level--); |
| 19197 | return NULL; |
| 19198 | } |
| 19199 | _children = _new_children; |
| 19200 | } |
| 19201 | _children[_n++] = _res; |
| 19202 | _mark = p->mark; |
| 19203 | } |
| 19204 | p->mark = _mark; |
| 19205 | D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ', |
| 19206 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 19207 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19208 | 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] | 19209 | if (!_seq) { |
| 19210 | PyMem_Free(_children); |
| 19211 | p->error_indicator = 1; |
| 19212 | PyErr_NoMemory(); |
| 19213 | D(p->level--); |
| 19214 | return NULL; |
| 19215 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19216 | 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] | 19217 | PyMem_Free(_children); |
| 19218 | _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq); |
| 19219 | D(p->level--); |
| 19220 | return _seq; |
| 19221 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19222 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19223 | // _gather_9: expression _loop0_10 |
| 19224 | static asdl_seq * |
| 19225 | _gather_9_rule(Parser *p) |
| 19226 | { |
| 19227 | D(p->level++); |
| 19228 | if (p->error_indicator) { |
| 19229 | D(p->level--); |
| 19230 | return NULL; |
| 19231 | } |
| 19232 | asdl_seq * _res = NULL; |
| 19233 | int _mark = p->mark; |
| 19234 | { // expression _loop0_10 |
| 19235 | if (p->error_indicator) { |
| 19236 | D(p->level--); |
| 19237 | return NULL; |
| 19238 | } |
| 19239 | D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); |
| 19240 | expr_ty elem; |
| 19241 | asdl_seq * seq; |
| 19242 | if ( |
| 19243 | (elem = expression_rule(p)) // expression |
| 19244 | && |
| 19245 | (seq = _loop0_10_rule(p)) // _loop0_10 |
| 19246 | ) |
| 19247 | { |
| 19248 | D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); |
| 19249 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 19250 | goto done; |
| 19251 | } |
| 19252 | p->mark = _mark; |
| 19253 | D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ', |
| 19254 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10")); |
| 19255 | } |
| 19256 | _res = NULL; |
| 19257 | done: |
| 19258 | D(p->level--); |
| 19259 | return _res; |
| 19260 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19261 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19262 | // _loop1_11: statement |
| 19263 | static asdl_seq * |
| 19264 | _loop1_11_rule(Parser *p) |
| 19265 | { |
| 19266 | D(p->level++); |
| 19267 | if (p->error_indicator) { |
| 19268 | D(p->level--); |
| 19269 | return NULL; |
| 19270 | } |
| 19271 | void *_res = NULL; |
| 19272 | int _mark = p->mark; |
| 19273 | int _start_mark = p->mark; |
| 19274 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19275 | if (!_children) { |
| 19276 | p->error_indicator = 1; |
| 19277 | PyErr_NoMemory(); |
| 19278 | D(p->level--); |
| 19279 | return NULL; |
| 19280 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19281 | Py_ssize_t _children_capacity = 1; |
| 19282 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19283 | { // statement |
| 19284 | if (p->error_indicator) { |
| 19285 | D(p->level--); |
| 19286 | return NULL; |
| 19287 | } |
| 19288 | 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] | 19289 | asdl_stmt_seq* statement_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19290 | while ( |
| 19291 | (statement_var = statement_rule(p)) // statement |
| 19292 | ) |
| 19293 | { |
| 19294 | _res = statement_var; |
| 19295 | if (_n == _children_capacity) { |
| 19296 | _children_capacity *= 2; |
| 19297 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19298 | if (!_new_children) { |
| 19299 | p->error_indicator = 1; |
| 19300 | PyErr_NoMemory(); |
| 19301 | D(p->level--); |
| 19302 | return NULL; |
| 19303 | } |
| 19304 | _children = _new_children; |
| 19305 | } |
| 19306 | _children[_n++] = _res; |
| 19307 | _mark = p->mark; |
| 19308 | } |
| 19309 | p->mark = _mark; |
| 19310 | D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ', |
| 19311 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement")); |
| 19312 | } |
| 19313 | if (_n == 0 || p->error_indicator) { |
| 19314 | PyMem_Free(_children); |
| 19315 | D(p->level--); |
| 19316 | return NULL; |
| 19317 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19318 | 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] | 19319 | if (!_seq) { |
| 19320 | PyMem_Free(_children); |
| 19321 | p->error_indicator = 1; |
| 19322 | PyErr_NoMemory(); |
| 19323 | D(p->level--); |
| 19324 | return NULL; |
| 19325 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19326 | 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] | 19327 | PyMem_Free(_children); |
| 19328 | _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq); |
| 19329 | D(p->level--); |
| 19330 | return _seq; |
| 19331 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19332 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19333 | // _loop0_13: ';' simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19334 | static asdl_seq * |
| 19335 | _loop0_13_rule(Parser *p) |
| 19336 | { |
| 19337 | D(p->level++); |
| 19338 | if (p->error_indicator) { |
| 19339 | D(p->level--); |
| 19340 | return NULL; |
| 19341 | } |
| 19342 | void *_res = NULL; |
| 19343 | int _mark = p->mark; |
| 19344 | int _start_mark = p->mark; |
| 19345 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19346 | if (!_children) { |
| 19347 | p->error_indicator = 1; |
| 19348 | PyErr_NoMemory(); |
| 19349 | D(p->level--); |
| 19350 | return NULL; |
| 19351 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19352 | Py_ssize_t _children_capacity = 1; |
| 19353 | Py_ssize_t _n = 0; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19354 | { // ';' simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19355 | if (p->error_indicator) { |
| 19356 | D(p->level--); |
| 19357 | return NULL; |
| 19358 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19359 | 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] | 19360 | Token * _literal; |
| 19361 | stmt_ty elem; |
| 19362 | while ( |
| 19363 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
| 19364 | && |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19365 | (elem = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19366 | ) |
| 19367 | { |
| 19368 | _res = elem; |
| 19369 | if (_res == NULL && PyErr_Occurred()) { |
| 19370 | p->error_indicator = 1; |
| 19371 | PyMem_Free(_children); |
| 19372 | D(p->level--); |
| 19373 | return NULL; |
| 19374 | } |
| 19375 | if (_n == _children_capacity) { |
| 19376 | _children_capacity *= 2; |
| 19377 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19378 | if (!_new_children) { |
| 19379 | p->error_indicator = 1; |
| 19380 | PyErr_NoMemory(); |
| 19381 | D(p->level--); |
| 19382 | return NULL; |
| 19383 | } |
| 19384 | _children = _new_children; |
| 19385 | } |
| 19386 | _children[_n++] = _res; |
| 19387 | _mark = p->mark; |
| 19388 | } |
| 19389 | p->mark = _mark; |
| 19390 | 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] | 19391 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' simple_stmt")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19392 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19393 | 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] | 19394 | if (!_seq) { |
| 19395 | PyMem_Free(_children); |
| 19396 | p->error_indicator = 1; |
| 19397 | PyErr_NoMemory(); |
| 19398 | D(p->level--); |
| 19399 | return NULL; |
| 19400 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19401 | 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] | 19402 | PyMem_Free(_children); |
| 19403 | _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq); |
| 19404 | D(p->level--); |
| 19405 | return _seq; |
| 19406 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19407 | |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19408 | // _gather_12: simple_stmt _loop0_13 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19409 | static asdl_seq * |
| 19410 | _gather_12_rule(Parser *p) |
| 19411 | { |
| 19412 | D(p->level++); |
| 19413 | if (p->error_indicator) { |
| 19414 | D(p->level--); |
| 19415 | return NULL; |
| 19416 | } |
| 19417 | asdl_seq * _res = NULL; |
| 19418 | int _mark = p->mark; |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19419 | { // simple_stmt _loop0_13 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19420 | if (p->error_indicator) { |
| 19421 | D(p->level--); |
| 19422 | return NULL; |
| 19423 | } |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19424 | 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] | 19425 | stmt_ty elem; |
| 19426 | asdl_seq * seq; |
| 19427 | if ( |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19428 | (elem = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19429 | && |
| 19430 | (seq = _loop0_13_rule(p)) // _loop0_13 |
| 19431 | ) |
| 19432 | { |
Pablo Galindo | 9bdc40e | 2020-11-30 19:42:38 +0000 | [diff] [blame] | 19433 | 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] | 19434 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 19435 | goto done; |
| 19436 | } |
| 19437 | p->mark = _mark; |
| 19438 | 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] | 19439 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_13")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19440 | } |
| 19441 | _res = NULL; |
| 19442 | done: |
| 19443 | D(p->level--); |
| 19444 | return _res; |
| 19445 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19446 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19447 | // _tmp_14: 'import' | 'from' |
| 19448 | static void * |
| 19449 | _tmp_14_rule(Parser *p) |
| 19450 | { |
| 19451 | D(p->level++); |
| 19452 | if (p->error_indicator) { |
| 19453 | D(p->level--); |
| 19454 | return NULL; |
| 19455 | } |
| 19456 | void * _res = NULL; |
| 19457 | int _mark = p->mark; |
| 19458 | { // 'import' |
| 19459 | if (p->error_indicator) { |
| 19460 | D(p->level--); |
| 19461 | return NULL; |
| 19462 | } |
| 19463 | D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'")); |
| 19464 | Token * _keyword; |
| 19465 | if ( |
| 19466 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
| 19467 | ) |
| 19468 | { |
| 19469 | D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'")); |
| 19470 | _res = _keyword; |
| 19471 | goto done; |
| 19472 | } |
| 19473 | p->mark = _mark; |
| 19474 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', |
| 19475 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'")); |
| 19476 | } |
| 19477 | { // 'from' |
| 19478 | if (p->error_indicator) { |
| 19479 | D(p->level--); |
| 19480 | return NULL; |
| 19481 | } |
| 19482 | D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'")); |
| 19483 | Token * _keyword; |
| 19484 | if ( |
| 19485 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
| 19486 | ) |
| 19487 | { |
| 19488 | D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'")); |
| 19489 | _res = _keyword; |
| 19490 | goto done; |
| 19491 | } |
| 19492 | p->mark = _mark; |
| 19493 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', |
| 19494 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'")); |
| 19495 | } |
| 19496 | _res = NULL; |
| 19497 | done: |
| 19498 | D(p->level--); |
| 19499 | return _res; |
| 19500 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19501 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19502 | // _tmp_15: 'def' | '@' | ASYNC |
| 19503 | static void * |
| 19504 | _tmp_15_rule(Parser *p) |
| 19505 | { |
| 19506 | D(p->level++); |
| 19507 | if (p->error_indicator) { |
| 19508 | D(p->level--); |
| 19509 | return NULL; |
| 19510 | } |
| 19511 | void * _res = NULL; |
| 19512 | int _mark = p->mark; |
| 19513 | { // 'def' |
| 19514 | if (p->error_indicator) { |
| 19515 | D(p->level--); |
| 19516 | return NULL; |
| 19517 | } |
| 19518 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); |
| 19519 | Token * _keyword; |
| 19520 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19521 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19522 | ) |
| 19523 | { |
| 19524 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); |
| 19525 | _res = _keyword; |
| 19526 | goto done; |
| 19527 | } |
| 19528 | p->mark = _mark; |
| 19529 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 19530 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'")); |
| 19531 | } |
| 19532 | { // '@' |
| 19533 | if (p->error_indicator) { |
| 19534 | D(p->level--); |
| 19535 | return NULL; |
| 19536 | } |
| 19537 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
| 19538 | Token * _literal; |
| 19539 | if ( |
| 19540 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
| 19541 | ) |
| 19542 | { |
| 19543 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
| 19544 | _res = _literal; |
| 19545 | goto done; |
| 19546 | } |
| 19547 | p->mark = _mark; |
| 19548 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 19549 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
| 19550 | } |
| 19551 | { // ASYNC |
| 19552 | if (p->error_indicator) { |
| 19553 | D(p->level--); |
| 19554 | return NULL; |
| 19555 | } |
| 19556 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19557 | Token * async_var; |
| 19558 | if ( |
| 19559 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 19560 | ) |
| 19561 | { |
| 19562 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19563 | _res = async_var; |
| 19564 | goto done; |
| 19565 | } |
| 19566 | p->mark = _mark; |
| 19567 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 19568 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
| 19569 | } |
| 19570 | _res = NULL; |
| 19571 | done: |
| 19572 | D(p->level--); |
| 19573 | return _res; |
| 19574 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19575 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19576 | // _tmp_16: 'class' | '@' |
| 19577 | static void * |
| 19578 | _tmp_16_rule(Parser *p) |
| 19579 | { |
| 19580 | D(p->level++); |
| 19581 | if (p->error_indicator) { |
| 19582 | D(p->level--); |
| 19583 | return NULL; |
| 19584 | } |
| 19585 | void * _res = NULL; |
| 19586 | int _mark = p->mark; |
| 19587 | { // 'class' |
| 19588 | if (p->error_indicator) { |
| 19589 | D(p->level--); |
| 19590 | return NULL; |
| 19591 | } |
| 19592 | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); |
| 19593 | Token * _keyword; |
| 19594 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19595 | (_keyword = _PyPegen_expect_token(p, 527)) // token='class' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19596 | ) |
| 19597 | { |
| 19598 | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); |
| 19599 | _res = _keyword; |
| 19600 | goto done; |
| 19601 | } |
| 19602 | p->mark = _mark; |
| 19603 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
| 19604 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'")); |
| 19605 | } |
| 19606 | { // '@' |
| 19607 | if (p->error_indicator) { |
| 19608 | D(p->level--); |
| 19609 | return NULL; |
| 19610 | } |
| 19611 | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
| 19612 | Token * _literal; |
| 19613 | if ( |
| 19614 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
| 19615 | ) |
| 19616 | { |
| 19617 | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
| 19618 | _res = _literal; |
| 19619 | goto done; |
| 19620 | } |
| 19621 | p->mark = _mark; |
| 19622 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
| 19623 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
| 19624 | } |
| 19625 | _res = NULL; |
| 19626 | done: |
| 19627 | D(p->level--); |
| 19628 | return _res; |
| 19629 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19630 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19631 | // _tmp_17: 'with' | ASYNC |
| 19632 | static void * |
| 19633 | _tmp_17_rule(Parser *p) |
| 19634 | { |
| 19635 | D(p->level++); |
| 19636 | if (p->error_indicator) { |
| 19637 | D(p->level--); |
| 19638 | return NULL; |
| 19639 | } |
| 19640 | void * _res = NULL; |
| 19641 | int _mark = p->mark; |
| 19642 | { // 'with' |
| 19643 | if (p->error_indicator) { |
| 19644 | D(p->level--); |
| 19645 | return NULL; |
| 19646 | } |
| 19647 | D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'")); |
| 19648 | Token * _keyword; |
| 19649 | if ( |
| 19650 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
| 19651 | ) |
| 19652 | { |
| 19653 | D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'")); |
| 19654 | _res = _keyword; |
| 19655 | goto done; |
| 19656 | } |
| 19657 | p->mark = _mark; |
| 19658 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', |
| 19659 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'")); |
| 19660 | } |
| 19661 | { // ASYNC |
| 19662 | if (p->error_indicator) { |
| 19663 | D(p->level--); |
| 19664 | return NULL; |
| 19665 | } |
| 19666 | D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19667 | Token * async_var; |
| 19668 | if ( |
| 19669 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 19670 | ) |
| 19671 | { |
| 19672 | D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19673 | _res = async_var; |
| 19674 | goto done; |
| 19675 | } |
| 19676 | p->mark = _mark; |
| 19677 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', |
| 19678 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
| 19679 | } |
| 19680 | _res = NULL; |
| 19681 | done: |
| 19682 | D(p->level--); |
| 19683 | return _res; |
| 19684 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19685 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19686 | // _tmp_18: 'for' | ASYNC |
| 19687 | static void * |
| 19688 | _tmp_18_rule(Parser *p) |
| 19689 | { |
| 19690 | D(p->level++); |
| 19691 | if (p->error_indicator) { |
| 19692 | D(p->level--); |
| 19693 | return NULL; |
| 19694 | } |
| 19695 | void * _res = NULL; |
| 19696 | int _mark = p->mark; |
| 19697 | { // 'for' |
| 19698 | if (p->error_indicator) { |
| 19699 | D(p->level--); |
| 19700 | return NULL; |
| 19701 | } |
| 19702 | D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); |
| 19703 | Token * _keyword; |
| 19704 | if ( |
| 19705 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
| 19706 | ) |
| 19707 | { |
| 19708 | D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); |
| 19709 | _res = _keyword; |
| 19710 | goto done; |
| 19711 | } |
| 19712 | p->mark = _mark; |
| 19713 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', |
| 19714 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'")); |
| 19715 | } |
| 19716 | { // ASYNC |
| 19717 | if (p->error_indicator) { |
| 19718 | D(p->level--); |
| 19719 | return NULL; |
| 19720 | } |
| 19721 | D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19722 | Token * async_var; |
| 19723 | if ( |
| 19724 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
| 19725 | ) |
| 19726 | { |
| 19727 | D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
| 19728 | _res = async_var; |
| 19729 | goto done; |
| 19730 | } |
| 19731 | p->mark = _mark; |
| 19732 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', |
| 19733 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
| 19734 | } |
| 19735 | _res = NULL; |
| 19736 | done: |
| 19737 | D(p->level--); |
| 19738 | return _res; |
| 19739 | } |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19740 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19741 | // _tmp_19: '=' annotated_rhs |
| 19742 | static void * |
| 19743 | _tmp_19_rule(Parser *p) |
| 19744 | { |
| 19745 | D(p->level++); |
| 19746 | if (p->error_indicator) { |
| 19747 | D(p->level--); |
| 19748 | return NULL; |
| 19749 | } |
| 19750 | void * _res = NULL; |
| 19751 | int _mark = p->mark; |
| 19752 | { // '=' annotated_rhs |
| 19753 | if (p->error_indicator) { |
| 19754 | D(p->level--); |
| 19755 | return NULL; |
| 19756 | } |
| 19757 | D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
| 19758 | Token * _literal; |
| 19759 | expr_ty d; |
| 19760 | if ( |
| 19761 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 19762 | && |
| 19763 | (d = annotated_rhs_rule(p)) // annotated_rhs |
| 19764 | ) |
| 19765 | { |
| 19766 | D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
| 19767 | _res = d; |
| 19768 | if (_res == NULL && PyErr_Occurred()) { |
| 19769 | p->error_indicator = 1; |
| 19770 | D(p->level--); |
| 19771 | return NULL; |
| 19772 | } |
| 19773 | goto done; |
| 19774 | } |
| 19775 | p->mark = _mark; |
| 19776 | D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ', |
| 19777 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
| 19778 | } |
| 19779 | _res = NULL; |
| 19780 | done: |
| 19781 | D(p->level--); |
| 19782 | return _res; |
| 19783 | } |
| 19784 | |
| 19785 | // _tmp_20: '(' single_target ')' | single_subscript_attribute_target |
| 19786 | static void * |
| 19787 | _tmp_20_rule(Parser *p) |
| 19788 | { |
| 19789 | D(p->level++); |
| 19790 | if (p->error_indicator) { |
| 19791 | D(p->level--); |
| 19792 | return NULL; |
| 19793 | } |
| 19794 | void * _res = NULL; |
| 19795 | int _mark = p->mark; |
| 19796 | { // '(' single_target ')' |
| 19797 | if (p->error_indicator) { |
| 19798 | D(p->level--); |
| 19799 | return NULL; |
| 19800 | } |
| 19801 | D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
| 19802 | Token * _literal; |
| 19803 | Token * _literal_1; |
| 19804 | expr_ty b; |
| 19805 | if ( |
| 19806 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 19807 | && |
| 19808 | (b = single_target_rule(p)) // single_target |
| 19809 | && |
| 19810 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 19811 | ) |
| 19812 | { |
| 19813 | D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
| 19814 | _res = b; |
| 19815 | if (_res == NULL && PyErr_Occurred()) { |
| 19816 | p->error_indicator = 1; |
| 19817 | D(p->level--); |
| 19818 | return NULL; |
| 19819 | } |
| 19820 | goto done; |
| 19821 | } |
| 19822 | p->mark = _mark; |
| 19823 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', |
| 19824 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
| 19825 | } |
| 19826 | { // single_subscript_attribute_target |
| 19827 | if (p->error_indicator) { |
| 19828 | D(p->level--); |
| 19829 | return NULL; |
| 19830 | } |
| 19831 | D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
| 19832 | expr_ty single_subscript_attribute_target_var; |
| 19833 | if ( |
| 19834 | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
| 19835 | ) |
| 19836 | { |
| 19837 | D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
| 19838 | _res = single_subscript_attribute_target_var; |
| 19839 | goto done; |
| 19840 | } |
| 19841 | p->mark = _mark; |
| 19842 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', |
| 19843 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
| 19844 | } |
| 19845 | _res = NULL; |
| 19846 | done: |
| 19847 | D(p->level--); |
| 19848 | return _res; |
| 19849 | } |
| 19850 | |
| 19851 | // _tmp_21: '=' annotated_rhs |
| 19852 | static void * |
| 19853 | _tmp_21_rule(Parser *p) |
| 19854 | { |
| 19855 | D(p->level++); |
| 19856 | if (p->error_indicator) { |
| 19857 | D(p->level--); |
| 19858 | return NULL; |
| 19859 | } |
| 19860 | void * _res = NULL; |
| 19861 | int _mark = p->mark; |
| 19862 | { // '=' annotated_rhs |
| 19863 | if (p->error_indicator) { |
| 19864 | D(p->level--); |
| 19865 | return NULL; |
| 19866 | } |
| 19867 | D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
| 19868 | Token * _literal; |
| 19869 | expr_ty d; |
| 19870 | if ( |
| 19871 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 19872 | && |
| 19873 | (d = annotated_rhs_rule(p)) // annotated_rhs |
| 19874 | ) |
| 19875 | { |
| 19876 | D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
| 19877 | _res = d; |
| 19878 | if (_res == NULL && PyErr_Occurred()) { |
| 19879 | p->error_indicator = 1; |
| 19880 | D(p->level--); |
| 19881 | return NULL; |
| 19882 | } |
| 19883 | goto done; |
| 19884 | } |
| 19885 | p->mark = _mark; |
| 19886 | D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ', |
| 19887 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
| 19888 | } |
| 19889 | _res = NULL; |
| 19890 | done: |
| 19891 | D(p->level--); |
| 19892 | return _res; |
| 19893 | } |
| 19894 | |
| 19895 | // _loop1_22: (star_targets '=') |
| 19896 | static asdl_seq * |
| 19897 | _loop1_22_rule(Parser *p) |
| 19898 | { |
| 19899 | D(p->level++); |
| 19900 | if (p->error_indicator) { |
| 19901 | D(p->level--); |
| 19902 | return NULL; |
| 19903 | } |
| 19904 | void *_res = NULL; |
| 19905 | int _mark = p->mark; |
| 19906 | int _start_mark = p->mark; |
| 19907 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19908 | if (!_children) { |
| 19909 | p->error_indicator = 1; |
| 19910 | PyErr_NoMemory(); |
| 19911 | D(p->level--); |
| 19912 | return NULL; |
| 19913 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 19914 | Py_ssize_t _children_capacity = 1; |
| 19915 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19916 | { // (star_targets '=') |
| 19917 | if (p->error_indicator) { |
| 19918 | D(p->level--); |
| 19919 | return NULL; |
| 19920 | } |
| 19921 | 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] | 19922 | void *_tmp_162_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19923 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19924 | (_tmp_162_var = _tmp_162_rule(p)) // star_targets '=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19925 | ) |
| 19926 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 19927 | _res = _tmp_162_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 19928 | if (_n == _children_capacity) { |
| 19929 | _children_capacity *= 2; |
| 19930 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19931 | if (!_new_children) { |
| 19932 | p->error_indicator = 1; |
| 19933 | PyErr_NoMemory(); |
| 19934 | D(p->level--); |
| 19935 | return NULL; |
| 19936 | } |
| 19937 | _children = _new_children; |
| 19938 | } |
| 19939 | _children[_n++] = _res; |
| 19940 | _mark = p->mark; |
| 19941 | } |
| 19942 | p->mark = _mark; |
| 19943 | D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ', |
| 19944 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
| 19945 | } |
| 19946 | if (_n == 0 || p->error_indicator) { |
| 19947 | PyMem_Free(_children); |
| 19948 | D(p->level--); |
| 19949 | return NULL; |
| 19950 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19951 | 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] | 19952 | if (!_seq) { |
| 19953 | PyMem_Free(_children); |
| 19954 | p->error_indicator = 1; |
| 19955 | PyErr_NoMemory(); |
| 19956 | D(p->level--); |
| 19957 | return NULL; |
| 19958 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 19959 | 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] | 19960 | PyMem_Free(_children); |
| 19961 | _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq); |
| 19962 | D(p->level--); |
| 19963 | return _seq; |
| 19964 | } |
| 19965 | |
| 19966 | // _tmp_23: yield_expr | star_expressions |
| 19967 | static void * |
| 19968 | _tmp_23_rule(Parser *p) |
| 19969 | { |
| 19970 | D(p->level++); |
| 19971 | if (p->error_indicator) { |
| 19972 | D(p->level--); |
| 19973 | return NULL; |
| 19974 | } |
| 19975 | void * _res = NULL; |
| 19976 | int _mark = p->mark; |
| 19977 | { // yield_expr |
| 19978 | if (p->error_indicator) { |
| 19979 | D(p->level--); |
| 19980 | return NULL; |
| 19981 | } |
| 19982 | D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 19983 | expr_ty yield_expr_var; |
| 19984 | if ( |
| 19985 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 19986 | ) |
| 19987 | { |
| 19988 | D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 19989 | _res = yield_expr_var; |
| 19990 | goto done; |
| 19991 | } |
| 19992 | p->mark = _mark; |
| 19993 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', |
| 19994 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 19995 | } |
| 19996 | { // star_expressions |
| 19997 | if (p->error_indicator) { |
| 19998 | D(p->level--); |
| 19999 | return NULL; |
| 20000 | } |
| 20001 | D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 20002 | expr_ty star_expressions_var; |
| 20003 | if ( |
| 20004 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 20005 | ) |
| 20006 | { |
| 20007 | D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 20008 | _res = star_expressions_var; |
| 20009 | goto done; |
| 20010 | } |
| 20011 | p->mark = _mark; |
| 20012 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', |
| 20013 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 20014 | } |
| 20015 | _res = NULL; |
| 20016 | done: |
| 20017 | D(p->level--); |
| 20018 | return _res; |
| 20019 | } |
| 20020 | |
| 20021 | // _tmp_24: yield_expr | star_expressions |
| 20022 | static void * |
| 20023 | _tmp_24_rule(Parser *p) |
| 20024 | { |
| 20025 | D(p->level++); |
| 20026 | if (p->error_indicator) { |
| 20027 | D(p->level--); |
| 20028 | return NULL; |
| 20029 | } |
| 20030 | void * _res = NULL; |
| 20031 | int _mark = p->mark; |
| 20032 | { // yield_expr |
| 20033 | if (p->error_indicator) { |
| 20034 | D(p->level--); |
| 20035 | return NULL; |
| 20036 | } |
| 20037 | D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 20038 | expr_ty yield_expr_var; |
| 20039 | if ( |
| 20040 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 20041 | ) |
| 20042 | { |
| 20043 | D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 20044 | _res = yield_expr_var; |
| 20045 | goto done; |
| 20046 | } |
| 20047 | p->mark = _mark; |
| 20048 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', |
| 20049 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 20050 | } |
| 20051 | { // star_expressions |
| 20052 | if (p->error_indicator) { |
| 20053 | D(p->level--); |
| 20054 | return NULL; |
| 20055 | } |
| 20056 | D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 20057 | expr_ty star_expressions_var; |
| 20058 | if ( |
| 20059 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 20060 | ) |
| 20061 | { |
| 20062 | D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 20063 | _res = star_expressions_var; |
| 20064 | goto done; |
| 20065 | } |
| 20066 | p->mark = _mark; |
| 20067 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', |
| 20068 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 20069 | } |
| 20070 | _res = NULL; |
| 20071 | done: |
| 20072 | D(p->level--); |
| 20073 | return _res; |
| 20074 | } |
| 20075 | |
| 20076 | // _loop0_26: ',' NAME |
| 20077 | static asdl_seq * |
| 20078 | _loop0_26_rule(Parser *p) |
| 20079 | { |
| 20080 | D(p->level++); |
| 20081 | if (p->error_indicator) { |
| 20082 | D(p->level--); |
| 20083 | return NULL; |
| 20084 | } |
| 20085 | void *_res = NULL; |
| 20086 | int _mark = p->mark; |
| 20087 | int _start_mark = p->mark; |
| 20088 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20089 | if (!_children) { |
| 20090 | p->error_indicator = 1; |
| 20091 | PyErr_NoMemory(); |
| 20092 | D(p->level--); |
| 20093 | return NULL; |
| 20094 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20095 | Py_ssize_t _children_capacity = 1; |
| 20096 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20097 | { // ',' NAME |
| 20098 | if (p->error_indicator) { |
| 20099 | D(p->level--); |
| 20100 | return NULL; |
| 20101 | } |
| 20102 | D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); |
| 20103 | Token * _literal; |
| 20104 | expr_ty elem; |
| 20105 | while ( |
| 20106 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20107 | && |
| 20108 | (elem = _PyPegen_name_token(p)) // NAME |
| 20109 | ) |
| 20110 | { |
| 20111 | _res = elem; |
| 20112 | if (_res == NULL && PyErr_Occurred()) { |
| 20113 | p->error_indicator = 1; |
| 20114 | PyMem_Free(_children); |
| 20115 | D(p->level--); |
| 20116 | return NULL; |
| 20117 | } |
| 20118 | if (_n == _children_capacity) { |
| 20119 | _children_capacity *= 2; |
| 20120 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20121 | if (!_new_children) { |
| 20122 | p->error_indicator = 1; |
| 20123 | PyErr_NoMemory(); |
| 20124 | D(p->level--); |
| 20125 | return NULL; |
| 20126 | } |
| 20127 | _children = _new_children; |
| 20128 | } |
| 20129 | _children[_n++] = _res; |
| 20130 | _mark = p->mark; |
| 20131 | } |
| 20132 | p->mark = _mark; |
| 20133 | D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ', |
| 20134 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
| 20135 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20136 | 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] | 20137 | if (!_seq) { |
| 20138 | PyMem_Free(_children); |
| 20139 | p->error_indicator = 1; |
| 20140 | PyErr_NoMemory(); |
| 20141 | D(p->level--); |
| 20142 | return NULL; |
| 20143 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20144 | 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] | 20145 | PyMem_Free(_children); |
| 20146 | _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); |
| 20147 | D(p->level--); |
| 20148 | return _seq; |
| 20149 | } |
| 20150 | |
| 20151 | // _gather_25: NAME _loop0_26 |
| 20152 | static asdl_seq * |
| 20153 | _gather_25_rule(Parser *p) |
| 20154 | { |
| 20155 | D(p->level++); |
| 20156 | if (p->error_indicator) { |
| 20157 | D(p->level--); |
| 20158 | return NULL; |
| 20159 | } |
| 20160 | asdl_seq * _res = NULL; |
| 20161 | int _mark = p->mark; |
| 20162 | { // NAME _loop0_26 |
| 20163 | if (p->error_indicator) { |
| 20164 | D(p->level--); |
| 20165 | return NULL; |
| 20166 | } |
| 20167 | D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); |
| 20168 | expr_ty elem; |
| 20169 | asdl_seq * seq; |
| 20170 | if ( |
| 20171 | (elem = _PyPegen_name_token(p)) // NAME |
| 20172 | && |
| 20173 | (seq = _loop0_26_rule(p)) // _loop0_26 |
| 20174 | ) |
| 20175 | { |
| 20176 | D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); |
| 20177 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20178 | goto done; |
| 20179 | } |
| 20180 | p->mark = _mark; |
| 20181 | D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ', |
| 20182 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26")); |
| 20183 | } |
| 20184 | _res = NULL; |
| 20185 | done: |
| 20186 | D(p->level--); |
| 20187 | return _res; |
| 20188 | } |
| 20189 | |
| 20190 | // _loop0_28: ',' NAME |
| 20191 | static asdl_seq * |
| 20192 | _loop0_28_rule(Parser *p) |
| 20193 | { |
| 20194 | D(p->level++); |
| 20195 | if (p->error_indicator) { |
| 20196 | D(p->level--); |
| 20197 | return NULL; |
| 20198 | } |
| 20199 | void *_res = NULL; |
| 20200 | int _mark = p->mark; |
| 20201 | int _start_mark = p->mark; |
| 20202 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20203 | if (!_children) { |
| 20204 | p->error_indicator = 1; |
| 20205 | PyErr_NoMemory(); |
| 20206 | D(p->level--); |
| 20207 | return NULL; |
| 20208 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20209 | Py_ssize_t _children_capacity = 1; |
| 20210 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20211 | { // ',' NAME |
| 20212 | if (p->error_indicator) { |
| 20213 | D(p->level--); |
| 20214 | return NULL; |
| 20215 | } |
| 20216 | D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); |
| 20217 | Token * _literal; |
| 20218 | expr_ty elem; |
| 20219 | while ( |
| 20220 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20221 | && |
| 20222 | (elem = _PyPegen_name_token(p)) // NAME |
| 20223 | ) |
| 20224 | { |
| 20225 | _res = elem; |
| 20226 | if (_res == NULL && PyErr_Occurred()) { |
| 20227 | p->error_indicator = 1; |
| 20228 | PyMem_Free(_children); |
| 20229 | D(p->level--); |
| 20230 | return NULL; |
| 20231 | } |
| 20232 | if (_n == _children_capacity) { |
| 20233 | _children_capacity *= 2; |
| 20234 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20235 | if (!_new_children) { |
| 20236 | p->error_indicator = 1; |
| 20237 | PyErr_NoMemory(); |
| 20238 | D(p->level--); |
| 20239 | return NULL; |
| 20240 | } |
| 20241 | _children = _new_children; |
| 20242 | } |
| 20243 | _children[_n++] = _res; |
| 20244 | _mark = p->mark; |
| 20245 | } |
| 20246 | p->mark = _mark; |
| 20247 | D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', |
| 20248 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
| 20249 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20250 | 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] | 20251 | if (!_seq) { |
| 20252 | PyMem_Free(_children); |
| 20253 | p->error_indicator = 1; |
| 20254 | PyErr_NoMemory(); |
| 20255 | D(p->level--); |
| 20256 | return NULL; |
| 20257 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20258 | 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] | 20259 | PyMem_Free(_children); |
| 20260 | _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); |
| 20261 | D(p->level--); |
| 20262 | return _seq; |
| 20263 | } |
| 20264 | |
| 20265 | // _gather_27: NAME _loop0_28 |
| 20266 | static asdl_seq * |
| 20267 | _gather_27_rule(Parser *p) |
| 20268 | { |
| 20269 | D(p->level++); |
| 20270 | if (p->error_indicator) { |
| 20271 | D(p->level--); |
| 20272 | return NULL; |
| 20273 | } |
| 20274 | asdl_seq * _res = NULL; |
| 20275 | int _mark = p->mark; |
| 20276 | { // NAME _loop0_28 |
| 20277 | if (p->error_indicator) { |
| 20278 | D(p->level--); |
| 20279 | return NULL; |
| 20280 | } |
| 20281 | D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); |
| 20282 | expr_ty elem; |
| 20283 | asdl_seq * seq; |
| 20284 | if ( |
| 20285 | (elem = _PyPegen_name_token(p)) // NAME |
| 20286 | && |
| 20287 | (seq = _loop0_28_rule(p)) // _loop0_28 |
| 20288 | ) |
| 20289 | { |
| 20290 | D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); |
| 20291 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20292 | goto done; |
| 20293 | } |
| 20294 | p->mark = _mark; |
| 20295 | D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ', |
| 20296 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28")); |
| 20297 | } |
| 20298 | _res = NULL; |
| 20299 | done: |
| 20300 | D(p->level--); |
| 20301 | return _res; |
| 20302 | } |
| 20303 | |
| 20304 | // _tmp_29: ',' expression |
| 20305 | static void * |
| 20306 | _tmp_29_rule(Parser *p) |
| 20307 | { |
| 20308 | D(p->level++); |
| 20309 | if (p->error_indicator) { |
| 20310 | D(p->level--); |
| 20311 | return NULL; |
| 20312 | } |
| 20313 | void * _res = NULL; |
| 20314 | int _mark = p->mark; |
| 20315 | { // ',' expression |
| 20316 | if (p->error_indicator) { |
| 20317 | D(p->level--); |
| 20318 | return NULL; |
| 20319 | } |
| 20320 | D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 20321 | Token * _literal; |
| 20322 | expr_ty z; |
| 20323 | if ( |
| 20324 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20325 | && |
| 20326 | (z = expression_rule(p)) // expression |
| 20327 | ) |
| 20328 | { |
| 20329 | D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); |
| 20330 | _res = z; |
| 20331 | if (_res == NULL && PyErr_Occurred()) { |
| 20332 | p->error_indicator = 1; |
| 20333 | D(p->level--); |
| 20334 | return NULL; |
| 20335 | } |
| 20336 | goto done; |
| 20337 | } |
| 20338 | p->mark = _mark; |
| 20339 | D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ', |
| 20340 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 20341 | } |
| 20342 | _res = NULL; |
| 20343 | done: |
| 20344 | D(p->level--); |
| 20345 | return _res; |
| 20346 | } |
| 20347 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20348 | // _tmp_30: ';' | NEWLINE |
| 20349 | static void * |
| 20350 | _tmp_30_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20351 | { |
| 20352 | D(p->level++); |
| 20353 | if (p->error_indicator) { |
| 20354 | D(p->level--); |
| 20355 | return NULL; |
| 20356 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20357 | void * _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20358 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20359 | { // ';' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20360 | if (p->error_indicator) { |
| 20361 | D(p->level--); |
| 20362 | return NULL; |
| 20363 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20364 | D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'")); |
| 20365 | Token * _literal; |
| 20366 | if ( |
| 20367 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20368 | ) |
| 20369 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20370 | D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'")); |
| 20371 | _res = _literal; |
| 20372 | goto done; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20373 | } |
| 20374 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20375 | D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ', |
| 20376 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20377 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20378 | { // NEWLINE |
| 20379 | if (p->error_indicator) { |
| 20380 | D(p->level--); |
| 20381 | return NULL; |
| 20382 | } |
| 20383 | D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 20384 | Token * newline_var; |
| 20385 | if ( |
| 20386 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 20387 | ) |
| 20388 | { |
| 20389 | D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
| 20390 | _res = newline_var; |
| 20391 | goto done; |
| 20392 | } |
| 20393 | p->mark = _mark; |
| 20394 | D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ', |
| 20395 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20396 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20397 | _res = NULL; |
| 20398 | done: |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20399 | D(p->level--); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20400 | return _res; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20401 | } |
| 20402 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20403 | // _loop0_31: ('.' | '...') |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20404 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20405 | _loop0_31_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20406 | { |
| 20407 | D(p->level++); |
| 20408 | if (p->error_indicator) { |
| 20409 | D(p->level--); |
| 20410 | return NULL; |
| 20411 | } |
| 20412 | void *_res = NULL; |
| 20413 | int _mark = p->mark; |
| 20414 | int _start_mark = p->mark; |
| 20415 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20416 | if (!_children) { |
| 20417 | p->error_indicator = 1; |
| 20418 | PyErr_NoMemory(); |
| 20419 | D(p->level--); |
| 20420 | return NULL; |
| 20421 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20422 | Py_ssize_t _children_capacity = 1; |
| 20423 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20424 | { // ('.' | '...') |
| 20425 | if (p->error_indicator) { |
| 20426 | D(p->level--); |
| 20427 | return NULL; |
| 20428 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20429 | 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] | 20430 | void *_tmp_163_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20431 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20432 | (_tmp_163_var = _tmp_163_rule(p)) // '.' | '...' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20433 | ) |
| 20434 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20435 | _res = _tmp_163_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20436 | if (_n == _children_capacity) { |
| 20437 | _children_capacity *= 2; |
| 20438 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20439 | if (!_new_children) { |
| 20440 | p->error_indicator = 1; |
| 20441 | PyErr_NoMemory(); |
| 20442 | D(p->level--); |
| 20443 | return NULL; |
| 20444 | } |
| 20445 | _children = _new_children; |
| 20446 | } |
| 20447 | _children[_n++] = _res; |
| 20448 | _mark = p->mark; |
| 20449 | } |
| 20450 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20451 | D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ', |
| 20452 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
| 20453 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20454 | 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] | 20455 | if (!_seq) { |
| 20456 | PyMem_Free(_children); |
| 20457 | p->error_indicator = 1; |
| 20458 | PyErr_NoMemory(); |
| 20459 | D(p->level--); |
| 20460 | return NULL; |
| 20461 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20462 | 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] | 20463 | PyMem_Free(_children); |
| 20464 | _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq); |
| 20465 | D(p->level--); |
| 20466 | return _seq; |
| 20467 | } |
| 20468 | |
| 20469 | // _loop1_32: ('.' | '...') |
| 20470 | static asdl_seq * |
| 20471 | _loop1_32_rule(Parser *p) |
| 20472 | { |
| 20473 | D(p->level++); |
| 20474 | if (p->error_indicator) { |
| 20475 | D(p->level--); |
| 20476 | return NULL; |
| 20477 | } |
| 20478 | void *_res = NULL; |
| 20479 | int _mark = p->mark; |
| 20480 | int _start_mark = p->mark; |
| 20481 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20482 | if (!_children) { |
| 20483 | p->error_indicator = 1; |
| 20484 | PyErr_NoMemory(); |
| 20485 | D(p->level--); |
| 20486 | return NULL; |
| 20487 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20488 | Py_ssize_t _children_capacity = 1; |
| 20489 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20490 | { // ('.' | '...') |
| 20491 | if (p->error_indicator) { |
| 20492 | D(p->level--); |
| 20493 | return NULL; |
| 20494 | } |
| 20495 | 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] | 20496 | void *_tmp_164_var; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20497 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20498 | (_tmp_164_var = _tmp_164_rule(p)) // '.' | '...' |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20499 | ) |
| 20500 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 20501 | _res = _tmp_164_var; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20502 | if (_n == _children_capacity) { |
| 20503 | _children_capacity *= 2; |
| 20504 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20505 | if (!_new_children) { |
| 20506 | p->error_indicator = 1; |
| 20507 | PyErr_NoMemory(); |
| 20508 | D(p->level--); |
| 20509 | return NULL; |
| 20510 | } |
| 20511 | _children = _new_children; |
| 20512 | } |
| 20513 | _children[_n++] = _res; |
| 20514 | _mark = p->mark; |
| 20515 | } |
| 20516 | p->mark = _mark; |
| 20517 | 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] | 20518 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
| 20519 | } |
| 20520 | if (_n == 0 || p->error_indicator) { |
| 20521 | PyMem_Free(_children); |
| 20522 | D(p->level--); |
| 20523 | return NULL; |
| 20524 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20525 | 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] | 20526 | if (!_seq) { |
| 20527 | PyMem_Free(_children); |
| 20528 | p->error_indicator = 1; |
| 20529 | PyErr_NoMemory(); |
| 20530 | D(p->level--); |
| 20531 | return NULL; |
| 20532 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20533 | 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] | 20534 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20535 | _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20536 | D(p->level--); |
| 20537 | return _seq; |
| 20538 | } |
| 20539 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20540 | // _loop0_34: ',' import_from_as_name |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20541 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20542 | _loop0_34_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20543 | { |
| 20544 | D(p->level++); |
| 20545 | if (p->error_indicator) { |
| 20546 | D(p->level--); |
| 20547 | return NULL; |
| 20548 | } |
| 20549 | void *_res = NULL; |
| 20550 | int _mark = p->mark; |
| 20551 | int _start_mark = p->mark; |
| 20552 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20553 | if (!_children) { |
| 20554 | p->error_indicator = 1; |
| 20555 | PyErr_NoMemory(); |
| 20556 | D(p->level--); |
| 20557 | return NULL; |
| 20558 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20559 | Py_ssize_t _children_capacity = 1; |
| 20560 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20561 | { // ',' import_from_as_name |
| 20562 | if (p->error_indicator) { |
| 20563 | D(p->level--); |
| 20564 | return NULL; |
| 20565 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20566 | 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] | 20567 | Token * _literal; |
| 20568 | alias_ty elem; |
| 20569 | while ( |
| 20570 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20571 | && |
| 20572 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
| 20573 | ) |
| 20574 | { |
| 20575 | _res = elem; |
| 20576 | if (_res == NULL && PyErr_Occurred()) { |
| 20577 | p->error_indicator = 1; |
| 20578 | PyMem_Free(_children); |
| 20579 | D(p->level--); |
| 20580 | return NULL; |
| 20581 | } |
| 20582 | if (_n == _children_capacity) { |
| 20583 | _children_capacity *= 2; |
| 20584 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20585 | if (!_new_children) { |
| 20586 | p->error_indicator = 1; |
| 20587 | PyErr_NoMemory(); |
| 20588 | D(p->level--); |
| 20589 | return NULL; |
| 20590 | } |
| 20591 | _children = _new_children; |
| 20592 | } |
| 20593 | _children[_n++] = _res; |
| 20594 | _mark = p->mark; |
| 20595 | } |
| 20596 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20597 | 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] | 20598 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); |
| 20599 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20600 | 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] | 20601 | if (!_seq) { |
| 20602 | PyMem_Free(_children); |
| 20603 | p->error_indicator = 1; |
| 20604 | PyErr_NoMemory(); |
| 20605 | D(p->level--); |
| 20606 | return NULL; |
| 20607 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20608 | 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] | 20609 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20610 | _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20611 | D(p->level--); |
| 20612 | return _seq; |
| 20613 | } |
| 20614 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20615 | // _gather_33: import_from_as_name _loop0_34 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20616 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20617 | _gather_33_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20618 | { |
| 20619 | D(p->level++); |
| 20620 | if (p->error_indicator) { |
| 20621 | D(p->level--); |
| 20622 | return NULL; |
| 20623 | } |
| 20624 | asdl_seq * _res = NULL; |
| 20625 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20626 | { // import_from_as_name _loop0_34 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20627 | if (p->error_indicator) { |
| 20628 | D(p->level--); |
| 20629 | return NULL; |
| 20630 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20631 | 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] | 20632 | alias_ty elem; |
| 20633 | asdl_seq * seq; |
| 20634 | if ( |
| 20635 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
| 20636 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20637 | (seq = _loop0_34_rule(p)) // _loop0_34 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20638 | ) |
| 20639 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20640 | 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] | 20641 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20642 | goto done; |
| 20643 | } |
| 20644 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20645 | D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ', |
| 20646 | 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] | 20647 | } |
| 20648 | _res = NULL; |
| 20649 | done: |
| 20650 | D(p->level--); |
| 20651 | return _res; |
| 20652 | } |
| 20653 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20654 | // _tmp_35: 'as' NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20655 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20656 | _tmp_35_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20657 | { |
| 20658 | D(p->level++); |
| 20659 | if (p->error_indicator) { |
| 20660 | D(p->level--); |
| 20661 | return NULL; |
| 20662 | } |
| 20663 | void * _res = NULL; |
| 20664 | int _mark = p->mark; |
| 20665 | { // 'as' NAME |
| 20666 | if (p->error_indicator) { |
| 20667 | D(p->level--); |
| 20668 | return NULL; |
| 20669 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20670 | 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] | 20671 | Token * _keyword; |
| 20672 | expr_ty z; |
| 20673 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20674 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20675 | && |
| 20676 | (z = _PyPegen_name_token(p)) // NAME |
| 20677 | ) |
| 20678 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20679 | 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] | 20680 | _res = z; |
| 20681 | if (_res == NULL && PyErr_Occurred()) { |
| 20682 | p->error_indicator = 1; |
| 20683 | D(p->level--); |
| 20684 | return NULL; |
| 20685 | } |
| 20686 | goto done; |
| 20687 | } |
| 20688 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20689 | 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] | 20690 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 20691 | } |
| 20692 | _res = NULL; |
| 20693 | done: |
| 20694 | D(p->level--); |
| 20695 | return _res; |
| 20696 | } |
| 20697 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20698 | // _loop0_37: ',' dotted_as_name |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20699 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20700 | _loop0_37_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20701 | { |
| 20702 | D(p->level++); |
| 20703 | if (p->error_indicator) { |
| 20704 | D(p->level--); |
| 20705 | return NULL; |
| 20706 | } |
| 20707 | void *_res = NULL; |
| 20708 | int _mark = p->mark; |
| 20709 | int _start_mark = p->mark; |
| 20710 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20711 | if (!_children) { |
| 20712 | p->error_indicator = 1; |
| 20713 | PyErr_NoMemory(); |
| 20714 | D(p->level--); |
| 20715 | return NULL; |
| 20716 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20717 | Py_ssize_t _children_capacity = 1; |
| 20718 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20719 | { // ',' dotted_as_name |
| 20720 | if (p->error_indicator) { |
| 20721 | D(p->level--); |
| 20722 | return NULL; |
| 20723 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20724 | 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] | 20725 | Token * _literal; |
| 20726 | alias_ty elem; |
| 20727 | while ( |
| 20728 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20729 | && |
| 20730 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
| 20731 | ) |
| 20732 | { |
| 20733 | _res = elem; |
| 20734 | if (_res == NULL && PyErr_Occurred()) { |
| 20735 | p->error_indicator = 1; |
| 20736 | PyMem_Free(_children); |
| 20737 | D(p->level--); |
| 20738 | return NULL; |
| 20739 | } |
| 20740 | if (_n == _children_capacity) { |
| 20741 | _children_capacity *= 2; |
| 20742 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20743 | if (!_new_children) { |
| 20744 | p->error_indicator = 1; |
| 20745 | PyErr_NoMemory(); |
| 20746 | D(p->level--); |
| 20747 | return NULL; |
| 20748 | } |
| 20749 | _children = _new_children; |
| 20750 | } |
| 20751 | _children[_n++] = _res; |
| 20752 | _mark = p->mark; |
| 20753 | } |
| 20754 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20755 | 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] | 20756 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); |
| 20757 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20758 | 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] | 20759 | if (!_seq) { |
| 20760 | PyMem_Free(_children); |
| 20761 | p->error_indicator = 1; |
| 20762 | PyErr_NoMemory(); |
| 20763 | D(p->level--); |
| 20764 | return NULL; |
| 20765 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20766 | 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] | 20767 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20768 | _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20769 | D(p->level--); |
| 20770 | return _seq; |
| 20771 | } |
| 20772 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20773 | // _gather_36: dotted_as_name _loop0_37 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20774 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20775 | _gather_36_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20776 | { |
| 20777 | D(p->level++); |
| 20778 | if (p->error_indicator) { |
| 20779 | D(p->level--); |
| 20780 | return NULL; |
| 20781 | } |
| 20782 | asdl_seq * _res = NULL; |
| 20783 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20784 | { // dotted_as_name _loop0_37 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20785 | if (p->error_indicator) { |
| 20786 | D(p->level--); |
| 20787 | return NULL; |
| 20788 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20789 | 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] | 20790 | alias_ty elem; |
| 20791 | asdl_seq * seq; |
| 20792 | if ( |
| 20793 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
| 20794 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20795 | (seq = _loop0_37_rule(p)) // _loop0_37 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20796 | ) |
| 20797 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20798 | 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] | 20799 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20800 | goto done; |
| 20801 | } |
| 20802 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20803 | D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ', |
| 20804 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20805 | } |
| 20806 | _res = NULL; |
| 20807 | done: |
| 20808 | D(p->level--); |
| 20809 | return _res; |
| 20810 | } |
| 20811 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20812 | // _tmp_38: 'as' NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20813 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20814 | _tmp_38_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20815 | { |
| 20816 | D(p->level++); |
| 20817 | if (p->error_indicator) { |
| 20818 | D(p->level--); |
| 20819 | return NULL; |
| 20820 | } |
| 20821 | void * _res = NULL; |
| 20822 | int _mark = p->mark; |
| 20823 | { // 'as' NAME |
| 20824 | if (p->error_indicator) { |
| 20825 | D(p->level--); |
| 20826 | return NULL; |
| 20827 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20828 | 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] | 20829 | Token * _keyword; |
| 20830 | expr_ty z; |
| 20831 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20832 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20833 | && |
| 20834 | (z = _PyPegen_name_token(p)) // NAME |
| 20835 | ) |
| 20836 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20837 | 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] | 20838 | _res = z; |
| 20839 | if (_res == NULL && PyErr_Occurred()) { |
| 20840 | p->error_indicator = 1; |
| 20841 | D(p->level--); |
| 20842 | return NULL; |
| 20843 | } |
| 20844 | goto done; |
| 20845 | } |
| 20846 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20847 | 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] | 20848 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 20849 | } |
| 20850 | _res = NULL; |
| 20851 | done: |
| 20852 | D(p->level--); |
| 20853 | return _res; |
| 20854 | } |
| 20855 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20856 | // _loop0_40: ',' with_item |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20857 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20858 | _loop0_40_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20859 | { |
| 20860 | D(p->level++); |
| 20861 | if (p->error_indicator) { |
| 20862 | D(p->level--); |
| 20863 | return NULL; |
| 20864 | } |
| 20865 | void *_res = NULL; |
| 20866 | int _mark = p->mark; |
| 20867 | int _start_mark = p->mark; |
| 20868 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20869 | if (!_children) { |
| 20870 | p->error_indicator = 1; |
| 20871 | PyErr_NoMemory(); |
| 20872 | D(p->level--); |
| 20873 | return NULL; |
| 20874 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20875 | Py_ssize_t _children_capacity = 1; |
| 20876 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20877 | { // ',' with_item |
| 20878 | if (p->error_indicator) { |
| 20879 | D(p->level--); |
| 20880 | return NULL; |
| 20881 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20882 | 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] | 20883 | Token * _literal; |
| 20884 | withitem_ty elem; |
| 20885 | while ( |
| 20886 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 20887 | && |
| 20888 | (elem = with_item_rule(p)) // with_item |
| 20889 | ) |
| 20890 | { |
| 20891 | _res = elem; |
| 20892 | if (_res == NULL && PyErr_Occurred()) { |
| 20893 | p->error_indicator = 1; |
| 20894 | PyMem_Free(_children); |
| 20895 | D(p->level--); |
| 20896 | return NULL; |
| 20897 | } |
| 20898 | if (_n == _children_capacity) { |
| 20899 | _children_capacity *= 2; |
| 20900 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20901 | if (!_new_children) { |
| 20902 | p->error_indicator = 1; |
| 20903 | PyErr_NoMemory(); |
| 20904 | D(p->level--); |
| 20905 | return NULL; |
| 20906 | } |
| 20907 | _children = _new_children; |
| 20908 | } |
| 20909 | _children[_n++] = _res; |
| 20910 | _mark = p->mark; |
| 20911 | } |
| 20912 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20913 | 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] | 20914 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
| 20915 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20916 | 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] | 20917 | if (!_seq) { |
| 20918 | PyMem_Free(_children); |
| 20919 | p->error_indicator = 1; |
| 20920 | PyErr_NoMemory(); |
| 20921 | D(p->level--); |
| 20922 | return NULL; |
| 20923 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 20924 | 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] | 20925 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20926 | _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20927 | D(p->level--); |
| 20928 | return _seq; |
| 20929 | } |
| 20930 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20931 | // _gather_39: with_item _loop0_40 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20932 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20933 | _gather_39_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20934 | { |
| 20935 | D(p->level++); |
| 20936 | if (p->error_indicator) { |
| 20937 | D(p->level--); |
| 20938 | return NULL; |
| 20939 | } |
| 20940 | asdl_seq * _res = NULL; |
| 20941 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20942 | { // with_item _loop0_40 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20943 | if (p->error_indicator) { |
| 20944 | D(p->level--); |
| 20945 | return NULL; |
| 20946 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20947 | 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] | 20948 | withitem_ty elem; |
| 20949 | asdl_seq * seq; |
| 20950 | if ( |
| 20951 | (elem = with_item_rule(p)) // with_item |
| 20952 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20953 | (seq = _loop0_40_rule(p)) // _loop0_40 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20954 | ) |
| 20955 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20956 | 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] | 20957 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 20958 | goto done; |
| 20959 | } |
| 20960 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20961 | D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ', |
| 20962 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20963 | } |
| 20964 | _res = NULL; |
| 20965 | done: |
| 20966 | D(p->level--); |
| 20967 | return _res; |
| 20968 | } |
| 20969 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20970 | // _loop0_42: ',' with_item |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20971 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20972 | _loop0_42_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20973 | { |
| 20974 | D(p->level++); |
| 20975 | if (p->error_indicator) { |
| 20976 | D(p->level--); |
| 20977 | return NULL; |
| 20978 | } |
| 20979 | void *_res = NULL; |
| 20980 | int _mark = p->mark; |
| 20981 | int _start_mark = p->mark; |
| 20982 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20983 | if (!_children) { |
| 20984 | p->error_indicator = 1; |
| 20985 | PyErr_NoMemory(); |
| 20986 | D(p->level--); |
| 20987 | return NULL; |
| 20988 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 20989 | Py_ssize_t _children_capacity = 1; |
| 20990 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 20991 | { // ',' with_item |
| 20992 | if (p->error_indicator) { |
| 20993 | D(p->level--); |
| 20994 | return NULL; |
| 20995 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 20996 | 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] | 20997 | Token * _literal; |
| 20998 | withitem_ty elem; |
| 20999 | while ( |
| 21000 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 21001 | && |
| 21002 | (elem = with_item_rule(p)) // with_item |
| 21003 | ) |
| 21004 | { |
| 21005 | _res = elem; |
| 21006 | if (_res == NULL && PyErr_Occurred()) { |
| 21007 | p->error_indicator = 1; |
| 21008 | PyMem_Free(_children); |
| 21009 | D(p->level--); |
| 21010 | return NULL; |
| 21011 | } |
| 21012 | if (_n == _children_capacity) { |
| 21013 | _children_capacity *= 2; |
| 21014 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21015 | if (!_new_children) { |
| 21016 | p->error_indicator = 1; |
| 21017 | PyErr_NoMemory(); |
| 21018 | D(p->level--); |
| 21019 | return NULL; |
| 21020 | } |
| 21021 | _children = _new_children; |
| 21022 | } |
| 21023 | _children[_n++] = _res; |
| 21024 | _mark = p->mark; |
| 21025 | } |
| 21026 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21027 | 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] | 21028 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
| 21029 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21030 | 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] | 21031 | if (!_seq) { |
| 21032 | PyMem_Free(_children); |
| 21033 | p->error_indicator = 1; |
| 21034 | PyErr_NoMemory(); |
| 21035 | D(p->level--); |
| 21036 | return NULL; |
| 21037 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21038 | 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] | 21039 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21040 | _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21041 | D(p->level--); |
| 21042 | return _seq; |
| 21043 | } |
| 21044 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21045 | // _gather_41: with_item _loop0_42 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21046 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21047 | _gather_41_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21048 | { |
| 21049 | D(p->level++); |
| 21050 | if (p->error_indicator) { |
| 21051 | D(p->level--); |
| 21052 | return NULL; |
| 21053 | } |
| 21054 | asdl_seq * _res = NULL; |
| 21055 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21056 | { // with_item _loop0_42 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21057 | if (p->error_indicator) { |
| 21058 | D(p->level--); |
| 21059 | return NULL; |
| 21060 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21061 | 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] | 21062 | withitem_ty elem; |
| 21063 | asdl_seq * seq; |
| 21064 | if ( |
| 21065 | (elem = with_item_rule(p)) // with_item |
| 21066 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21067 | (seq = _loop0_42_rule(p)) // _loop0_42 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21068 | ) |
| 21069 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21070 | 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] | 21071 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21072 | goto done; |
| 21073 | } |
| 21074 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21075 | D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ', |
| 21076 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21077 | } |
| 21078 | _res = NULL; |
| 21079 | done: |
| 21080 | D(p->level--); |
| 21081 | return _res; |
| 21082 | } |
| 21083 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21084 | // _loop0_44: ',' with_item |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21085 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21086 | _loop0_44_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21087 | { |
| 21088 | D(p->level++); |
| 21089 | if (p->error_indicator) { |
| 21090 | D(p->level--); |
| 21091 | return NULL; |
| 21092 | } |
| 21093 | void *_res = NULL; |
| 21094 | int _mark = p->mark; |
| 21095 | int _start_mark = p->mark; |
| 21096 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21097 | if (!_children) { |
| 21098 | p->error_indicator = 1; |
| 21099 | PyErr_NoMemory(); |
| 21100 | D(p->level--); |
| 21101 | return NULL; |
| 21102 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21103 | Py_ssize_t _children_capacity = 1; |
| 21104 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21105 | { // ',' with_item |
| 21106 | if (p->error_indicator) { |
| 21107 | D(p->level--); |
| 21108 | return NULL; |
| 21109 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21110 | 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] | 21111 | Token * _literal; |
| 21112 | withitem_ty elem; |
| 21113 | while ( |
| 21114 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 21115 | && |
| 21116 | (elem = with_item_rule(p)) // with_item |
| 21117 | ) |
| 21118 | { |
| 21119 | _res = elem; |
| 21120 | if (_res == NULL && PyErr_Occurred()) { |
| 21121 | p->error_indicator = 1; |
| 21122 | PyMem_Free(_children); |
| 21123 | D(p->level--); |
| 21124 | return NULL; |
| 21125 | } |
| 21126 | if (_n == _children_capacity) { |
| 21127 | _children_capacity *= 2; |
| 21128 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21129 | if (!_new_children) { |
| 21130 | p->error_indicator = 1; |
| 21131 | PyErr_NoMemory(); |
| 21132 | D(p->level--); |
| 21133 | return NULL; |
| 21134 | } |
| 21135 | _children = _new_children; |
| 21136 | } |
| 21137 | _children[_n++] = _res; |
| 21138 | _mark = p->mark; |
| 21139 | } |
| 21140 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21141 | 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] | 21142 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
| 21143 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21144 | 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] | 21145 | if (!_seq) { |
| 21146 | PyMem_Free(_children); |
| 21147 | p->error_indicator = 1; |
| 21148 | PyErr_NoMemory(); |
| 21149 | D(p->level--); |
| 21150 | return NULL; |
| 21151 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21152 | 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] | 21153 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21154 | _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21155 | D(p->level--); |
| 21156 | return _seq; |
| 21157 | } |
| 21158 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21159 | // _gather_43: with_item _loop0_44 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21160 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21161 | _gather_43_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21162 | { |
| 21163 | D(p->level++); |
| 21164 | if (p->error_indicator) { |
| 21165 | D(p->level--); |
| 21166 | return NULL; |
| 21167 | } |
| 21168 | asdl_seq * _res = NULL; |
| 21169 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21170 | { // with_item _loop0_44 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21171 | if (p->error_indicator) { |
| 21172 | D(p->level--); |
| 21173 | return NULL; |
| 21174 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21175 | 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] | 21176 | withitem_ty elem; |
| 21177 | asdl_seq * seq; |
| 21178 | if ( |
| 21179 | (elem = with_item_rule(p)) // with_item |
| 21180 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21181 | (seq = _loop0_44_rule(p)) // _loop0_44 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21182 | ) |
| 21183 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21184 | 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] | 21185 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21186 | goto done; |
| 21187 | } |
| 21188 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21189 | D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ', |
| 21190 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21191 | } |
| 21192 | _res = NULL; |
| 21193 | done: |
| 21194 | D(p->level--); |
| 21195 | return _res; |
| 21196 | } |
| 21197 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21198 | // _loop0_46: ',' with_item |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21199 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21200 | _loop0_46_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21201 | { |
| 21202 | D(p->level++); |
| 21203 | if (p->error_indicator) { |
| 21204 | D(p->level--); |
| 21205 | return NULL; |
| 21206 | } |
| 21207 | void *_res = NULL; |
| 21208 | int _mark = p->mark; |
| 21209 | int _start_mark = p->mark; |
| 21210 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21211 | if (!_children) { |
| 21212 | p->error_indicator = 1; |
| 21213 | PyErr_NoMemory(); |
| 21214 | D(p->level--); |
| 21215 | return NULL; |
| 21216 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21217 | Py_ssize_t _children_capacity = 1; |
| 21218 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21219 | { // ',' with_item |
| 21220 | if (p->error_indicator) { |
| 21221 | D(p->level--); |
| 21222 | return NULL; |
| 21223 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21224 | 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] | 21225 | Token * _literal; |
| 21226 | withitem_ty elem; |
| 21227 | while ( |
| 21228 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 21229 | && |
| 21230 | (elem = with_item_rule(p)) // with_item |
| 21231 | ) |
| 21232 | { |
| 21233 | _res = elem; |
| 21234 | if (_res == NULL && PyErr_Occurred()) { |
| 21235 | p->error_indicator = 1; |
| 21236 | PyMem_Free(_children); |
| 21237 | D(p->level--); |
| 21238 | return NULL; |
| 21239 | } |
| 21240 | if (_n == _children_capacity) { |
| 21241 | _children_capacity *= 2; |
| 21242 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21243 | if (!_new_children) { |
| 21244 | p->error_indicator = 1; |
| 21245 | PyErr_NoMemory(); |
| 21246 | D(p->level--); |
| 21247 | return NULL; |
| 21248 | } |
| 21249 | _children = _new_children; |
| 21250 | } |
| 21251 | _children[_n++] = _res; |
| 21252 | _mark = p->mark; |
| 21253 | } |
| 21254 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21255 | 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] | 21256 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
| 21257 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21258 | 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] | 21259 | if (!_seq) { |
| 21260 | PyMem_Free(_children); |
| 21261 | p->error_indicator = 1; |
| 21262 | PyErr_NoMemory(); |
| 21263 | D(p->level--); |
| 21264 | return NULL; |
| 21265 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21266 | 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] | 21267 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21268 | _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21269 | D(p->level--); |
| 21270 | return _seq; |
| 21271 | } |
| 21272 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21273 | // _gather_45: with_item _loop0_46 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21274 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21275 | _gather_45_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21276 | { |
| 21277 | D(p->level++); |
| 21278 | if (p->error_indicator) { |
| 21279 | D(p->level--); |
| 21280 | return NULL; |
| 21281 | } |
| 21282 | asdl_seq * _res = NULL; |
| 21283 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21284 | { // with_item _loop0_46 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21285 | if (p->error_indicator) { |
| 21286 | D(p->level--); |
| 21287 | return NULL; |
| 21288 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21289 | 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] | 21290 | withitem_ty elem; |
| 21291 | asdl_seq * seq; |
| 21292 | if ( |
| 21293 | (elem = with_item_rule(p)) // with_item |
| 21294 | && |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21295 | (seq = _loop0_46_rule(p)) // _loop0_46 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21296 | ) |
| 21297 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21298 | 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] | 21299 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21300 | goto done; |
| 21301 | } |
| 21302 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21303 | D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ', |
| 21304 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21305 | } |
| 21306 | _res = NULL; |
| 21307 | done: |
| 21308 | D(p->level--); |
| 21309 | return _res; |
| 21310 | } |
| 21311 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21312 | // _tmp_47: ',' | ')' | ':' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21313 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21314 | _tmp_47_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21315 | { |
| 21316 | D(p->level++); |
| 21317 | if (p->error_indicator) { |
| 21318 | D(p->level--); |
| 21319 | return NULL; |
| 21320 | } |
| 21321 | void * _res = NULL; |
| 21322 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21323 | { // ',' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21324 | if (p->error_indicator) { |
| 21325 | D(p->level--); |
| 21326 | return NULL; |
| 21327 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21328 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
| 21329 | Token * _literal; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21330 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21331 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21332 | ) |
| 21333 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21334 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
| 21335 | _res = _literal; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21336 | goto done; |
| 21337 | } |
| 21338 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21339 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ', |
| 21340 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
| 21341 | } |
| 21342 | { // ')' |
| 21343 | if (p->error_indicator) { |
| 21344 | D(p->level--); |
| 21345 | return NULL; |
| 21346 | } |
| 21347 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
| 21348 | Token * _literal; |
| 21349 | if ( |
| 21350 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 21351 | ) |
| 21352 | { |
| 21353 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
| 21354 | _res = _literal; |
| 21355 | goto done; |
| 21356 | } |
| 21357 | p->mark = _mark; |
| 21358 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ', |
| 21359 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
| 21360 | } |
| 21361 | { // ':' |
| 21362 | if (p->error_indicator) { |
| 21363 | D(p->level--); |
| 21364 | return NULL; |
| 21365 | } |
| 21366 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
| 21367 | Token * _literal; |
| 21368 | if ( |
| 21369 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 21370 | ) |
| 21371 | { |
| 21372 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
| 21373 | _res = _literal; |
| 21374 | goto done; |
| 21375 | } |
| 21376 | p->mark = _mark; |
| 21377 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ', |
| 21378 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21379 | } |
| 21380 | _res = NULL; |
| 21381 | done: |
| 21382 | D(p->level--); |
| 21383 | return _res; |
| 21384 | } |
| 21385 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21386 | // _loop1_48: except_block |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21387 | static asdl_seq * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21388 | _loop1_48_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21389 | { |
| 21390 | D(p->level++); |
| 21391 | if (p->error_indicator) { |
| 21392 | D(p->level--); |
| 21393 | return NULL; |
| 21394 | } |
| 21395 | void *_res = NULL; |
| 21396 | int _mark = p->mark; |
| 21397 | int _start_mark = p->mark; |
| 21398 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21399 | if (!_children) { |
| 21400 | p->error_indicator = 1; |
| 21401 | PyErr_NoMemory(); |
| 21402 | D(p->level--); |
| 21403 | return NULL; |
| 21404 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21405 | Py_ssize_t _children_capacity = 1; |
| 21406 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21407 | { // except_block |
| 21408 | if (p->error_indicator) { |
| 21409 | D(p->level--); |
| 21410 | return NULL; |
| 21411 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21412 | 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] | 21413 | excepthandler_ty except_block_var; |
| 21414 | while ( |
| 21415 | (except_block_var = except_block_rule(p)) // except_block |
| 21416 | ) |
| 21417 | { |
| 21418 | _res = except_block_var; |
| 21419 | if (_n == _children_capacity) { |
| 21420 | _children_capacity *= 2; |
| 21421 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21422 | if (!_new_children) { |
| 21423 | p->error_indicator = 1; |
| 21424 | PyErr_NoMemory(); |
| 21425 | D(p->level--); |
| 21426 | return NULL; |
| 21427 | } |
| 21428 | _children = _new_children; |
| 21429 | } |
| 21430 | _children[_n++] = _res; |
| 21431 | _mark = p->mark; |
| 21432 | } |
| 21433 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21434 | 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] | 21435 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); |
| 21436 | } |
| 21437 | if (_n == 0 || p->error_indicator) { |
| 21438 | PyMem_Free(_children); |
| 21439 | D(p->level--); |
| 21440 | return NULL; |
| 21441 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21442 | 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] | 21443 | if (!_seq) { |
| 21444 | PyMem_Free(_children); |
| 21445 | p->error_indicator = 1; |
| 21446 | PyErr_NoMemory(); |
| 21447 | D(p->level--); |
| 21448 | return NULL; |
| 21449 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 21450 | 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] | 21451 | PyMem_Free(_children); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21452 | _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21453 | D(p->level--); |
| 21454 | return _seq; |
| 21455 | } |
| 21456 | |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21457 | // _tmp_49: 'as' NAME |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21458 | static void * |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21459 | _tmp_49_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21460 | { |
| 21461 | D(p->level++); |
| 21462 | if (p->error_indicator) { |
| 21463 | D(p->level--); |
| 21464 | return NULL; |
| 21465 | } |
| 21466 | void * _res = NULL; |
| 21467 | int _mark = p->mark; |
| 21468 | { // 'as' NAME |
| 21469 | if (p->error_indicator) { |
| 21470 | D(p->level--); |
| 21471 | return NULL; |
| 21472 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21473 | 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] | 21474 | Token * _keyword; |
| 21475 | expr_ty z; |
| 21476 | if ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21477 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21478 | && |
| 21479 | (z = _PyPegen_name_token(p)) // NAME |
| 21480 | ) |
| 21481 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21482 | 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] | 21483 | _res = z; |
| 21484 | if (_res == NULL && PyErr_Occurred()) { |
| 21485 | p->error_indicator = 1; |
| 21486 | D(p->level--); |
| 21487 | return NULL; |
| 21488 | } |
| 21489 | goto done; |
| 21490 | } |
| 21491 | p->mark = _mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 21492 | 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] | 21493 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 21494 | } |
| 21495 | _res = NULL; |
| 21496 | done: |
| 21497 | D(p->level--); |
| 21498 | return _res; |
| 21499 | } |
| 21500 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21501 | // _loop1_50: case_block |
| 21502 | static asdl_seq * |
| 21503 | _loop1_50_rule(Parser *p) |
| 21504 | { |
| 21505 | D(p->level++); |
| 21506 | if (p->error_indicator) { |
| 21507 | D(p->level--); |
| 21508 | return NULL; |
| 21509 | } |
| 21510 | void *_res = NULL; |
| 21511 | int _mark = p->mark; |
| 21512 | int _start_mark = p->mark; |
| 21513 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21514 | if (!_children) { |
| 21515 | p->error_indicator = 1; |
| 21516 | PyErr_NoMemory(); |
| 21517 | D(p->level--); |
| 21518 | return NULL; |
| 21519 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21520 | Py_ssize_t _children_capacity = 1; |
| 21521 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21522 | { // case_block |
| 21523 | if (p->error_indicator) { |
| 21524 | D(p->level--); |
| 21525 | return NULL; |
| 21526 | } |
| 21527 | D(fprintf(stderr, "%*c> _loop1_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block")); |
| 21528 | match_case_ty case_block_var; |
| 21529 | while ( |
| 21530 | (case_block_var = case_block_rule(p)) // case_block |
| 21531 | ) |
| 21532 | { |
| 21533 | _res = case_block_var; |
| 21534 | if (_n == _children_capacity) { |
| 21535 | _children_capacity *= 2; |
| 21536 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21537 | if (!_new_children) { |
| 21538 | p->error_indicator = 1; |
| 21539 | PyErr_NoMemory(); |
| 21540 | D(p->level--); |
| 21541 | return NULL; |
| 21542 | } |
| 21543 | _children = _new_children; |
| 21544 | } |
| 21545 | _children[_n++] = _res; |
| 21546 | _mark = p->mark; |
| 21547 | } |
| 21548 | p->mark = _mark; |
| 21549 | D(fprintf(stderr, "%*c%s _loop1_50[%d-%d]: %s failed!\n", p->level, ' ', |
| 21550 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block")); |
| 21551 | } |
| 21552 | if (_n == 0 || p->error_indicator) { |
| 21553 | PyMem_Free(_children); |
| 21554 | D(p->level--); |
| 21555 | return NULL; |
| 21556 | } |
| 21557 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 21558 | if (!_seq) { |
| 21559 | PyMem_Free(_children); |
| 21560 | p->error_indicator = 1; |
| 21561 | PyErr_NoMemory(); |
| 21562 | D(p->level--); |
| 21563 | return NULL; |
| 21564 | } |
| 21565 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 21566 | PyMem_Free(_children); |
| 21567 | _PyPegen_insert_memo(p, _start_mark, _loop1_50_type, _seq); |
| 21568 | D(p->level--); |
| 21569 | return _seq; |
| 21570 | } |
| 21571 | |
| 21572 | // _loop0_52: '|' closed_pattern |
| 21573 | static asdl_seq * |
| 21574 | _loop0_52_rule(Parser *p) |
| 21575 | { |
| 21576 | D(p->level++); |
| 21577 | if (p->error_indicator) { |
| 21578 | D(p->level--); |
| 21579 | return NULL; |
| 21580 | } |
| 21581 | void *_res = NULL; |
| 21582 | int _mark = p->mark; |
| 21583 | int _start_mark = p->mark; |
| 21584 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21585 | if (!_children) { |
| 21586 | p->error_indicator = 1; |
| 21587 | PyErr_NoMemory(); |
| 21588 | D(p->level--); |
| 21589 | return NULL; |
| 21590 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21591 | Py_ssize_t _children_capacity = 1; |
| 21592 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21593 | { // '|' closed_pattern |
| 21594 | if (p->error_indicator) { |
| 21595 | D(p->level--); |
| 21596 | return NULL; |
| 21597 | } |
| 21598 | D(fprintf(stderr, "%*c> _loop0_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern")); |
| 21599 | Token * _literal; |
| 21600 | expr_ty elem; |
| 21601 | while ( |
| 21602 | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
| 21603 | && |
| 21604 | (elem = closed_pattern_rule(p)) // closed_pattern |
| 21605 | ) |
| 21606 | { |
| 21607 | _res = elem; |
| 21608 | if (_res == NULL && PyErr_Occurred()) { |
| 21609 | p->error_indicator = 1; |
| 21610 | PyMem_Free(_children); |
| 21611 | D(p->level--); |
| 21612 | return NULL; |
| 21613 | } |
| 21614 | if (_n == _children_capacity) { |
| 21615 | _children_capacity *= 2; |
| 21616 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21617 | if (!_new_children) { |
| 21618 | p->error_indicator = 1; |
| 21619 | PyErr_NoMemory(); |
| 21620 | D(p->level--); |
| 21621 | return NULL; |
| 21622 | } |
| 21623 | _children = _new_children; |
| 21624 | } |
| 21625 | _children[_n++] = _res; |
| 21626 | _mark = p->mark; |
| 21627 | } |
| 21628 | p->mark = _mark; |
| 21629 | D(fprintf(stderr, "%*c%s _loop0_52[%d-%d]: %s failed!\n", p->level, ' ', |
| 21630 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern")); |
| 21631 | } |
| 21632 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 21633 | if (!_seq) { |
| 21634 | PyMem_Free(_children); |
| 21635 | p->error_indicator = 1; |
| 21636 | PyErr_NoMemory(); |
| 21637 | D(p->level--); |
| 21638 | return NULL; |
| 21639 | } |
| 21640 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 21641 | PyMem_Free(_children); |
| 21642 | _PyPegen_insert_memo(p, _start_mark, _loop0_52_type, _seq); |
| 21643 | D(p->level--); |
| 21644 | return _seq; |
| 21645 | } |
| 21646 | |
| 21647 | // _gather_51: closed_pattern _loop0_52 |
| 21648 | static asdl_seq * |
| 21649 | _gather_51_rule(Parser *p) |
| 21650 | { |
| 21651 | D(p->level++); |
| 21652 | if (p->error_indicator) { |
| 21653 | D(p->level--); |
| 21654 | return NULL; |
| 21655 | } |
| 21656 | asdl_seq * _res = NULL; |
| 21657 | int _mark = p->mark; |
| 21658 | { // closed_pattern _loop0_52 |
| 21659 | if (p->error_indicator) { |
| 21660 | D(p->level--); |
| 21661 | return NULL; |
| 21662 | } |
| 21663 | D(fprintf(stderr, "%*c> _gather_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52")); |
| 21664 | expr_ty elem; |
| 21665 | asdl_seq * seq; |
| 21666 | if ( |
| 21667 | (elem = closed_pattern_rule(p)) // closed_pattern |
| 21668 | && |
| 21669 | (seq = _loop0_52_rule(p)) // _loop0_52 |
| 21670 | ) |
| 21671 | { |
| 21672 | D(fprintf(stderr, "%*c+ _gather_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52")); |
| 21673 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21674 | goto done; |
| 21675 | } |
| 21676 | p->mark = _mark; |
| 21677 | D(fprintf(stderr, "%*c%s _gather_51[%d-%d]: %s failed!\n", p->level, ' ', |
| 21678 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_52")); |
| 21679 | } |
| 21680 | _res = NULL; |
| 21681 | done: |
| 21682 | D(p->level--); |
| 21683 | return _res; |
| 21684 | } |
| 21685 | |
| 21686 | // _tmp_53: '+' | '-' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 21687 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21688 | _tmp_53_rule(Parser *p) |
| 21689 | { |
| 21690 | D(p->level++); |
| 21691 | if (p->error_indicator) { |
| 21692 | D(p->level--); |
| 21693 | return NULL; |
| 21694 | } |
| 21695 | void * _res = NULL; |
| 21696 | int _mark = p->mark; |
| 21697 | { // '+' |
| 21698 | if (p->error_indicator) { |
| 21699 | D(p->level--); |
| 21700 | return NULL; |
| 21701 | } |
| 21702 | D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); |
| 21703 | Token * _literal; |
| 21704 | if ( |
| 21705 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
| 21706 | ) |
| 21707 | { |
| 21708 | D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); |
| 21709 | _res = _literal; |
| 21710 | goto done; |
| 21711 | } |
| 21712 | p->mark = _mark; |
| 21713 | D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', |
| 21714 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); |
| 21715 | } |
| 21716 | { // '-' |
| 21717 | if (p->error_indicator) { |
| 21718 | D(p->level--); |
| 21719 | return NULL; |
| 21720 | } |
| 21721 | D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); |
| 21722 | Token * _literal; |
| 21723 | if ( |
| 21724 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
| 21725 | ) |
| 21726 | { |
| 21727 | D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'")); |
| 21728 | _res = _literal; |
| 21729 | goto done; |
| 21730 | } |
| 21731 | p->mark = _mark; |
| 21732 | D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', |
| 21733 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); |
| 21734 | } |
| 21735 | _res = NULL; |
| 21736 | done: |
| 21737 | D(p->level--); |
| 21738 | return _res; |
| 21739 | } |
| 21740 | |
| 21741 | // _tmp_54: '.' | '(' | '=' |
| 21742 | static void * |
| 21743 | _tmp_54_rule(Parser *p) |
| 21744 | { |
| 21745 | D(p->level++); |
| 21746 | if (p->error_indicator) { |
| 21747 | D(p->level--); |
| 21748 | return NULL; |
| 21749 | } |
| 21750 | void * _res = NULL; |
| 21751 | int _mark = p->mark; |
| 21752 | { // '.' |
| 21753 | if (p->error_indicator) { |
| 21754 | D(p->level--); |
| 21755 | return NULL; |
| 21756 | } |
| 21757 | D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 21758 | Token * _literal; |
| 21759 | if ( |
| 21760 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 21761 | ) |
| 21762 | { |
| 21763 | D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 21764 | _res = _literal; |
| 21765 | goto done; |
| 21766 | } |
| 21767 | p->mark = _mark; |
| 21768 | D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', |
| 21769 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 21770 | } |
| 21771 | { // '(' |
| 21772 | if (p->error_indicator) { |
| 21773 | D(p->level--); |
| 21774 | return NULL; |
| 21775 | } |
| 21776 | D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
| 21777 | Token * _literal; |
| 21778 | if ( |
| 21779 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 21780 | ) |
| 21781 | { |
| 21782 | D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
| 21783 | _res = _literal; |
| 21784 | goto done; |
| 21785 | } |
| 21786 | p->mark = _mark; |
| 21787 | D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', |
| 21788 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
| 21789 | } |
| 21790 | { // '=' |
| 21791 | if (p->error_indicator) { |
| 21792 | D(p->level--); |
| 21793 | return NULL; |
| 21794 | } |
| 21795 | D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); |
| 21796 | Token * _literal; |
| 21797 | if ( |
| 21798 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 21799 | ) |
| 21800 | { |
| 21801 | D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); |
| 21802 | _res = _literal; |
| 21803 | goto done; |
| 21804 | } |
| 21805 | p->mark = _mark; |
| 21806 | D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', |
| 21807 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); |
| 21808 | } |
| 21809 | _res = NULL; |
| 21810 | done: |
| 21811 | D(p->level--); |
| 21812 | return _res; |
| 21813 | } |
| 21814 | |
| 21815 | // _tmp_55: '.' | '(' | '=' |
| 21816 | static void * |
| 21817 | _tmp_55_rule(Parser *p) |
| 21818 | { |
| 21819 | D(p->level++); |
| 21820 | if (p->error_indicator) { |
| 21821 | D(p->level--); |
| 21822 | return NULL; |
| 21823 | } |
| 21824 | void * _res = NULL; |
| 21825 | int _mark = p->mark; |
| 21826 | { // '.' |
| 21827 | if (p->error_indicator) { |
| 21828 | D(p->level--); |
| 21829 | return NULL; |
| 21830 | } |
| 21831 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 21832 | Token * _literal; |
| 21833 | if ( |
| 21834 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 21835 | ) |
| 21836 | { |
| 21837 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 21838 | _res = _literal; |
| 21839 | goto done; |
| 21840 | } |
| 21841 | p->mark = _mark; |
| 21842 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', |
| 21843 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 21844 | } |
| 21845 | { // '(' |
| 21846 | if (p->error_indicator) { |
| 21847 | D(p->level--); |
| 21848 | return NULL; |
| 21849 | } |
| 21850 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
| 21851 | Token * _literal; |
| 21852 | if ( |
| 21853 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 21854 | ) |
| 21855 | { |
| 21856 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
| 21857 | _res = _literal; |
| 21858 | goto done; |
| 21859 | } |
| 21860 | p->mark = _mark; |
| 21861 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', |
| 21862 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
| 21863 | } |
| 21864 | { // '=' |
| 21865 | if (p->error_indicator) { |
| 21866 | D(p->level--); |
| 21867 | return NULL; |
| 21868 | } |
| 21869 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); |
| 21870 | Token * _literal; |
| 21871 | if ( |
| 21872 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 21873 | ) |
| 21874 | { |
| 21875 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); |
| 21876 | _res = _literal; |
| 21877 | goto done; |
| 21878 | } |
| 21879 | p->mark = _mark; |
| 21880 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', |
| 21881 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); |
| 21882 | } |
| 21883 | _res = NULL; |
| 21884 | done: |
| 21885 | D(p->level--); |
| 21886 | return _res; |
| 21887 | } |
| 21888 | |
| 21889 | // _loop0_57: ',' maybe_star_pattern |
| 21890 | static asdl_seq * |
| 21891 | _loop0_57_rule(Parser *p) |
| 21892 | { |
| 21893 | D(p->level++); |
| 21894 | if (p->error_indicator) { |
| 21895 | D(p->level--); |
| 21896 | return NULL; |
| 21897 | } |
| 21898 | void *_res = NULL; |
| 21899 | int _mark = p->mark; |
| 21900 | int _start_mark = p->mark; |
| 21901 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21902 | if (!_children) { |
| 21903 | p->error_indicator = 1; |
| 21904 | PyErr_NoMemory(); |
| 21905 | D(p->level--); |
| 21906 | return NULL; |
| 21907 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 21908 | Py_ssize_t _children_capacity = 1; |
| 21909 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 21910 | { // ',' maybe_star_pattern |
| 21911 | if (p->error_indicator) { |
| 21912 | D(p->level--); |
| 21913 | return NULL; |
| 21914 | } |
| 21915 | D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern")); |
| 21916 | Token * _literal; |
| 21917 | expr_ty elem; |
| 21918 | while ( |
| 21919 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 21920 | && |
| 21921 | (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern |
| 21922 | ) |
| 21923 | { |
| 21924 | _res = elem; |
| 21925 | if (_res == NULL && PyErr_Occurred()) { |
| 21926 | p->error_indicator = 1; |
| 21927 | PyMem_Free(_children); |
| 21928 | D(p->level--); |
| 21929 | return NULL; |
| 21930 | } |
| 21931 | if (_n == _children_capacity) { |
| 21932 | _children_capacity *= 2; |
| 21933 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21934 | if (!_new_children) { |
| 21935 | p->error_indicator = 1; |
| 21936 | PyErr_NoMemory(); |
| 21937 | D(p->level--); |
| 21938 | return NULL; |
| 21939 | } |
| 21940 | _children = _new_children; |
| 21941 | } |
| 21942 | _children[_n++] = _res; |
| 21943 | _mark = p->mark; |
| 21944 | } |
| 21945 | p->mark = _mark; |
| 21946 | D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', |
| 21947 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern")); |
| 21948 | } |
| 21949 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 21950 | if (!_seq) { |
| 21951 | PyMem_Free(_children); |
| 21952 | p->error_indicator = 1; |
| 21953 | PyErr_NoMemory(); |
| 21954 | D(p->level--); |
| 21955 | return NULL; |
| 21956 | } |
| 21957 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 21958 | PyMem_Free(_children); |
| 21959 | _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); |
| 21960 | D(p->level--); |
| 21961 | return _seq; |
| 21962 | } |
| 21963 | |
| 21964 | // _gather_56: maybe_star_pattern _loop0_57 |
| 21965 | static asdl_seq * |
| 21966 | _gather_56_rule(Parser *p) |
| 21967 | { |
| 21968 | D(p->level++); |
| 21969 | if (p->error_indicator) { |
| 21970 | D(p->level--); |
| 21971 | return NULL; |
| 21972 | } |
| 21973 | asdl_seq * _res = NULL; |
| 21974 | int _mark = p->mark; |
| 21975 | { // maybe_star_pattern _loop0_57 |
| 21976 | if (p->error_indicator) { |
| 21977 | D(p->level--); |
| 21978 | return NULL; |
| 21979 | } |
| 21980 | D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_57")); |
| 21981 | expr_ty elem; |
| 21982 | asdl_seq * seq; |
| 21983 | if ( |
| 21984 | (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern |
| 21985 | && |
| 21986 | (seq = _loop0_57_rule(p)) // _loop0_57 |
| 21987 | ) |
| 21988 | { |
| 21989 | D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_57")); |
| 21990 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 21991 | goto done; |
| 21992 | } |
| 21993 | p->mark = _mark; |
| 21994 | D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ', |
| 21995 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_57")); |
| 21996 | } |
| 21997 | _res = NULL; |
| 21998 | done: |
| 21999 | D(p->level--); |
| 22000 | return _res; |
| 22001 | } |
| 22002 | |
| 22003 | // _tmp_58: capture_pattern | wildcard_pattern |
| 22004 | static void * |
| 22005 | _tmp_58_rule(Parser *p) |
| 22006 | { |
| 22007 | D(p->level++); |
| 22008 | if (p->error_indicator) { |
| 22009 | D(p->level--); |
| 22010 | return NULL; |
| 22011 | } |
| 22012 | void * _res = NULL; |
| 22013 | int _mark = p->mark; |
| 22014 | { // capture_pattern |
| 22015 | if (p->error_indicator) { |
| 22016 | D(p->level--); |
| 22017 | return NULL; |
| 22018 | } |
| 22019 | D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
| 22020 | expr_ty capture_pattern_var; |
| 22021 | if ( |
| 22022 | (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern |
| 22023 | ) |
| 22024 | { |
| 22025 | D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
| 22026 | _res = capture_pattern_var; |
| 22027 | goto done; |
| 22028 | } |
| 22029 | p->mark = _mark; |
| 22030 | D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ', |
| 22031 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern")); |
| 22032 | } |
| 22033 | { // wildcard_pattern |
| 22034 | if (p->error_indicator) { |
| 22035 | D(p->level--); |
| 22036 | return NULL; |
| 22037 | } |
| 22038 | D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
| 22039 | expr_ty wildcard_pattern_var; |
| 22040 | if ( |
| 22041 | (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern |
| 22042 | ) |
| 22043 | { |
| 22044 | D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
| 22045 | _res = wildcard_pattern_var; |
| 22046 | goto done; |
| 22047 | } |
| 22048 | p->mark = _mark; |
| 22049 | D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ', |
| 22050 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern")); |
| 22051 | } |
| 22052 | _res = NULL; |
| 22053 | done: |
| 22054 | D(p->level--); |
| 22055 | return _res; |
| 22056 | } |
| 22057 | |
| 22058 | // _loop0_60: ',' key_value_pattern |
| 22059 | static asdl_seq * |
| 22060 | _loop0_60_rule(Parser *p) |
| 22061 | { |
| 22062 | D(p->level++); |
| 22063 | if (p->error_indicator) { |
| 22064 | D(p->level--); |
| 22065 | return NULL; |
| 22066 | } |
| 22067 | void *_res = NULL; |
| 22068 | int _mark = p->mark; |
| 22069 | int _start_mark = p->mark; |
| 22070 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22071 | if (!_children) { |
| 22072 | p->error_indicator = 1; |
| 22073 | PyErr_NoMemory(); |
| 22074 | D(p->level--); |
| 22075 | return NULL; |
| 22076 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22077 | Py_ssize_t _children_capacity = 1; |
| 22078 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22079 | { // ',' key_value_pattern |
| 22080 | if (p->error_indicator) { |
| 22081 | D(p->level--); |
| 22082 | return NULL; |
| 22083 | } |
| 22084 | D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); |
| 22085 | Token * _literal; |
| 22086 | KeyValuePair* elem; |
| 22087 | while ( |
| 22088 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 22089 | && |
| 22090 | (elem = key_value_pattern_rule(p)) // key_value_pattern |
| 22091 | ) |
| 22092 | { |
| 22093 | _res = elem; |
| 22094 | if (_res == NULL && PyErr_Occurred()) { |
| 22095 | p->error_indicator = 1; |
| 22096 | PyMem_Free(_children); |
| 22097 | D(p->level--); |
| 22098 | return NULL; |
| 22099 | } |
| 22100 | if (_n == _children_capacity) { |
| 22101 | _children_capacity *= 2; |
| 22102 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22103 | if (!_new_children) { |
| 22104 | p->error_indicator = 1; |
| 22105 | PyErr_NoMemory(); |
| 22106 | D(p->level--); |
| 22107 | return NULL; |
| 22108 | } |
| 22109 | _children = _new_children; |
| 22110 | } |
| 22111 | _children[_n++] = _res; |
| 22112 | _mark = p->mark; |
| 22113 | } |
| 22114 | p->mark = _mark; |
| 22115 | D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n", p->level, ' ', |
| 22116 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); |
| 22117 | } |
| 22118 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 22119 | if (!_seq) { |
| 22120 | PyMem_Free(_children); |
| 22121 | p->error_indicator = 1; |
| 22122 | PyErr_NoMemory(); |
| 22123 | D(p->level--); |
| 22124 | return NULL; |
| 22125 | } |
| 22126 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 22127 | PyMem_Free(_children); |
| 22128 | _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq); |
| 22129 | D(p->level--); |
| 22130 | return _seq; |
| 22131 | } |
| 22132 | |
| 22133 | // _gather_59: key_value_pattern _loop0_60 |
| 22134 | static asdl_seq * |
| 22135 | _gather_59_rule(Parser *p) |
| 22136 | { |
| 22137 | D(p->level++); |
| 22138 | if (p->error_indicator) { |
| 22139 | D(p->level--); |
| 22140 | return NULL; |
| 22141 | } |
| 22142 | asdl_seq * _res = NULL; |
| 22143 | int _mark = p->mark; |
| 22144 | { // key_value_pattern _loop0_60 |
| 22145 | if (p->error_indicator) { |
| 22146 | D(p->level--); |
| 22147 | return NULL; |
| 22148 | } |
| 22149 | D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60")); |
| 22150 | KeyValuePair* elem; |
| 22151 | asdl_seq * seq; |
| 22152 | if ( |
| 22153 | (elem = key_value_pattern_rule(p)) // key_value_pattern |
| 22154 | && |
| 22155 | (seq = _loop0_60_rule(p)) // _loop0_60 |
| 22156 | ) |
| 22157 | { |
| 22158 | D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60")); |
| 22159 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 22160 | goto done; |
| 22161 | } |
| 22162 | p->mark = _mark; |
| 22163 | D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n", p->level, ' ', |
| 22164 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_60")); |
| 22165 | } |
| 22166 | _res = NULL; |
| 22167 | done: |
| 22168 | D(p->level--); |
| 22169 | return _res; |
| 22170 | } |
| 22171 | |
| 22172 | // _tmp_61: literal_pattern | value_pattern |
| 22173 | static void * |
| 22174 | _tmp_61_rule(Parser *p) |
| 22175 | { |
| 22176 | D(p->level++); |
| 22177 | if (p->error_indicator) { |
| 22178 | D(p->level--); |
| 22179 | return NULL; |
| 22180 | } |
| 22181 | void * _res = NULL; |
| 22182 | int _mark = p->mark; |
| 22183 | { // literal_pattern |
| 22184 | if (p->error_indicator) { |
| 22185 | D(p->level--); |
| 22186 | return NULL; |
| 22187 | } |
| 22188 | D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
| 22189 | expr_ty literal_pattern_var; |
| 22190 | if ( |
| 22191 | (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern |
| 22192 | ) |
| 22193 | { |
| 22194 | D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
| 22195 | _res = literal_pattern_var; |
| 22196 | goto done; |
| 22197 | } |
| 22198 | p->mark = _mark; |
| 22199 | D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', |
| 22200 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); |
| 22201 | } |
| 22202 | { // value_pattern |
| 22203 | if (p->error_indicator) { |
| 22204 | D(p->level--); |
| 22205 | return NULL; |
| 22206 | } |
| 22207 | D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
| 22208 | expr_ty value_pattern_var; |
| 22209 | if ( |
| 22210 | (value_pattern_var = value_pattern_rule(p)) // value_pattern |
| 22211 | ) |
| 22212 | { |
| 22213 | D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
| 22214 | _res = value_pattern_var; |
| 22215 | goto done; |
| 22216 | } |
| 22217 | p->mark = _mark; |
| 22218 | D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', |
| 22219 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern")); |
| 22220 | } |
| 22221 | _res = NULL; |
| 22222 | done: |
| 22223 | D(p->level--); |
| 22224 | return _res; |
| 22225 | } |
| 22226 | |
| 22227 | // _loop0_63: ',' pattern |
| 22228 | static asdl_seq * |
| 22229 | _loop0_63_rule(Parser *p) |
| 22230 | { |
| 22231 | D(p->level++); |
| 22232 | if (p->error_indicator) { |
| 22233 | D(p->level--); |
| 22234 | return NULL; |
| 22235 | } |
| 22236 | void *_res = NULL; |
| 22237 | int _mark = p->mark; |
| 22238 | int _start_mark = p->mark; |
| 22239 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22240 | if (!_children) { |
| 22241 | p->error_indicator = 1; |
| 22242 | PyErr_NoMemory(); |
| 22243 | D(p->level--); |
| 22244 | return NULL; |
| 22245 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22246 | Py_ssize_t _children_capacity = 1; |
| 22247 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22248 | { // ',' pattern |
| 22249 | if (p->error_indicator) { |
| 22250 | D(p->level--); |
| 22251 | return NULL; |
| 22252 | } |
| 22253 | D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); |
| 22254 | Token * _literal; |
| 22255 | expr_ty elem; |
| 22256 | while ( |
| 22257 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 22258 | && |
| 22259 | (elem = pattern_rule(p)) // pattern |
| 22260 | ) |
| 22261 | { |
| 22262 | _res = elem; |
| 22263 | if (_res == NULL && PyErr_Occurred()) { |
| 22264 | p->error_indicator = 1; |
| 22265 | PyMem_Free(_children); |
| 22266 | D(p->level--); |
| 22267 | return NULL; |
| 22268 | } |
| 22269 | if (_n == _children_capacity) { |
| 22270 | _children_capacity *= 2; |
| 22271 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22272 | if (!_new_children) { |
| 22273 | p->error_indicator = 1; |
| 22274 | PyErr_NoMemory(); |
| 22275 | D(p->level--); |
| 22276 | return NULL; |
| 22277 | } |
| 22278 | _children = _new_children; |
| 22279 | } |
| 22280 | _children[_n++] = _res; |
| 22281 | _mark = p->mark; |
| 22282 | } |
| 22283 | p->mark = _mark; |
| 22284 | D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', |
| 22285 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); |
| 22286 | } |
| 22287 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 22288 | if (!_seq) { |
| 22289 | PyMem_Free(_children); |
| 22290 | p->error_indicator = 1; |
| 22291 | PyErr_NoMemory(); |
| 22292 | D(p->level--); |
| 22293 | return NULL; |
| 22294 | } |
| 22295 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 22296 | PyMem_Free(_children); |
| 22297 | _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); |
| 22298 | D(p->level--); |
| 22299 | return _seq; |
| 22300 | } |
| 22301 | |
| 22302 | // _gather_62: pattern _loop0_63 |
| 22303 | static asdl_seq * |
| 22304 | _gather_62_rule(Parser *p) |
| 22305 | { |
| 22306 | D(p->level++); |
| 22307 | if (p->error_indicator) { |
| 22308 | D(p->level--); |
| 22309 | return NULL; |
| 22310 | } |
| 22311 | asdl_seq * _res = NULL; |
| 22312 | int _mark = p->mark; |
| 22313 | { // pattern _loop0_63 |
| 22314 | if (p->error_indicator) { |
| 22315 | D(p->level--); |
| 22316 | return NULL; |
| 22317 | } |
| 22318 | D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63")); |
| 22319 | expr_ty elem; |
| 22320 | asdl_seq * seq; |
| 22321 | if ( |
| 22322 | (elem = pattern_rule(p)) // pattern |
| 22323 | && |
| 22324 | (seq = _loop0_63_rule(p)) // _loop0_63 |
| 22325 | ) |
| 22326 | { |
| 22327 | D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63")); |
| 22328 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 22329 | goto done; |
| 22330 | } |
| 22331 | p->mark = _mark; |
| 22332 | D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', |
| 22333 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_63")); |
| 22334 | } |
| 22335 | _res = NULL; |
| 22336 | done: |
| 22337 | D(p->level--); |
| 22338 | return _res; |
| 22339 | } |
| 22340 | |
| 22341 | // _loop0_65: ',' keyword_pattern |
| 22342 | static asdl_seq * |
| 22343 | _loop0_65_rule(Parser *p) |
| 22344 | { |
| 22345 | D(p->level++); |
| 22346 | if (p->error_indicator) { |
| 22347 | D(p->level--); |
| 22348 | return NULL; |
| 22349 | } |
| 22350 | void *_res = NULL; |
| 22351 | int _mark = p->mark; |
| 22352 | int _start_mark = p->mark; |
| 22353 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22354 | if (!_children) { |
| 22355 | p->error_indicator = 1; |
| 22356 | PyErr_NoMemory(); |
| 22357 | D(p->level--); |
| 22358 | return NULL; |
| 22359 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22360 | Py_ssize_t _children_capacity = 1; |
| 22361 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22362 | { // ',' keyword_pattern |
| 22363 | if (p->error_indicator) { |
| 22364 | D(p->level--); |
| 22365 | return NULL; |
| 22366 | } |
| 22367 | D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); |
| 22368 | Token * _literal; |
| 22369 | keyword_ty elem; |
| 22370 | while ( |
| 22371 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 22372 | && |
| 22373 | (elem = keyword_pattern_rule(p)) // keyword_pattern |
| 22374 | ) |
| 22375 | { |
| 22376 | _res = elem; |
| 22377 | if (_res == NULL && PyErr_Occurred()) { |
| 22378 | p->error_indicator = 1; |
| 22379 | PyMem_Free(_children); |
| 22380 | D(p->level--); |
| 22381 | return NULL; |
| 22382 | } |
| 22383 | if (_n == _children_capacity) { |
| 22384 | _children_capacity *= 2; |
| 22385 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22386 | if (!_new_children) { |
| 22387 | p->error_indicator = 1; |
| 22388 | PyErr_NoMemory(); |
| 22389 | D(p->level--); |
| 22390 | return NULL; |
| 22391 | } |
| 22392 | _children = _new_children; |
| 22393 | } |
| 22394 | _children[_n++] = _res; |
| 22395 | _mark = p->mark; |
| 22396 | } |
| 22397 | p->mark = _mark; |
| 22398 | D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ', |
| 22399 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); |
| 22400 | } |
| 22401 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 22402 | if (!_seq) { |
| 22403 | PyMem_Free(_children); |
| 22404 | p->error_indicator = 1; |
| 22405 | PyErr_NoMemory(); |
| 22406 | D(p->level--); |
| 22407 | return NULL; |
| 22408 | } |
| 22409 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 22410 | PyMem_Free(_children); |
| 22411 | _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); |
| 22412 | D(p->level--); |
| 22413 | return _seq; |
| 22414 | } |
| 22415 | |
| 22416 | // _gather_64: keyword_pattern _loop0_65 |
| 22417 | static asdl_seq * |
| 22418 | _gather_64_rule(Parser *p) |
| 22419 | { |
| 22420 | D(p->level++); |
| 22421 | if (p->error_indicator) { |
| 22422 | D(p->level--); |
| 22423 | return NULL; |
| 22424 | } |
| 22425 | asdl_seq * _res = NULL; |
| 22426 | int _mark = p->mark; |
| 22427 | { // keyword_pattern _loop0_65 |
| 22428 | if (p->error_indicator) { |
| 22429 | D(p->level--); |
| 22430 | return NULL; |
| 22431 | } |
| 22432 | D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65")); |
| 22433 | keyword_ty elem; |
| 22434 | asdl_seq * seq; |
| 22435 | if ( |
| 22436 | (elem = keyword_pattern_rule(p)) // keyword_pattern |
| 22437 | && |
| 22438 | (seq = _loop0_65_rule(p)) // _loop0_65 |
| 22439 | ) |
| 22440 | { |
| 22441 | D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65")); |
| 22442 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 22443 | goto done; |
| 22444 | } |
| 22445 | p->mark = _mark; |
| 22446 | D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ', |
| 22447 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_65")); |
| 22448 | } |
| 22449 | _res = NULL; |
| 22450 | done: |
| 22451 | D(p->level--); |
| 22452 | return _res; |
| 22453 | } |
| 22454 | |
| 22455 | // _tmp_66: 'from' expression |
| 22456 | static void * |
| 22457 | _tmp_66_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22458 | { |
| 22459 | D(p->level++); |
| 22460 | if (p->error_indicator) { |
| 22461 | D(p->level--); |
| 22462 | return NULL; |
| 22463 | } |
| 22464 | void * _res = NULL; |
| 22465 | int _mark = p->mark; |
| 22466 | { // 'from' expression |
| 22467 | if (p->error_indicator) { |
| 22468 | D(p->level--); |
| 22469 | return NULL; |
| 22470 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22471 | 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] | 22472 | Token * _keyword; |
| 22473 | expr_ty z; |
| 22474 | if ( |
| 22475 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
| 22476 | && |
| 22477 | (z = expression_rule(p)) // expression |
| 22478 | ) |
| 22479 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22480 | 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] | 22481 | _res = z; |
| 22482 | if (_res == NULL && PyErr_Occurred()) { |
| 22483 | p->error_indicator = 1; |
| 22484 | D(p->level--); |
| 22485 | return NULL; |
| 22486 | } |
| 22487 | goto done; |
| 22488 | } |
| 22489 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22490 | 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] | 22491 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22492 | } |
| 22493 | _res = NULL; |
| 22494 | done: |
| 22495 | D(p->level--); |
| 22496 | return _res; |
| 22497 | } |
| 22498 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22499 | // _tmp_67: '->' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22500 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22501 | _tmp_67_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22502 | { |
| 22503 | D(p->level++); |
| 22504 | if (p->error_indicator) { |
| 22505 | D(p->level--); |
| 22506 | return NULL; |
| 22507 | } |
| 22508 | void * _res = NULL; |
| 22509 | int _mark = p->mark; |
| 22510 | { // '->' expression |
| 22511 | if (p->error_indicator) { |
| 22512 | D(p->level--); |
| 22513 | return NULL; |
| 22514 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22515 | 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] | 22516 | Token * _literal; |
| 22517 | expr_ty z; |
| 22518 | if ( |
| 22519 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
| 22520 | && |
| 22521 | (z = expression_rule(p)) // expression |
| 22522 | ) |
| 22523 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22524 | 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] | 22525 | _res = z; |
| 22526 | if (_res == NULL && PyErr_Occurred()) { |
| 22527 | p->error_indicator = 1; |
| 22528 | D(p->level--); |
| 22529 | return NULL; |
| 22530 | } |
| 22531 | goto done; |
| 22532 | } |
| 22533 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22534 | 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] | 22535 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
| 22536 | } |
| 22537 | _res = NULL; |
| 22538 | done: |
| 22539 | D(p->level--); |
| 22540 | return _res; |
| 22541 | } |
| 22542 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22543 | // _tmp_68: '->' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22544 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22545 | _tmp_68_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22546 | { |
| 22547 | D(p->level++); |
| 22548 | if (p->error_indicator) { |
| 22549 | D(p->level--); |
| 22550 | return NULL; |
| 22551 | } |
| 22552 | void * _res = NULL; |
| 22553 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22554 | { // '->' expression |
| 22555 | if (p->error_indicator) { |
| 22556 | D(p->level--); |
| 22557 | return NULL; |
| 22558 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22559 | 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] | 22560 | Token * _literal; |
| 22561 | expr_ty z; |
| 22562 | if ( |
| 22563 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
| 22564 | && |
| 22565 | (z = expression_rule(p)) // expression |
| 22566 | ) |
| 22567 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22568 | 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] | 22569 | _res = z; |
| 22570 | if (_res == NULL && PyErr_Occurred()) { |
| 22571 | p->error_indicator = 1; |
| 22572 | D(p->level--); |
| 22573 | return NULL; |
| 22574 | } |
| 22575 | goto done; |
| 22576 | } |
| 22577 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22578 | 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] | 22579 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
| 22580 | } |
| 22581 | _res = NULL; |
| 22582 | done: |
| 22583 | D(p->level--); |
| 22584 | return _res; |
| 22585 | } |
| 22586 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22587 | // _tmp_69: NEWLINE INDENT |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22588 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22589 | _tmp_69_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22590 | { |
| 22591 | D(p->level++); |
| 22592 | if (p->error_indicator) { |
| 22593 | D(p->level--); |
| 22594 | return NULL; |
| 22595 | } |
| 22596 | void * _res = NULL; |
| 22597 | int _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22598 | { // NEWLINE INDENT |
| 22599 | if (p->error_indicator) { |
| 22600 | D(p->level--); |
| 22601 | return NULL; |
| 22602 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22603 | 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] | 22604 | Token * indent_var; |
| 22605 | Token * newline_var; |
| 22606 | if ( |
| 22607 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 22608 | && |
| 22609 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
| 22610 | ) |
| 22611 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22612 | 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] | 22613 | _res = _PyPegen_dummy_name(p, newline_var, indent_var); |
| 22614 | goto done; |
| 22615 | } |
| 22616 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22617 | 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] | 22618 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); |
| 22619 | } |
| 22620 | _res = NULL; |
| 22621 | done: |
| 22622 | D(p->level--); |
| 22623 | return _res; |
| 22624 | } |
| 22625 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22626 | // _loop0_70: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22627 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22628 | _loop0_70_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22629 | { |
| 22630 | D(p->level++); |
| 22631 | if (p->error_indicator) { |
| 22632 | D(p->level--); |
| 22633 | return NULL; |
| 22634 | } |
| 22635 | void *_res = NULL; |
| 22636 | int _mark = p->mark; |
| 22637 | int _start_mark = p->mark; |
| 22638 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22639 | if (!_children) { |
| 22640 | p->error_indicator = 1; |
| 22641 | PyErr_NoMemory(); |
| 22642 | D(p->level--); |
| 22643 | return NULL; |
| 22644 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22645 | Py_ssize_t _children_capacity = 1; |
| 22646 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22647 | { // param_no_default |
| 22648 | if (p->error_indicator) { |
| 22649 | D(p->level--); |
| 22650 | return NULL; |
| 22651 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22652 | 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] | 22653 | arg_ty param_no_default_var; |
| 22654 | while ( |
| 22655 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 22656 | ) |
| 22657 | { |
| 22658 | _res = param_no_default_var; |
| 22659 | if (_n == _children_capacity) { |
| 22660 | _children_capacity *= 2; |
| 22661 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22662 | if (!_new_children) { |
| 22663 | p->error_indicator = 1; |
| 22664 | PyErr_NoMemory(); |
| 22665 | D(p->level--); |
| 22666 | return NULL; |
| 22667 | } |
| 22668 | _children = _new_children; |
| 22669 | } |
| 22670 | _children[_n++] = _res; |
| 22671 | _mark = p->mark; |
| 22672 | } |
| 22673 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22674 | 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] | 22675 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22676 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22677 | 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] | 22678 | if (!_seq) { |
| 22679 | PyMem_Free(_children); |
| 22680 | p->error_indicator = 1; |
| 22681 | PyErr_NoMemory(); |
| 22682 | D(p->level--); |
| 22683 | return NULL; |
| 22684 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22685 | 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] | 22686 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22687 | _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22688 | D(p->level--); |
| 22689 | return _seq; |
| 22690 | } |
| 22691 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22692 | // _loop0_71: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22693 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22694 | _loop0_71_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22695 | { |
| 22696 | D(p->level++); |
| 22697 | if (p->error_indicator) { |
| 22698 | D(p->level--); |
| 22699 | return NULL; |
| 22700 | } |
| 22701 | void *_res = NULL; |
| 22702 | int _mark = p->mark; |
| 22703 | int _start_mark = p->mark; |
| 22704 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22705 | if (!_children) { |
| 22706 | p->error_indicator = 1; |
| 22707 | PyErr_NoMemory(); |
| 22708 | D(p->level--); |
| 22709 | return NULL; |
| 22710 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22711 | Py_ssize_t _children_capacity = 1; |
| 22712 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22713 | { // param_with_default |
| 22714 | if (p->error_indicator) { |
| 22715 | D(p->level--); |
| 22716 | return NULL; |
| 22717 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22718 | 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] | 22719 | NameDefaultPair* param_with_default_var; |
| 22720 | while ( |
| 22721 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 22722 | ) |
| 22723 | { |
| 22724 | _res = param_with_default_var; |
| 22725 | if (_n == _children_capacity) { |
| 22726 | _children_capacity *= 2; |
| 22727 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22728 | if (!_new_children) { |
| 22729 | p->error_indicator = 1; |
| 22730 | PyErr_NoMemory(); |
| 22731 | D(p->level--); |
| 22732 | return NULL; |
| 22733 | } |
| 22734 | _children = _new_children; |
| 22735 | } |
| 22736 | _children[_n++] = _res; |
| 22737 | _mark = p->mark; |
| 22738 | } |
| 22739 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22740 | 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] | 22741 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 22742 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22743 | 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] | 22744 | if (!_seq) { |
| 22745 | PyMem_Free(_children); |
| 22746 | p->error_indicator = 1; |
| 22747 | PyErr_NoMemory(); |
| 22748 | D(p->level--); |
| 22749 | return NULL; |
| 22750 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22751 | 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] | 22752 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22753 | _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22754 | D(p->level--); |
| 22755 | return _seq; |
| 22756 | } |
| 22757 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22758 | // _loop0_72: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22759 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22760 | _loop0_72_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22761 | { |
| 22762 | D(p->level++); |
| 22763 | if (p->error_indicator) { |
| 22764 | D(p->level--); |
| 22765 | return NULL; |
| 22766 | } |
| 22767 | void *_res = NULL; |
| 22768 | int _mark = p->mark; |
| 22769 | int _start_mark = p->mark; |
| 22770 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22771 | if (!_children) { |
| 22772 | p->error_indicator = 1; |
| 22773 | PyErr_NoMemory(); |
| 22774 | D(p->level--); |
| 22775 | return NULL; |
| 22776 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22777 | Py_ssize_t _children_capacity = 1; |
| 22778 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22779 | { // param_with_default |
| 22780 | if (p->error_indicator) { |
| 22781 | D(p->level--); |
| 22782 | return NULL; |
| 22783 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22784 | 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] | 22785 | NameDefaultPair* param_with_default_var; |
| 22786 | while ( |
| 22787 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 22788 | ) |
| 22789 | { |
| 22790 | _res = param_with_default_var; |
| 22791 | if (_n == _children_capacity) { |
| 22792 | _children_capacity *= 2; |
| 22793 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22794 | if (!_new_children) { |
| 22795 | p->error_indicator = 1; |
| 22796 | PyErr_NoMemory(); |
| 22797 | D(p->level--); |
| 22798 | return NULL; |
| 22799 | } |
| 22800 | _children = _new_children; |
| 22801 | } |
| 22802 | _children[_n++] = _res; |
| 22803 | _mark = p->mark; |
| 22804 | } |
| 22805 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22806 | 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] | 22807 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 22808 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22809 | 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] | 22810 | if (!_seq) { |
| 22811 | PyMem_Free(_children); |
| 22812 | p->error_indicator = 1; |
| 22813 | PyErr_NoMemory(); |
| 22814 | D(p->level--); |
| 22815 | return NULL; |
| 22816 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22817 | 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] | 22818 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22819 | _PyPegen_insert_memo(p, _start_mark, _loop0_72_type, _seq); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22820 | D(p->level--); |
| 22821 | return _seq; |
| 22822 | } |
| 22823 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22824 | // _loop1_73: param_no_default |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22825 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22826 | _loop1_73_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22827 | { |
| 22828 | D(p->level++); |
| 22829 | if (p->error_indicator) { |
| 22830 | D(p->level--); |
| 22831 | return NULL; |
| 22832 | } |
| 22833 | void *_res = NULL; |
| 22834 | int _mark = p->mark; |
| 22835 | int _start_mark = p->mark; |
| 22836 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22837 | if (!_children) { |
| 22838 | p->error_indicator = 1; |
| 22839 | PyErr_NoMemory(); |
| 22840 | D(p->level--); |
| 22841 | return NULL; |
| 22842 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22843 | Py_ssize_t _children_capacity = 1; |
| 22844 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22845 | { // param_no_default |
| 22846 | if (p->error_indicator) { |
| 22847 | D(p->level--); |
| 22848 | return NULL; |
| 22849 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22850 | 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] | 22851 | arg_ty param_no_default_var; |
| 22852 | while ( |
| 22853 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 22854 | ) |
| 22855 | { |
| 22856 | _res = param_no_default_var; |
| 22857 | if (_n == _children_capacity) { |
| 22858 | _children_capacity *= 2; |
| 22859 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22860 | if (!_new_children) { |
| 22861 | p->error_indicator = 1; |
| 22862 | PyErr_NoMemory(); |
| 22863 | D(p->level--); |
| 22864 | return NULL; |
| 22865 | } |
| 22866 | _children = _new_children; |
| 22867 | } |
| 22868 | _children[_n++] = _res; |
| 22869 | _mark = p->mark; |
| 22870 | } |
| 22871 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22872 | 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] | 22873 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 22874 | } |
| 22875 | if (_n == 0 || p->error_indicator) { |
| 22876 | PyMem_Free(_children); |
| 22877 | D(p->level--); |
| 22878 | return NULL; |
| 22879 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22880 | 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] | 22881 | if (!_seq) { |
| 22882 | PyMem_Free(_children); |
| 22883 | p->error_indicator = 1; |
| 22884 | PyErr_NoMemory(); |
| 22885 | D(p->level--); |
| 22886 | return NULL; |
| 22887 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22888 | 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] | 22889 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22890 | _PyPegen_insert_memo(p, _start_mark, _loop1_73_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22891 | D(p->level--); |
| 22892 | return _seq; |
| 22893 | } |
| 22894 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22895 | // _loop0_74: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22896 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22897 | _loop0_74_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22898 | { |
| 22899 | D(p->level++); |
| 22900 | if (p->error_indicator) { |
| 22901 | D(p->level--); |
| 22902 | return NULL; |
| 22903 | } |
| 22904 | void *_res = NULL; |
| 22905 | int _mark = p->mark; |
| 22906 | int _start_mark = p->mark; |
| 22907 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22908 | if (!_children) { |
| 22909 | p->error_indicator = 1; |
| 22910 | PyErr_NoMemory(); |
| 22911 | D(p->level--); |
| 22912 | return NULL; |
| 22913 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22914 | Py_ssize_t _children_capacity = 1; |
| 22915 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22916 | { // param_with_default |
| 22917 | if (p->error_indicator) { |
| 22918 | D(p->level--); |
| 22919 | return NULL; |
| 22920 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22921 | 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] | 22922 | NameDefaultPair* param_with_default_var; |
| 22923 | while ( |
| 22924 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 22925 | ) |
| 22926 | { |
| 22927 | _res = param_with_default_var; |
| 22928 | if (_n == _children_capacity) { |
| 22929 | _children_capacity *= 2; |
| 22930 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22931 | if (!_new_children) { |
| 22932 | p->error_indicator = 1; |
| 22933 | PyErr_NoMemory(); |
| 22934 | D(p->level--); |
| 22935 | return NULL; |
| 22936 | } |
| 22937 | _children = _new_children; |
| 22938 | } |
| 22939 | _children[_n++] = _res; |
| 22940 | _mark = p->mark; |
| 22941 | } |
| 22942 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22943 | 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] | 22944 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 22945 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22946 | 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] | 22947 | if (!_seq) { |
| 22948 | PyMem_Free(_children); |
| 22949 | p->error_indicator = 1; |
| 22950 | PyErr_NoMemory(); |
| 22951 | D(p->level--); |
| 22952 | return NULL; |
| 22953 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 22954 | 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] | 22955 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22956 | _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22957 | D(p->level--); |
| 22958 | return _seq; |
| 22959 | } |
| 22960 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22961 | // _loop1_75: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22962 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22963 | _loop1_75_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22964 | { |
| 22965 | D(p->level++); |
| 22966 | if (p->error_indicator) { |
| 22967 | D(p->level--); |
| 22968 | return NULL; |
| 22969 | } |
| 22970 | void *_res = NULL; |
| 22971 | int _mark = p->mark; |
| 22972 | int _start_mark = p->mark; |
| 22973 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22974 | if (!_children) { |
| 22975 | p->error_indicator = 1; |
| 22976 | PyErr_NoMemory(); |
| 22977 | D(p->level--); |
| 22978 | return NULL; |
| 22979 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 22980 | Py_ssize_t _children_capacity = 1; |
| 22981 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22982 | { // param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22983 | if (p->error_indicator) { |
| 22984 | D(p->level--); |
| 22985 | return NULL; |
| 22986 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 22987 | 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] | 22988 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22989 | while ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22990 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22991 | ) |
| 22992 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 22993 | _res = param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 22994 | if (_n == _children_capacity) { |
| 22995 | _children_capacity *= 2; |
| 22996 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22997 | if (!_new_children) { |
| 22998 | p->error_indicator = 1; |
| 22999 | PyErr_NoMemory(); |
| 23000 | D(p->level--); |
| 23001 | return NULL; |
| 23002 | } |
| 23003 | _children = _new_children; |
| 23004 | } |
| 23005 | _children[_n++] = _res; |
| 23006 | _mark = p->mark; |
| 23007 | } |
| 23008 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23009 | 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] | 23010 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23011 | } |
| 23012 | if (_n == 0 || p->error_indicator) { |
| 23013 | PyMem_Free(_children); |
| 23014 | D(p->level--); |
| 23015 | return NULL; |
| 23016 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23017 | 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] | 23018 | if (!_seq) { |
| 23019 | PyMem_Free(_children); |
| 23020 | p->error_indicator = 1; |
| 23021 | PyErr_NoMemory(); |
| 23022 | D(p->level--); |
| 23023 | return NULL; |
| 23024 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23025 | 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] | 23026 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23027 | _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23028 | D(p->level--); |
| 23029 | return _seq; |
| 23030 | } |
| 23031 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23032 | // _loop1_76: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23033 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23034 | _loop1_76_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23035 | { |
| 23036 | D(p->level++); |
| 23037 | if (p->error_indicator) { |
| 23038 | D(p->level--); |
| 23039 | return NULL; |
| 23040 | } |
| 23041 | void *_res = NULL; |
| 23042 | int _mark = p->mark; |
| 23043 | int _start_mark = p->mark; |
| 23044 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23045 | if (!_children) { |
| 23046 | p->error_indicator = 1; |
| 23047 | PyErr_NoMemory(); |
| 23048 | D(p->level--); |
| 23049 | return NULL; |
| 23050 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23051 | Py_ssize_t _children_capacity = 1; |
| 23052 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23053 | { // param_no_default |
| 23054 | if (p->error_indicator) { |
| 23055 | D(p->level--); |
| 23056 | return NULL; |
| 23057 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23058 | 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] | 23059 | arg_ty param_no_default_var; |
| 23060 | while ( |
| 23061 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 23062 | ) |
| 23063 | { |
| 23064 | _res = param_no_default_var; |
| 23065 | if (_n == _children_capacity) { |
| 23066 | _children_capacity *= 2; |
| 23067 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23068 | if (!_new_children) { |
| 23069 | p->error_indicator = 1; |
| 23070 | PyErr_NoMemory(); |
| 23071 | D(p->level--); |
| 23072 | return NULL; |
| 23073 | } |
| 23074 | _children = _new_children; |
| 23075 | } |
| 23076 | _children[_n++] = _res; |
| 23077 | _mark = p->mark; |
| 23078 | } |
| 23079 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23080 | 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] | 23081 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 23082 | } |
| 23083 | if (_n == 0 || p->error_indicator) { |
| 23084 | PyMem_Free(_children); |
| 23085 | D(p->level--); |
| 23086 | return NULL; |
| 23087 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23088 | 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] | 23089 | if (!_seq) { |
| 23090 | PyMem_Free(_children); |
| 23091 | p->error_indicator = 1; |
| 23092 | PyErr_NoMemory(); |
| 23093 | D(p->level--); |
| 23094 | return NULL; |
| 23095 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23096 | 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] | 23097 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23098 | _PyPegen_insert_memo(p, _start_mark, _loop1_76_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23099 | D(p->level--); |
| 23100 | return _seq; |
| 23101 | } |
| 23102 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23103 | // _loop1_77: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23104 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23105 | _loop1_77_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23106 | { |
| 23107 | D(p->level++); |
| 23108 | if (p->error_indicator) { |
| 23109 | D(p->level--); |
| 23110 | return NULL; |
| 23111 | } |
| 23112 | void *_res = NULL; |
| 23113 | int _mark = p->mark; |
| 23114 | int _start_mark = p->mark; |
| 23115 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23116 | if (!_children) { |
| 23117 | p->error_indicator = 1; |
| 23118 | PyErr_NoMemory(); |
| 23119 | D(p->level--); |
| 23120 | return NULL; |
| 23121 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23122 | Py_ssize_t _children_capacity = 1; |
| 23123 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23124 | { // param_no_default |
| 23125 | if (p->error_indicator) { |
| 23126 | D(p->level--); |
| 23127 | return NULL; |
| 23128 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23129 | 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] | 23130 | arg_ty param_no_default_var; |
| 23131 | while ( |
| 23132 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 23133 | ) |
| 23134 | { |
| 23135 | _res = param_no_default_var; |
| 23136 | if (_n == _children_capacity) { |
| 23137 | _children_capacity *= 2; |
| 23138 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23139 | if (!_new_children) { |
| 23140 | p->error_indicator = 1; |
| 23141 | PyErr_NoMemory(); |
| 23142 | D(p->level--); |
| 23143 | return NULL; |
| 23144 | } |
| 23145 | _children = _new_children; |
| 23146 | } |
| 23147 | _children[_n++] = _res; |
| 23148 | _mark = p->mark; |
| 23149 | } |
| 23150 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23151 | 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] | 23152 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 23153 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23154 | if (_n == 0 || p->error_indicator) { |
| 23155 | PyMem_Free(_children); |
| 23156 | D(p->level--); |
| 23157 | return NULL; |
| 23158 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23159 | 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] | 23160 | if (!_seq) { |
| 23161 | PyMem_Free(_children); |
| 23162 | p->error_indicator = 1; |
| 23163 | PyErr_NoMemory(); |
| 23164 | D(p->level--); |
| 23165 | return NULL; |
| 23166 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23167 | 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] | 23168 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23169 | _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23170 | D(p->level--); |
| 23171 | return _seq; |
| 23172 | } |
| 23173 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23174 | // _loop0_78: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23175 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23176 | _loop0_78_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23177 | { |
| 23178 | D(p->level++); |
| 23179 | if (p->error_indicator) { |
| 23180 | D(p->level--); |
| 23181 | return NULL; |
| 23182 | } |
| 23183 | void *_res = NULL; |
| 23184 | int _mark = p->mark; |
| 23185 | int _start_mark = p->mark; |
| 23186 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23187 | if (!_children) { |
| 23188 | p->error_indicator = 1; |
| 23189 | PyErr_NoMemory(); |
| 23190 | D(p->level--); |
| 23191 | return NULL; |
| 23192 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23193 | Py_ssize_t _children_capacity = 1; |
| 23194 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23195 | { // param_no_default |
| 23196 | if (p->error_indicator) { |
| 23197 | D(p->level--); |
| 23198 | return NULL; |
| 23199 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23200 | 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] | 23201 | arg_ty param_no_default_var; |
| 23202 | while ( |
| 23203 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 23204 | ) |
| 23205 | { |
| 23206 | _res = param_no_default_var; |
| 23207 | if (_n == _children_capacity) { |
| 23208 | _children_capacity *= 2; |
| 23209 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23210 | if (!_new_children) { |
| 23211 | p->error_indicator = 1; |
| 23212 | PyErr_NoMemory(); |
| 23213 | D(p->level--); |
| 23214 | return NULL; |
| 23215 | } |
| 23216 | _children = _new_children; |
| 23217 | } |
| 23218 | _children[_n++] = _res; |
| 23219 | _mark = p->mark; |
| 23220 | } |
| 23221 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23222 | 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] | 23223 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 23224 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23225 | 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] | 23226 | if (!_seq) { |
| 23227 | PyMem_Free(_children); |
| 23228 | p->error_indicator = 1; |
| 23229 | PyErr_NoMemory(); |
| 23230 | D(p->level--); |
| 23231 | return NULL; |
| 23232 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23233 | 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] | 23234 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23235 | _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23236 | D(p->level--); |
| 23237 | return _seq; |
| 23238 | } |
| 23239 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23240 | // _loop1_79: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23241 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23242 | _loop1_79_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23243 | { |
| 23244 | D(p->level++); |
| 23245 | if (p->error_indicator) { |
| 23246 | D(p->level--); |
| 23247 | return NULL; |
| 23248 | } |
| 23249 | void *_res = NULL; |
| 23250 | int _mark = p->mark; |
| 23251 | int _start_mark = p->mark; |
| 23252 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23253 | if (!_children) { |
| 23254 | p->error_indicator = 1; |
| 23255 | PyErr_NoMemory(); |
| 23256 | D(p->level--); |
| 23257 | return NULL; |
| 23258 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23259 | Py_ssize_t _children_capacity = 1; |
| 23260 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23261 | { // param_with_default |
| 23262 | if (p->error_indicator) { |
| 23263 | D(p->level--); |
| 23264 | return NULL; |
| 23265 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23266 | 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] | 23267 | NameDefaultPair* param_with_default_var; |
| 23268 | while ( |
| 23269 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 23270 | ) |
| 23271 | { |
| 23272 | _res = param_with_default_var; |
| 23273 | if (_n == _children_capacity) { |
| 23274 | _children_capacity *= 2; |
| 23275 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23276 | if (!_new_children) { |
| 23277 | p->error_indicator = 1; |
| 23278 | PyErr_NoMemory(); |
| 23279 | D(p->level--); |
| 23280 | return NULL; |
| 23281 | } |
| 23282 | _children = _new_children; |
| 23283 | } |
| 23284 | _children[_n++] = _res; |
| 23285 | _mark = p->mark; |
| 23286 | } |
| 23287 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23288 | 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] | 23289 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 23290 | } |
| 23291 | if (_n == 0 || p->error_indicator) { |
| 23292 | PyMem_Free(_children); |
| 23293 | D(p->level--); |
| 23294 | return NULL; |
| 23295 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23296 | 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] | 23297 | if (!_seq) { |
| 23298 | PyMem_Free(_children); |
| 23299 | p->error_indicator = 1; |
| 23300 | PyErr_NoMemory(); |
| 23301 | D(p->level--); |
| 23302 | return NULL; |
| 23303 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23304 | 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] | 23305 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23306 | _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23307 | D(p->level--); |
| 23308 | return _seq; |
| 23309 | } |
| 23310 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23311 | // _loop0_80: param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23312 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23313 | _loop0_80_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23314 | { |
| 23315 | D(p->level++); |
| 23316 | if (p->error_indicator) { |
| 23317 | D(p->level--); |
| 23318 | return NULL; |
| 23319 | } |
| 23320 | void *_res = NULL; |
| 23321 | int _mark = p->mark; |
| 23322 | int _start_mark = p->mark; |
| 23323 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23324 | if (!_children) { |
| 23325 | p->error_indicator = 1; |
| 23326 | PyErr_NoMemory(); |
| 23327 | D(p->level--); |
| 23328 | return NULL; |
| 23329 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23330 | Py_ssize_t _children_capacity = 1; |
| 23331 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23332 | { // param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23333 | if (p->error_indicator) { |
| 23334 | D(p->level--); |
| 23335 | return NULL; |
| 23336 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23337 | 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] | 23338 | arg_ty param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23339 | while ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23340 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23341 | ) |
| 23342 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23343 | _res = param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23344 | if (_n == _children_capacity) { |
| 23345 | _children_capacity *= 2; |
| 23346 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23347 | if (!_new_children) { |
| 23348 | p->error_indicator = 1; |
| 23349 | PyErr_NoMemory(); |
| 23350 | D(p->level--); |
| 23351 | return NULL; |
| 23352 | } |
| 23353 | _children = _new_children; |
| 23354 | } |
| 23355 | _children[_n++] = _res; |
| 23356 | _mark = p->mark; |
| 23357 | } |
| 23358 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23359 | 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] | 23360 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23361 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23362 | 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] | 23363 | if (!_seq) { |
| 23364 | PyMem_Free(_children); |
| 23365 | p->error_indicator = 1; |
| 23366 | PyErr_NoMemory(); |
| 23367 | D(p->level--); |
| 23368 | return NULL; |
| 23369 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23370 | 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] | 23371 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23372 | _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23373 | D(p->level--); |
| 23374 | return _seq; |
| 23375 | } |
| 23376 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23377 | // _loop1_81: param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23378 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23379 | _loop1_81_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23380 | { |
| 23381 | D(p->level++); |
| 23382 | if (p->error_indicator) { |
| 23383 | D(p->level--); |
| 23384 | return NULL; |
| 23385 | } |
| 23386 | void *_res = NULL; |
| 23387 | int _mark = p->mark; |
| 23388 | int _start_mark = p->mark; |
| 23389 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23390 | if (!_children) { |
| 23391 | p->error_indicator = 1; |
| 23392 | PyErr_NoMemory(); |
| 23393 | D(p->level--); |
| 23394 | return NULL; |
| 23395 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23396 | Py_ssize_t _children_capacity = 1; |
| 23397 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23398 | { // param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23399 | if (p->error_indicator) { |
| 23400 | D(p->level--); |
| 23401 | return NULL; |
| 23402 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23403 | 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] | 23404 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23405 | while ( |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23406 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23407 | ) |
| 23408 | { |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23409 | _res = param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23410 | if (_n == _children_capacity) { |
| 23411 | _children_capacity *= 2; |
| 23412 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23413 | if (!_new_children) { |
| 23414 | p->error_indicator = 1; |
| 23415 | PyErr_NoMemory(); |
| 23416 | D(p->level--); |
| 23417 | return NULL; |
| 23418 | } |
| 23419 | _children = _new_children; |
| 23420 | } |
| 23421 | _children[_n++] = _res; |
| 23422 | _mark = p->mark; |
| 23423 | } |
| 23424 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23425 | 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] | 23426 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23427 | } |
| 23428 | if (_n == 0 || p->error_indicator) { |
| 23429 | PyMem_Free(_children); |
| 23430 | D(p->level--); |
| 23431 | return NULL; |
| 23432 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23433 | 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] | 23434 | if (!_seq) { |
| 23435 | PyMem_Free(_children); |
| 23436 | p->error_indicator = 1; |
| 23437 | PyErr_NoMemory(); |
| 23438 | D(p->level--); |
| 23439 | return NULL; |
| 23440 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23441 | 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] | 23442 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23443 | _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23444 | D(p->level--); |
| 23445 | return _seq; |
| 23446 | } |
| 23447 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23448 | // _loop0_82: param_maybe_default |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23449 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23450 | _loop0_82_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23451 | { |
| 23452 | D(p->level++); |
| 23453 | if (p->error_indicator) { |
| 23454 | D(p->level--); |
| 23455 | return NULL; |
| 23456 | } |
| 23457 | void *_res = NULL; |
| 23458 | int _mark = p->mark; |
| 23459 | int _start_mark = p->mark; |
| 23460 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23461 | if (!_children) { |
| 23462 | p->error_indicator = 1; |
| 23463 | PyErr_NoMemory(); |
| 23464 | D(p->level--); |
| 23465 | return NULL; |
| 23466 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23467 | Py_ssize_t _children_capacity = 1; |
| 23468 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23469 | { // param_maybe_default |
| 23470 | if (p->error_indicator) { |
| 23471 | D(p->level--); |
| 23472 | return NULL; |
| 23473 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23474 | 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] | 23475 | NameDefaultPair* param_maybe_default_var; |
| 23476 | while ( |
| 23477 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
| 23478 | ) |
| 23479 | { |
| 23480 | _res = param_maybe_default_var; |
| 23481 | if (_n == _children_capacity) { |
| 23482 | _children_capacity *= 2; |
| 23483 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23484 | if (!_new_children) { |
| 23485 | p->error_indicator = 1; |
| 23486 | PyErr_NoMemory(); |
| 23487 | D(p->level--); |
| 23488 | return NULL; |
| 23489 | } |
| 23490 | _children = _new_children; |
| 23491 | } |
| 23492 | _children[_n++] = _res; |
| 23493 | _mark = p->mark; |
| 23494 | } |
| 23495 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23496 | 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] | 23497 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
| 23498 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23499 | 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] | 23500 | if (!_seq) { |
| 23501 | PyMem_Free(_children); |
| 23502 | p->error_indicator = 1; |
| 23503 | PyErr_NoMemory(); |
| 23504 | D(p->level--); |
| 23505 | return NULL; |
| 23506 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23507 | 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] | 23508 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23509 | _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23510 | D(p->level--); |
| 23511 | return _seq; |
| 23512 | } |
| 23513 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23514 | // _loop1_83: param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23515 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23516 | _loop1_83_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23517 | { |
| 23518 | D(p->level++); |
| 23519 | if (p->error_indicator) { |
| 23520 | D(p->level--); |
| 23521 | return NULL; |
| 23522 | } |
| 23523 | void *_res = NULL; |
| 23524 | int _mark = p->mark; |
| 23525 | int _start_mark = p->mark; |
| 23526 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23527 | if (!_children) { |
| 23528 | p->error_indicator = 1; |
| 23529 | PyErr_NoMemory(); |
| 23530 | D(p->level--); |
| 23531 | return NULL; |
| 23532 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23533 | Py_ssize_t _children_capacity = 1; |
| 23534 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23535 | { // param_maybe_default |
| 23536 | if (p->error_indicator) { |
| 23537 | D(p->level--); |
| 23538 | return NULL; |
| 23539 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23540 | 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] | 23541 | NameDefaultPair* param_maybe_default_var; |
| 23542 | while ( |
| 23543 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
| 23544 | ) |
| 23545 | { |
| 23546 | _res = param_maybe_default_var; |
| 23547 | if (_n == _children_capacity) { |
| 23548 | _children_capacity *= 2; |
| 23549 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23550 | if (!_new_children) { |
| 23551 | p->error_indicator = 1; |
| 23552 | PyErr_NoMemory(); |
| 23553 | D(p->level--); |
| 23554 | return NULL; |
| 23555 | } |
| 23556 | _children = _new_children; |
| 23557 | } |
| 23558 | _children[_n++] = _res; |
| 23559 | _mark = p->mark; |
| 23560 | } |
| 23561 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23562 | 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] | 23563 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
| 23564 | } |
| 23565 | if (_n == 0 || p->error_indicator) { |
| 23566 | PyMem_Free(_children); |
| 23567 | D(p->level--); |
| 23568 | return NULL; |
| 23569 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23570 | 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] | 23571 | if (!_seq) { |
| 23572 | PyMem_Free(_children); |
| 23573 | p->error_indicator = 1; |
| 23574 | PyErr_NoMemory(); |
| 23575 | D(p->level--); |
| 23576 | return NULL; |
| 23577 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23578 | 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] | 23579 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23580 | _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23581 | D(p->level--); |
| 23582 | return _seq; |
| 23583 | } |
| 23584 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23585 | // _loop1_84: ('@' named_expression NEWLINE) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23586 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23587 | _loop1_84_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 23588 | { |
| 23589 | D(p->level++); |
| 23590 | if (p->error_indicator) { |
| 23591 | D(p->level--); |
| 23592 | return NULL; |
| 23593 | } |
| 23594 | void *_res = NULL; |
| 23595 | int _mark = p->mark; |
| 23596 | int _start_mark = p->mark; |
| 23597 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23598 | if (!_children) { |
| 23599 | p->error_indicator = 1; |
| 23600 | PyErr_NoMemory(); |
| 23601 | D(p->level--); |
| 23602 | return NULL; |
| 23603 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23604 | Py_ssize_t _children_capacity = 1; |
| 23605 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23606 | { // ('@' named_expression NEWLINE) |
| 23607 | if (p->error_indicator) { |
| 23608 | D(p->level--); |
| 23609 | return NULL; |
| 23610 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23611 | D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); |
| 23612 | void *_tmp_165_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23613 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23614 | (_tmp_165_var = _tmp_165_rule(p)) // '@' named_expression NEWLINE |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23615 | ) |
| 23616 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23617 | _res = _tmp_165_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23618 | if (_n == _children_capacity) { |
| 23619 | _children_capacity *= 2; |
| 23620 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23621 | if (!_new_children) { |
| 23622 | p->error_indicator = 1; |
| 23623 | PyErr_NoMemory(); |
| 23624 | D(p->level--); |
| 23625 | return NULL; |
| 23626 | } |
| 23627 | _children = _new_children; |
| 23628 | } |
| 23629 | _children[_n++] = _res; |
| 23630 | _mark = p->mark; |
| 23631 | } |
| 23632 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23633 | 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] | 23634 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); |
| 23635 | } |
| 23636 | if (_n == 0 || p->error_indicator) { |
| 23637 | PyMem_Free(_children); |
| 23638 | D(p->level--); |
| 23639 | return NULL; |
| 23640 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23641 | 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] | 23642 | if (!_seq) { |
| 23643 | PyMem_Free(_children); |
| 23644 | p->error_indicator = 1; |
| 23645 | PyErr_NoMemory(); |
| 23646 | D(p->level--); |
| 23647 | return NULL; |
| 23648 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23649 | 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] | 23650 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23651 | _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23652 | D(p->level--); |
| 23653 | return _seq; |
| 23654 | } |
| 23655 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23656 | // _tmp_85: '(' arguments? ')' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23657 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23658 | _tmp_85_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23659 | { |
| 23660 | D(p->level++); |
| 23661 | if (p->error_indicator) { |
| 23662 | D(p->level--); |
| 23663 | return NULL; |
| 23664 | } |
| 23665 | void * _res = NULL; |
| 23666 | int _mark = p->mark; |
| 23667 | { // '(' arguments? ')' |
| 23668 | if (p->error_indicator) { |
| 23669 | D(p->level--); |
| 23670 | return NULL; |
| 23671 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23672 | 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] | 23673 | Token * _literal; |
| 23674 | Token * _literal_1; |
| 23675 | void *z; |
| 23676 | if ( |
| 23677 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 23678 | && |
| 23679 | (z = arguments_rule(p), 1) // arguments? |
| 23680 | && |
| 23681 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
| 23682 | ) |
| 23683 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23684 | 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] | 23685 | _res = z; |
| 23686 | if (_res == NULL && PyErr_Occurred()) { |
| 23687 | p->error_indicator = 1; |
| 23688 | D(p->level--); |
| 23689 | return NULL; |
| 23690 | } |
| 23691 | goto done; |
| 23692 | } |
| 23693 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23694 | 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] | 23695 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); |
| 23696 | } |
| 23697 | _res = NULL; |
| 23698 | done: |
| 23699 | D(p->level--); |
| 23700 | return _res; |
| 23701 | } |
| 23702 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23703 | // _loop1_86: (',' star_expression) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23704 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23705 | _loop1_86_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23706 | { |
| 23707 | D(p->level++); |
| 23708 | if (p->error_indicator) { |
| 23709 | D(p->level--); |
| 23710 | return NULL; |
| 23711 | } |
| 23712 | void *_res = NULL; |
| 23713 | int _mark = p->mark; |
| 23714 | int _start_mark = p->mark; |
| 23715 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23716 | if (!_children) { |
| 23717 | p->error_indicator = 1; |
| 23718 | PyErr_NoMemory(); |
| 23719 | D(p->level--); |
| 23720 | return NULL; |
| 23721 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23722 | Py_ssize_t _children_capacity = 1; |
| 23723 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23724 | { // (',' star_expression) |
| 23725 | if (p->error_indicator) { |
| 23726 | D(p->level--); |
| 23727 | return NULL; |
| 23728 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23729 | D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); |
| 23730 | void *_tmp_166_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23731 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23732 | (_tmp_166_var = _tmp_166_rule(p)) // ',' star_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23733 | ) |
| 23734 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23735 | _res = _tmp_166_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23736 | if (_n == _children_capacity) { |
| 23737 | _children_capacity *= 2; |
| 23738 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23739 | if (!_new_children) { |
| 23740 | p->error_indicator = 1; |
| 23741 | PyErr_NoMemory(); |
| 23742 | D(p->level--); |
| 23743 | return NULL; |
| 23744 | } |
| 23745 | _children = _new_children; |
| 23746 | } |
| 23747 | _children[_n++] = _res; |
| 23748 | _mark = p->mark; |
| 23749 | } |
| 23750 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23751 | 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] | 23752 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); |
| 23753 | } |
| 23754 | if (_n == 0 || p->error_indicator) { |
| 23755 | PyMem_Free(_children); |
| 23756 | D(p->level--); |
| 23757 | return NULL; |
| 23758 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23759 | 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] | 23760 | if (!_seq) { |
| 23761 | PyMem_Free(_children); |
| 23762 | p->error_indicator = 1; |
| 23763 | PyErr_NoMemory(); |
| 23764 | D(p->level--); |
| 23765 | return NULL; |
| 23766 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23767 | 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] | 23768 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23769 | _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23770 | D(p->level--); |
| 23771 | return _seq; |
| 23772 | } |
| 23773 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23774 | // _loop0_88: ',' star_named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23775 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23776 | _loop0_88_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23777 | { |
| 23778 | D(p->level++); |
| 23779 | if (p->error_indicator) { |
| 23780 | D(p->level--); |
| 23781 | return NULL; |
| 23782 | } |
| 23783 | void *_res = NULL; |
| 23784 | int _mark = p->mark; |
| 23785 | int _start_mark = p->mark; |
| 23786 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23787 | if (!_children) { |
| 23788 | p->error_indicator = 1; |
| 23789 | PyErr_NoMemory(); |
| 23790 | D(p->level--); |
| 23791 | return NULL; |
| 23792 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23793 | Py_ssize_t _children_capacity = 1; |
| 23794 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23795 | { // ',' star_named_expression |
| 23796 | if (p->error_indicator) { |
| 23797 | D(p->level--); |
| 23798 | return NULL; |
| 23799 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23800 | 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] | 23801 | Token * _literal; |
| 23802 | expr_ty elem; |
| 23803 | while ( |
| 23804 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 23805 | && |
| 23806 | (elem = star_named_expression_rule(p)) // star_named_expression |
| 23807 | ) |
| 23808 | { |
| 23809 | _res = elem; |
| 23810 | if (_res == NULL && PyErr_Occurred()) { |
| 23811 | p->error_indicator = 1; |
| 23812 | PyMem_Free(_children); |
| 23813 | D(p->level--); |
| 23814 | return NULL; |
| 23815 | } |
| 23816 | if (_n == _children_capacity) { |
| 23817 | _children_capacity *= 2; |
| 23818 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23819 | if (!_new_children) { |
| 23820 | p->error_indicator = 1; |
| 23821 | PyErr_NoMemory(); |
| 23822 | D(p->level--); |
| 23823 | return NULL; |
| 23824 | } |
| 23825 | _children = _new_children; |
| 23826 | } |
| 23827 | _children[_n++] = _res; |
| 23828 | _mark = p->mark; |
| 23829 | } |
| 23830 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23831 | 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] | 23832 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); |
| 23833 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23834 | 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] | 23835 | if (!_seq) { |
| 23836 | PyMem_Free(_children); |
| 23837 | p->error_indicator = 1; |
| 23838 | PyErr_NoMemory(); |
| 23839 | D(p->level--); |
| 23840 | return NULL; |
| 23841 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23842 | 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] | 23843 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23844 | _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23845 | D(p->level--); |
| 23846 | return _seq; |
| 23847 | } |
| 23848 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23849 | // _gather_87: star_named_expression _loop0_88 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23850 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23851 | _gather_87_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23852 | { |
| 23853 | D(p->level++); |
| 23854 | if (p->error_indicator) { |
| 23855 | D(p->level--); |
| 23856 | return NULL; |
| 23857 | } |
| 23858 | asdl_seq * _res = NULL; |
| 23859 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23860 | { // star_named_expression _loop0_88 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23861 | if (p->error_indicator) { |
| 23862 | D(p->level--); |
| 23863 | return NULL; |
| 23864 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23865 | 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] | 23866 | expr_ty elem; |
| 23867 | asdl_seq * seq; |
| 23868 | if ( |
| 23869 | (elem = star_named_expression_rule(p)) // star_named_expression |
| 23870 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23871 | (seq = _loop0_88_rule(p)) // _loop0_88 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23872 | ) |
| 23873 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23874 | 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] | 23875 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 23876 | goto done; |
| 23877 | } |
| 23878 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23879 | D(fprintf(stderr, "%*c%s _gather_87[%d-%d]: %s failed!\n", p->level, ' ', |
| 23880 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_88")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23881 | } |
| 23882 | _res = NULL; |
| 23883 | done: |
| 23884 | D(p->level--); |
| 23885 | return _res; |
| 23886 | } |
| 23887 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23888 | // _loop1_89: (',' expression) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23889 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23890 | _loop1_89_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23891 | { |
| 23892 | D(p->level++); |
| 23893 | if (p->error_indicator) { |
| 23894 | D(p->level--); |
| 23895 | return NULL; |
| 23896 | } |
| 23897 | void *_res = NULL; |
| 23898 | int _mark = p->mark; |
| 23899 | int _start_mark = p->mark; |
| 23900 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23901 | if (!_children) { |
| 23902 | p->error_indicator = 1; |
| 23903 | PyErr_NoMemory(); |
| 23904 | D(p->level--); |
| 23905 | return NULL; |
| 23906 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23907 | Py_ssize_t _children_capacity = 1; |
| 23908 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23909 | { // (',' expression) |
| 23910 | if (p->error_indicator) { |
| 23911 | D(p->level--); |
| 23912 | return NULL; |
| 23913 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23914 | D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); |
| 23915 | void *_tmp_167_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23916 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23917 | (_tmp_167_var = _tmp_167_rule(p)) // ',' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23918 | ) |
| 23919 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23920 | _res = _tmp_167_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23921 | if (_n == _children_capacity) { |
| 23922 | _children_capacity *= 2; |
| 23923 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23924 | if (!_new_children) { |
| 23925 | p->error_indicator = 1; |
| 23926 | PyErr_NoMemory(); |
| 23927 | D(p->level--); |
| 23928 | return NULL; |
| 23929 | } |
| 23930 | _children = _new_children; |
| 23931 | } |
| 23932 | _children[_n++] = _res; |
| 23933 | _mark = p->mark; |
| 23934 | } |
| 23935 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23936 | 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] | 23937 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); |
| 23938 | } |
| 23939 | if (_n == 0 || p->error_indicator) { |
| 23940 | PyMem_Free(_children); |
| 23941 | D(p->level--); |
| 23942 | return NULL; |
| 23943 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23944 | 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] | 23945 | if (!_seq) { |
| 23946 | PyMem_Free(_children); |
| 23947 | p->error_indicator = 1; |
| 23948 | PyErr_NoMemory(); |
| 23949 | D(p->level--); |
| 23950 | return NULL; |
| 23951 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 23952 | 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] | 23953 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23954 | _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23955 | D(p->level--); |
| 23956 | return _seq; |
| 23957 | } |
| 23958 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23959 | // _loop0_90: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23960 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23961 | _loop0_90_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23962 | { |
| 23963 | D(p->level++); |
| 23964 | if (p->error_indicator) { |
| 23965 | D(p->level--); |
| 23966 | return NULL; |
| 23967 | } |
| 23968 | void *_res = NULL; |
| 23969 | int _mark = p->mark; |
| 23970 | int _start_mark = p->mark; |
| 23971 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23972 | if (!_children) { |
| 23973 | p->error_indicator = 1; |
| 23974 | PyErr_NoMemory(); |
| 23975 | D(p->level--); |
| 23976 | return NULL; |
| 23977 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 23978 | Py_ssize_t _children_capacity = 1; |
| 23979 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 23980 | { // lambda_param_no_default |
| 23981 | if (p->error_indicator) { |
| 23982 | D(p->level--); |
| 23983 | return NULL; |
| 23984 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 23985 | 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] | 23986 | arg_ty lambda_param_no_default_var; |
| 23987 | while ( |
| 23988 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 23989 | ) |
| 23990 | { |
| 23991 | _res = lambda_param_no_default_var; |
| 23992 | if (_n == _children_capacity) { |
| 23993 | _children_capacity *= 2; |
| 23994 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23995 | if (!_new_children) { |
| 23996 | p->error_indicator = 1; |
| 23997 | PyErr_NoMemory(); |
| 23998 | D(p->level--); |
| 23999 | return NULL; |
| 24000 | } |
| 24001 | _children = _new_children; |
| 24002 | } |
| 24003 | _children[_n++] = _res; |
| 24004 | _mark = p->mark; |
| 24005 | } |
| 24006 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24007 | 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] | 24008 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24009 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24010 | 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] | 24011 | if (!_seq) { |
| 24012 | PyMem_Free(_children); |
| 24013 | p->error_indicator = 1; |
| 24014 | PyErr_NoMemory(); |
| 24015 | D(p->level--); |
| 24016 | return NULL; |
| 24017 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24018 | 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] | 24019 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24020 | _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24021 | D(p->level--); |
| 24022 | return _seq; |
| 24023 | } |
| 24024 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24025 | // _loop0_91: lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24026 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24027 | _loop0_91_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24028 | { |
| 24029 | D(p->level++); |
| 24030 | if (p->error_indicator) { |
| 24031 | D(p->level--); |
| 24032 | return NULL; |
| 24033 | } |
| 24034 | void *_res = NULL; |
| 24035 | int _mark = p->mark; |
| 24036 | int _start_mark = p->mark; |
| 24037 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24038 | if (!_children) { |
| 24039 | p->error_indicator = 1; |
| 24040 | PyErr_NoMemory(); |
| 24041 | D(p->level--); |
| 24042 | return NULL; |
| 24043 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24044 | Py_ssize_t _children_capacity = 1; |
| 24045 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24046 | { // lambda_param_with_default |
| 24047 | if (p->error_indicator) { |
| 24048 | D(p->level--); |
| 24049 | return NULL; |
| 24050 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24051 | 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] | 24052 | NameDefaultPair* lambda_param_with_default_var; |
| 24053 | while ( |
| 24054 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 24055 | ) |
| 24056 | { |
| 24057 | _res = lambda_param_with_default_var; |
| 24058 | if (_n == _children_capacity) { |
| 24059 | _children_capacity *= 2; |
| 24060 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24061 | if (!_new_children) { |
| 24062 | p->error_indicator = 1; |
| 24063 | PyErr_NoMemory(); |
| 24064 | D(p->level--); |
| 24065 | return NULL; |
| 24066 | } |
| 24067 | _children = _new_children; |
| 24068 | } |
| 24069 | _children[_n++] = _res; |
| 24070 | _mark = p->mark; |
| 24071 | } |
| 24072 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24073 | 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] | 24074 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 24075 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24076 | 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] | 24077 | if (!_seq) { |
| 24078 | PyMem_Free(_children); |
| 24079 | p->error_indicator = 1; |
| 24080 | PyErr_NoMemory(); |
| 24081 | D(p->level--); |
| 24082 | return NULL; |
| 24083 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24084 | 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] | 24085 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24086 | _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24087 | D(p->level--); |
| 24088 | return _seq; |
| 24089 | } |
| 24090 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24091 | // _loop0_92: lambda_param_with_default |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24092 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24093 | _loop0_92_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24094 | { |
| 24095 | D(p->level++); |
| 24096 | if (p->error_indicator) { |
| 24097 | D(p->level--); |
| 24098 | return NULL; |
| 24099 | } |
| 24100 | void *_res = NULL; |
| 24101 | int _mark = p->mark; |
| 24102 | int _start_mark = p->mark; |
| 24103 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24104 | if (!_children) { |
| 24105 | p->error_indicator = 1; |
| 24106 | PyErr_NoMemory(); |
| 24107 | D(p->level--); |
| 24108 | return NULL; |
| 24109 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24110 | Py_ssize_t _children_capacity = 1; |
| 24111 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24112 | { // lambda_param_with_default |
| 24113 | if (p->error_indicator) { |
| 24114 | D(p->level--); |
| 24115 | return NULL; |
| 24116 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24117 | 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] | 24118 | NameDefaultPair* lambda_param_with_default_var; |
| 24119 | while ( |
| 24120 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 24121 | ) |
| 24122 | { |
| 24123 | _res = lambda_param_with_default_var; |
| 24124 | if (_n == _children_capacity) { |
| 24125 | _children_capacity *= 2; |
| 24126 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24127 | if (!_new_children) { |
| 24128 | p->error_indicator = 1; |
| 24129 | PyErr_NoMemory(); |
| 24130 | D(p->level--); |
| 24131 | return NULL; |
| 24132 | } |
| 24133 | _children = _new_children; |
| 24134 | } |
| 24135 | _children[_n++] = _res; |
| 24136 | _mark = p->mark; |
| 24137 | } |
| 24138 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24139 | 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] | 24140 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 24141 | } |
| 24142 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 24143 | if (!_seq) { |
| 24144 | PyMem_Free(_children); |
| 24145 | p->error_indicator = 1; |
| 24146 | PyErr_NoMemory(); |
| 24147 | D(p->level--); |
| 24148 | return NULL; |
| 24149 | } |
| 24150 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 24151 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24152 | _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24153 | D(p->level--); |
| 24154 | return _seq; |
| 24155 | } |
| 24156 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24157 | // _loop1_93: lambda_param_no_default |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24158 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24159 | _loop1_93_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24160 | { |
| 24161 | D(p->level++); |
| 24162 | if (p->error_indicator) { |
| 24163 | D(p->level--); |
| 24164 | return NULL; |
| 24165 | } |
| 24166 | void *_res = NULL; |
| 24167 | int _mark = p->mark; |
| 24168 | int _start_mark = p->mark; |
| 24169 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24170 | if (!_children) { |
| 24171 | p->error_indicator = 1; |
| 24172 | PyErr_NoMemory(); |
| 24173 | D(p->level--); |
| 24174 | return NULL; |
| 24175 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24176 | Py_ssize_t _children_capacity = 1; |
| 24177 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24178 | { // lambda_param_no_default |
| 24179 | if (p->error_indicator) { |
| 24180 | D(p->level--); |
| 24181 | return NULL; |
| 24182 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24183 | 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] | 24184 | arg_ty lambda_param_no_default_var; |
| 24185 | while ( |
| 24186 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 24187 | ) |
| 24188 | { |
| 24189 | _res = lambda_param_no_default_var; |
| 24190 | if (_n == _children_capacity) { |
| 24191 | _children_capacity *= 2; |
| 24192 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24193 | if (!_new_children) { |
| 24194 | p->error_indicator = 1; |
| 24195 | PyErr_NoMemory(); |
| 24196 | D(p->level--); |
| 24197 | return NULL; |
| 24198 | } |
| 24199 | _children = _new_children; |
| 24200 | } |
| 24201 | _children[_n++] = _res; |
| 24202 | _mark = p->mark; |
| 24203 | } |
| 24204 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24205 | 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] | 24206 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 24207 | } |
| 24208 | if (_n == 0 || p->error_indicator) { |
| 24209 | PyMem_Free(_children); |
| 24210 | D(p->level--); |
| 24211 | return NULL; |
| 24212 | } |
| 24213 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 24214 | if (!_seq) { |
| 24215 | PyMem_Free(_children); |
| 24216 | p->error_indicator = 1; |
| 24217 | PyErr_NoMemory(); |
| 24218 | D(p->level--); |
| 24219 | return NULL; |
| 24220 | } |
| 24221 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 24222 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24223 | _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24224 | D(p->level--); |
| 24225 | return _seq; |
| 24226 | } |
| 24227 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24228 | // _loop0_94: lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24229 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24230 | _loop0_94_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24231 | { |
| 24232 | D(p->level++); |
| 24233 | if (p->error_indicator) { |
| 24234 | D(p->level--); |
| 24235 | return NULL; |
| 24236 | } |
| 24237 | void *_res = NULL; |
| 24238 | int _mark = p->mark; |
| 24239 | int _start_mark = p->mark; |
| 24240 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24241 | if (!_children) { |
| 24242 | p->error_indicator = 1; |
| 24243 | PyErr_NoMemory(); |
| 24244 | D(p->level--); |
| 24245 | return NULL; |
| 24246 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24247 | Py_ssize_t _children_capacity = 1; |
| 24248 | Py_ssize_t _n = 0; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24249 | { // lambda_param_with_default |
| 24250 | if (p->error_indicator) { |
| 24251 | D(p->level--); |
| 24252 | return NULL; |
| 24253 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24254 | 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] | 24255 | NameDefaultPair* lambda_param_with_default_var; |
| 24256 | while ( |
| 24257 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 24258 | ) |
| 24259 | { |
| 24260 | _res = lambda_param_with_default_var; |
| 24261 | if (_n == _children_capacity) { |
| 24262 | _children_capacity *= 2; |
| 24263 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24264 | if (!_new_children) { |
| 24265 | p->error_indicator = 1; |
| 24266 | PyErr_NoMemory(); |
| 24267 | D(p->level--); |
| 24268 | return NULL; |
| 24269 | } |
| 24270 | _children = _new_children; |
| 24271 | } |
| 24272 | _children[_n++] = _res; |
| 24273 | _mark = p->mark; |
| 24274 | } |
| 24275 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24276 | 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] | 24277 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 24278 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24279 | 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] | 24280 | if (!_seq) { |
| 24281 | PyMem_Free(_children); |
| 24282 | p->error_indicator = 1; |
| 24283 | PyErr_NoMemory(); |
| 24284 | D(p->level--); |
| 24285 | return NULL; |
| 24286 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24287 | 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] | 24288 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24289 | _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24290 | D(p->level--); |
| 24291 | return _seq; |
| 24292 | } |
| 24293 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24294 | // _loop1_95: lambda_param_with_default |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24295 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24296 | _loop1_95_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24297 | { |
| 24298 | D(p->level++); |
| 24299 | if (p->error_indicator) { |
| 24300 | D(p->level--); |
| 24301 | return NULL; |
| 24302 | } |
| 24303 | void *_res = NULL; |
| 24304 | int _mark = p->mark; |
| 24305 | int _start_mark = p->mark; |
| 24306 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24307 | if (!_children) { |
| 24308 | p->error_indicator = 1; |
| 24309 | PyErr_NoMemory(); |
| 24310 | D(p->level--); |
| 24311 | return NULL; |
| 24312 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24313 | Py_ssize_t _children_capacity = 1; |
| 24314 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24315 | { // lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24316 | if (p->error_indicator) { |
| 24317 | D(p->level--); |
| 24318 | return NULL; |
| 24319 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24320 | 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] | 24321 | NameDefaultPair* lambda_param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24322 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24323 | (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] | 24324 | ) |
| 24325 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24326 | _res = lambda_param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24327 | if (_n == _children_capacity) { |
| 24328 | _children_capacity *= 2; |
| 24329 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24330 | if (!_new_children) { |
| 24331 | p->error_indicator = 1; |
| 24332 | PyErr_NoMemory(); |
| 24333 | D(p->level--); |
| 24334 | return NULL; |
| 24335 | } |
| 24336 | _children = _new_children; |
| 24337 | } |
| 24338 | _children[_n++] = _res; |
| 24339 | _mark = p->mark; |
| 24340 | } |
| 24341 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24342 | 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] | 24343 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24344 | } |
| 24345 | if (_n == 0 || p->error_indicator) { |
| 24346 | PyMem_Free(_children); |
| 24347 | D(p->level--); |
| 24348 | return NULL; |
| 24349 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24350 | 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] | 24351 | if (!_seq) { |
| 24352 | PyMem_Free(_children); |
| 24353 | p->error_indicator = 1; |
| 24354 | PyErr_NoMemory(); |
| 24355 | D(p->level--); |
| 24356 | return NULL; |
| 24357 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24358 | 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] | 24359 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24360 | _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24361 | D(p->level--); |
| 24362 | return _seq; |
| 24363 | } |
| 24364 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24365 | // _loop1_96: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24366 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24367 | _loop1_96_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24368 | { |
| 24369 | D(p->level++); |
| 24370 | if (p->error_indicator) { |
| 24371 | D(p->level--); |
| 24372 | return NULL; |
| 24373 | } |
| 24374 | void *_res = NULL; |
| 24375 | int _mark = p->mark; |
| 24376 | int _start_mark = p->mark; |
| 24377 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24378 | if (!_children) { |
| 24379 | p->error_indicator = 1; |
| 24380 | PyErr_NoMemory(); |
| 24381 | D(p->level--); |
| 24382 | return NULL; |
| 24383 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24384 | Py_ssize_t _children_capacity = 1; |
| 24385 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24386 | { // lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24387 | if (p->error_indicator) { |
| 24388 | D(p->level--); |
| 24389 | return NULL; |
| 24390 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24391 | 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] | 24392 | arg_ty lambda_param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24393 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24394 | (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] | 24395 | ) |
| 24396 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24397 | _res = lambda_param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24398 | if (_n == _children_capacity) { |
| 24399 | _children_capacity *= 2; |
| 24400 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24401 | if (!_new_children) { |
| 24402 | p->error_indicator = 1; |
| 24403 | PyErr_NoMemory(); |
| 24404 | D(p->level--); |
| 24405 | return NULL; |
| 24406 | } |
| 24407 | _children = _new_children; |
| 24408 | } |
| 24409 | _children[_n++] = _res; |
| 24410 | _mark = p->mark; |
| 24411 | } |
| 24412 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24413 | 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] | 24414 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 24415 | } |
| 24416 | if (_n == 0 || p->error_indicator) { |
| 24417 | PyMem_Free(_children); |
| 24418 | D(p->level--); |
| 24419 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24420 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24421 | 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] | 24422 | if (!_seq) { |
| 24423 | PyMem_Free(_children); |
| 24424 | p->error_indicator = 1; |
| 24425 | PyErr_NoMemory(); |
| 24426 | D(p->level--); |
| 24427 | return NULL; |
| 24428 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24429 | 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] | 24430 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24431 | _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24432 | D(p->level--); |
| 24433 | return _seq; |
| 24434 | } |
| 24435 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24436 | // _loop1_97: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24437 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24438 | _loop1_97_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24439 | { |
| 24440 | D(p->level++); |
| 24441 | if (p->error_indicator) { |
| 24442 | D(p->level--); |
| 24443 | return NULL; |
| 24444 | } |
| 24445 | void *_res = NULL; |
| 24446 | int _mark = p->mark; |
| 24447 | int _start_mark = p->mark; |
| 24448 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24449 | if (!_children) { |
| 24450 | p->error_indicator = 1; |
| 24451 | PyErr_NoMemory(); |
| 24452 | D(p->level--); |
| 24453 | return NULL; |
| 24454 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24455 | Py_ssize_t _children_capacity = 1; |
| 24456 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24457 | { // lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24458 | if (p->error_indicator) { |
| 24459 | D(p->level--); |
| 24460 | return NULL; |
| 24461 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24462 | 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] | 24463 | arg_ty lambda_param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24464 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24465 | (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] | 24466 | ) |
| 24467 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24468 | _res = lambda_param_no_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24469 | if (_n == _children_capacity) { |
| 24470 | _children_capacity *= 2; |
| 24471 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24472 | if (!_new_children) { |
| 24473 | p->error_indicator = 1; |
| 24474 | PyErr_NoMemory(); |
| 24475 | D(p->level--); |
| 24476 | return NULL; |
| 24477 | } |
| 24478 | _children = _new_children; |
| 24479 | } |
| 24480 | _children[_n++] = _res; |
| 24481 | _mark = p->mark; |
| 24482 | } |
| 24483 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24484 | 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] | 24485 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24486 | } |
| 24487 | if (_n == 0 || p->error_indicator) { |
| 24488 | PyMem_Free(_children); |
| 24489 | D(p->level--); |
| 24490 | return NULL; |
| 24491 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24492 | 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] | 24493 | if (!_seq) { |
| 24494 | PyMem_Free(_children); |
| 24495 | p->error_indicator = 1; |
| 24496 | PyErr_NoMemory(); |
| 24497 | D(p->level--); |
| 24498 | return NULL; |
| 24499 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24500 | 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] | 24501 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24502 | _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24503 | D(p->level--); |
| 24504 | return _seq; |
| 24505 | } |
| 24506 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24507 | // _loop0_98: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24508 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24509 | _loop0_98_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24510 | { |
| 24511 | D(p->level++); |
| 24512 | if (p->error_indicator) { |
| 24513 | D(p->level--); |
| 24514 | return NULL; |
| 24515 | } |
| 24516 | void *_res = NULL; |
| 24517 | int _mark = p->mark; |
| 24518 | int _start_mark = p->mark; |
| 24519 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24520 | if (!_children) { |
| 24521 | p->error_indicator = 1; |
| 24522 | PyErr_NoMemory(); |
| 24523 | D(p->level--); |
| 24524 | return NULL; |
| 24525 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24526 | Py_ssize_t _children_capacity = 1; |
| 24527 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24528 | { // lambda_param_no_default |
| 24529 | if (p->error_indicator) { |
| 24530 | D(p->level--); |
| 24531 | return NULL; |
| 24532 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24533 | 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] | 24534 | arg_ty lambda_param_no_default_var; |
| 24535 | while ( |
| 24536 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 24537 | ) |
| 24538 | { |
| 24539 | _res = lambda_param_no_default_var; |
| 24540 | if (_n == _children_capacity) { |
| 24541 | _children_capacity *= 2; |
| 24542 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24543 | if (!_new_children) { |
| 24544 | p->error_indicator = 1; |
| 24545 | PyErr_NoMemory(); |
| 24546 | D(p->level--); |
| 24547 | return NULL; |
| 24548 | } |
| 24549 | _children = _new_children; |
| 24550 | } |
| 24551 | _children[_n++] = _res; |
| 24552 | _mark = p->mark; |
| 24553 | } |
| 24554 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24555 | 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] | 24556 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 24557 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24558 | 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] | 24559 | if (!_seq) { |
| 24560 | PyMem_Free(_children); |
| 24561 | p->error_indicator = 1; |
| 24562 | PyErr_NoMemory(); |
| 24563 | D(p->level--); |
| 24564 | return NULL; |
| 24565 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24566 | 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] | 24567 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24568 | _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24569 | D(p->level--); |
| 24570 | return _seq; |
| 24571 | } |
| 24572 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24573 | // _loop1_99: lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24574 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24575 | _loop1_99_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24576 | { |
| 24577 | D(p->level++); |
| 24578 | if (p->error_indicator) { |
| 24579 | D(p->level--); |
| 24580 | return NULL; |
| 24581 | } |
| 24582 | void *_res = NULL; |
| 24583 | int _mark = p->mark; |
| 24584 | int _start_mark = p->mark; |
| 24585 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24586 | if (!_children) { |
| 24587 | p->error_indicator = 1; |
| 24588 | PyErr_NoMemory(); |
| 24589 | D(p->level--); |
| 24590 | return NULL; |
| 24591 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24592 | Py_ssize_t _children_capacity = 1; |
| 24593 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24594 | { // lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24595 | if (p->error_indicator) { |
| 24596 | D(p->level--); |
| 24597 | return NULL; |
| 24598 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24599 | 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] | 24600 | NameDefaultPair* lambda_param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24601 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24602 | (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] | 24603 | ) |
| 24604 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24605 | _res = lambda_param_with_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24606 | if (_n == _children_capacity) { |
| 24607 | _children_capacity *= 2; |
| 24608 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24609 | if (!_new_children) { |
| 24610 | p->error_indicator = 1; |
| 24611 | PyErr_NoMemory(); |
| 24612 | D(p->level--); |
| 24613 | return NULL; |
| 24614 | } |
| 24615 | _children = _new_children; |
| 24616 | } |
| 24617 | _children[_n++] = _res; |
| 24618 | _mark = p->mark; |
| 24619 | } |
| 24620 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24621 | 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] | 24622 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24623 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24624 | if (_n == 0 || p->error_indicator) { |
| 24625 | PyMem_Free(_children); |
| 24626 | D(p->level--); |
| 24627 | return NULL; |
| 24628 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24629 | 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] | 24630 | if (!_seq) { |
| 24631 | PyMem_Free(_children); |
| 24632 | p->error_indicator = 1; |
| 24633 | PyErr_NoMemory(); |
| 24634 | D(p->level--); |
| 24635 | return NULL; |
| 24636 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24637 | 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] | 24638 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24639 | _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24640 | D(p->level--); |
| 24641 | return _seq; |
| 24642 | } |
| 24643 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24644 | // _loop0_100: lambda_param_no_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24645 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24646 | _loop0_100_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24647 | { |
| 24648 | D(p->level++); |
| 24649 | if (p->error_indicator) { |
| 24650 | D(p->level--); |
| 24651 | return NULL; |
| 24652 | } |
| 24653 | void *_res = NULL; |
| 24654 | int _mark = p->mark; |
| 24655 | int _start_mark = p->mark; |
| 24656 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24657 | if (!_children) { |
| 24658 | p->error_indicator = 1; |
| 24659 | PyErr_NoMemory(); |
| 24660 | D(p->level--); |
| 24661 | return NULL; |
| 24662 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24663 | Py_ssize_t _children_capacity = 1; |
| 24664 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24665 | { // lambda_param_no_default |
| 24666 | if (p->error_indicator) { |
| 24667 | D(p->level--); |
| 24668 | return NULL; |
| 24669 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24670 | 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] | 24671 | arg_ty lambda_param_no_default_var; |
| 24672 | while ( |
| 24673 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 24674 | ) |
| 24675 | { |
| 24676 | _res = lambda_param_no_default_var; |
| 24677 | if (_n == _children_capacity) { |
| 24678 | _children_capacity *= 2; |
| 24679 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24680 | if (!_new_children) { |
| 24681 | p->error_indicator = 1; |
| 24682 | PyErr_NoMemory(); |
| 24683 | D(p->level--); |
| 24684 | return NULL; |
| 24685 | } |
| 24686 | _children = _new_children; |
| 24687 | } |
| 24688 | _children[_n++] = _res; |
| 24689 | _mark = p->mark; |
| 24690 | } |
| 24691 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24692 | 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] | 24693 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 24694 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24695 | 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] | 24696 | if (!_seq) { |
| 24697 | PyMem_Free(_children); |
| 24698 | p->error_indicator = 1; |
| 24699 | PyErr_NoMemory(); |
| 24700 | D(p->level--); |
| 24701 | return NULL; |
| 24702 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24703 | 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] | 24704 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24705 | _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24706 | D(p->level--); |
| 24707 | return _seq; |
| 24708 | } |
| 24709 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24710 | // _loop1_101: lambda_param_with_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24711 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24712 | _loop1_101_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24713 | { |
| 24714 | D(p->level++); |
| 24715 | if (p->error_indicator) { |
| 24716 | D(p->level--); |
| 24717 | return NULL; |
| 24718 | } |
| 24719 | void *_res = NULL; |
| 24720 | int _mark = p->mark; |
| 24721 | int _start_mark = p->mark; |
| 24722 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24723 | if (!_children) { |
| 24724 | p->error_indicator = 1; |
| 24725 | PyErr_NoMemory(); |
| 24726 | D(p->level--); |
| 24727 | return NULL; |
| 24728 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24729 | Py_ssize_t _children_capacity = 1; |
| 24730 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24731 | { // lambda_param_with_default |
| 24732 | if (p->error_indicator) { |
| 24733 | D(p->level--); |
| 24734 | return NULL; |
| 24735 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24736 | 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] | 24737 | NameDefaultPair* lambda_param_with_default_var; |
| 24738 | while ( |
| 24739 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 24740 | ) |
| 24741 | { |
| 24742 | _res = lambda_param_with_default_var; |
| 24743 | if (_n == _children_capacity) { |
| 24744 | _children_capacity *= 2; |
| 24745 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24746 | if (!_new_children) { |
| 24747 | p->error_indicator = 1; |
| 24748 | PyErr_NoMemory(); |
| 24749 | D(p->level--); |
| 24750 | return NULL; |
| 24751 | } |
| 24752 | _children = _new_children; |
| 24753 | } |
| 24754 | _children[_n++] = _res; |
| 24755 | _mark = p->mark; |
| 24756 | } |
| 24757 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24758 | 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] | 24759 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 24760 | } |
| 24761 | if (_n == 0 || p->error_indicator) { |
| 24762 | PyMem_Free(_children); |
| 24763 | D(p->level--); |
| 24764 | return NULL; |
| 24765 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24766 | 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] | 24767 | if (!_seq) { |
| 24768 | PyMem_Free(_children); |
| 24769 | p->error_indicator = 1; |
| 24770 | PyErr_NoMemory(); |
| 24771 | D(p->level--); |
| 24772 | return NULL; |
| 24773 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24774 | 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] | 24775 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24776 | _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24777 | D(p->level--); |
| 24778 | return _seq; |
| 24779 | } |
| 24780 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24781 | // _loop0_102: lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24782 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24783 | _loop0_102_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24784 | { |
| 24785 | D(p->level++); |
| 24786 | if (p->error_indicator) { |
| 24787 | D(p->level--); |
| 24788 | return NULL; |
| 24789 | } |
| 24790 | void *_res = NULL; |
| 24791 | int _mark = p->mark; |
| 24792 | int _start_mark = p->mark; |
| 24793 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24794 | if (!_children) { |
| 24795 | p->error_indicator = 1; |
| 24796 | PyErr_NoMemory(); |
| 24797 | D(p->level--); |
| 24798 | return NULL; |
| 24799 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24800 | Py_ssize_t _children_capacity = 1; |
| 24801 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24802 | { // lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24803 | if (p->error_indicator) { |
| 24804 | D(p->level--); |
| 24805 | return NULL; |
| 24806 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24807 | 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] | 24808 | NameDefaultPair* lambda_param_maybe_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24809 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24810 | (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] | 24811 | ) |
| 24812 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24813 | _res = lambda_param_maybe_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24814 | if (_n == _children_capacity) { |
| 24815 | _children_capacity *= 2; |
| 24816 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24817 | if (!_new_children) { |
| 24818 | p->error_indicator = 1; |
| 24819 | PyErr_NoMemory(); |
| 24820 | D(p->level--); |
| 24821 | return NULL; |
| 24822 | } |
| 24823 | _children = _new_children; |
| 24824 | } |
| 24825 | _children[_n++] = _res; |
| 24826 | _mark = p->mark; |
| 24827 | } |
| 24828 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24829 | 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] | 24830 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24831 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24832 | 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] | 24833 | if (!_seq) { |
| 24834 | PyMem_Free(_children); |
| 24835 | p->error_indicator = 1; |
| 24836 | PyErr_NoMemory(); |
| 24837 | D(p->level--); |
| 24838 | return NULL; |
| 24839 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24840 | 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] | 24841 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24842 | _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24843 | D(p->level--); |
| 24844 | return _seq; |
| 24845 | } |
| 24846 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24847 | // _loop1_103: lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24848 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24849 | _loop1_103_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24850 | { |
| 24851 | D(p->level++); |
| 24852 | if (p->error_indicator) { |
| 24853 | D(p->level--); |
| 24854 | return NULL; |
| 24855 | } |
| 24856 | void *_res = NULL; |
| 24857 | int _mark = p->mark; |
| 24858 | int _start_mark = p->mark; |
| 24859 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24860 | if (!_children) { |
| 24861 | p->error_indicator = 1; |
| 24862 | PyErr_NoMemory(); |
| 24863 | D(p->level--); |
| 24864 | return NULL; |
| 24865 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24866 | Py_ssize_t _children_capacity = 1; |
| 24867 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24868 | { // lambda_param_maybe_default |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24869 | if (p->error_indicator) { |
| 24870 | D(p->level--); |
| 24871 | return NULL; |
| 24872 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24873 | 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] | 24874 | NameDefaultPair* lambda_param_maybe_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24875 | while ( |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24876 | (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] | 24877 | ) |
| 24878 | { |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 24879 | _res = lambda_param_maybe_default_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24880 | if (_n == _children_capacity) { |
| 24881 | _children_capacity *= 2; |
| 24882 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24883 | if (!_new_children) { |
| 24884 | p->error_indicator = 1; |
| 24885 | PyErr_NoMemory(); |
| 24886 | D(p->level--); |
| 24887 | return NULL; |
| 24888 | } |
| 24889 | _children = _new_children; |
| 24890 | } |
| 24891 | _children[_n++] = _res; |
| 24892 | _mark = p->mark; |
| 24893 | } |
| 24894 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24895 | 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] | 24896 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24897 | } |
| 24898 | if (_n == 0 || p->error_indicator) { |
| 24899 | PyMem_Free(_children); |
| 24900 | D(p->level--); |
| 24901 | return NULL; |
| 24902 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24903 | 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] | 24904 | if (!_seq) { |
| 24905 | PyMem_Free(_children); |
| 24906 | p->error_indicator = 1; |
| 24907 | PyErr_NoMemory(); |
| 24908 | D(p->level--); |
| 24909 | return NULL; |
| 24910 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24911 | 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] | 24912 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24913 | _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24914 | D(p->level--); |
| 24915 | return _seq; |
| 24916 | } |
| 24917 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24918 | // _loop1_104: ('or' conjunction) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24919 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24920 | _loop1_104_rule(Parser *p) |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 24921 | { |
| 24922 | D(p->level++); |
| 24923 | if (p->error_indicator) { |
| 24924 | D(p->level--); |
| 24925 | return NULL; |
| 24926 | } |
| 24927 | void *_res = NULL; |
| 24928 | int _mark = p->mark; |
| 24929 | int _start_mark = p->mark; |
| 24930 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 24931 | if (!_children) { |
| 24932 | p->error_indicator = 1; |
| 24933 | PyErr_NoMemory(); |
| 24934 | D(p->level--); |
| 24935 | return NULL; |
| 24936 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 24937 | Py_ssize_t _children_capacity = 1; |
| 24938 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24939 | { // ('or' conjunction) |
| 24940 | if (p->error_indicator) { |
| 24941 | D(p->level--); |
| 24942 | return NULL; |
| 24943 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24944 | D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); |
| 24945 | void *_tmp_168_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24946 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24947 | (_tmp_168_var = _tmp_168_rule(p)) // 'or' conjunction |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24948 | ) |
| 24949 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24950 | _res = _tmp_168_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24951 | if (_n == _children_capacity) { |
| 24952 | _children_capacity *= 2; |
| 24953 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 24954 | if (!_new_children) { |
| 24955 | p->error_indicator = 1; |
| 24956 | PyErr_NoMemory(); |
| 24957 | D(p->level--); |
| 24958 | return NULL; |
| 24959 | } |
| 24960 | _children = _new_children; |
| 24961 | } |
| 24962 | _children[_n++] = _res; |
| 24963 | _mark = p->mark; |
| 24964 | } |
| 24965 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24966 | 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] | 24967 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); |
| 24968 | } |
| 24969 | if (_n == 0 || p->error_indicator) { |
| 24970 | PyMem_Free(_children); |
| 24971 | D(p->level--); |
| 24972 | return NULL; |
| 24973 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24974 | 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] | 24975 | if (!_seq) { |
| 24976 | PyMem_Free(_children); |
| 24977 | p->error_indicator = 1; |
| 24978 | PyErr_NoMemory(); |
| 24979 | D(p->level--); |
| 24980 | return NULL; |
| 24981 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 24982 | 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] | 24983 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24984 | _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24985 | D(p->level--); |
| 24986 | return _seq; |
| 24987 | } |
| 24988 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24989 | // _loop1_105: ('and' inversion) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24990 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 24991 | _loop1_105_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 24992 | { |
| 24993 | D(p->level++); |
| 24994 | if (p->error_indicator) { |
| 24995 | D(p->level--); |
| 24996 | return NULL; |
| 24997 | } |
| 24998 | void *_res = NULL; |
| 24999 | int _mark = p->mark; |
| 25000 | int _start_mark = p->mark; |
| 25001 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25002 | if (!_children) { |
| 25003 | p->error_indicator = 1; |
| 25004 | PyErr_NoMemory(); |
| 25005 | D(p->level--); |
| 25006 | return NULL; |
| 25007 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25008 | Py_ssize_t _children_capacity = 1; |
| 25009 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25010 | { // ('and' inversion) |
| 25011 | if (p->error_indicator) { |
| 25012 | D(p->level--); |
| 25013 | return NULL; |
| 25014 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25015 | D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); |
| 25016 | void *_tmp_169_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25017 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25018 | (_tmp_169_var = _tmp_169_rule(p)) // 'and' inversion |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25019 | ) |
| 25020 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25021 | _res = _tmp_169_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25022 | if (_n == _children_capacity) { |
| 25023 | _children_capacity *= 2; |
| 25024 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25025 | if (!_new_children) { |
| 25026 | p->error_indicator = 1; |
| 25027 | PyErr_NoMemory(); |
| 25028 | D(p->level--); |
| 25029 | return NULL; |
| 25030 | } |
| 25031 | _children = _new_children; |
| 25032 | } |
| 25033 | _children[_n++] = _res; |
| 25034 | _mark = p->mark; |
| 25035 | } |
| 25036 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25037 | 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] | 25038 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); |
| 25039 | } |
| 25040 | if (_n == 0 || p->error_indicator) { |
| 25041 | PyMem_Free(_children); |
| 25042 | D(p->level--); |
| 25043 | return NULL; |
| 25044 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25045 | 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] | 25046 | if (!_seq) { |
| 25047 | PyMem_Free(_children); |
| 25048 | p->error_indicator = 1; |
| 25049 | PyErr_NoMemory(); |
| 25050 | D(p->level--); |
| 25051 | return NULL; |
| 25052 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25053 | 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] | 25054 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25055 | _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25056 | D(p->level--); |
| 25057 | return _seq; |
| 25058 | } |
| 25059 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25060 | // _loop1_106: compare_op_bitwise_or_pair |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25061 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25062 | _loop1_106_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25063 | { |
| 25064 | D(p->level++); |
| 25065 | if (p->error_indicator) { |
| 25066 | D(p->level--); |
| 25067 | return NULL; |
| 25068 | } |
| 25069 | void *_res = NULL; |
| 25070 | int _mark = p->mark; |
| 25071 | int _start_mark = p->mark; |
| 25072 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25073 | if (!_children) { |
| 25074 | p->error_indicator = 1; |
| 25075 | PyErr_NoMemory(); |
| 25076 | D(p->level--); |
| 25077 | return NULL; |
| 25078 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25079 | Py_ssize_t _children_capacity = 1; |
| 25080 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25081 | { // compare_op_bitwise_or_pair |
| 25082 | if (p->error_indicator) { |
| 25083 | D(p->level--); |
| 25084 | return NULL; |
| 25085 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25086 | 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] | 25087 | CmpopExprPair* compare_op_bitwise_or_pair_var; |
| 25088 | while ( |
| 25089 | (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair |
| 25090 | ) |
| 25091 | { |
| 25092 | _res = compare_op_bitwise_or_pair_var; |
| 25093 | if (_n == _children_capacity) { |
| 25094 | _children_capacity *= 2; |
| 25095 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25096 | if (!_new_children) { |
| 25097 | p->error_indicator = 1; |
| 25098 | PyErr_NoMemory(); |
| 25099 | D(p->level--); |
| 25100 | return NULL; |
| 25101 | } |
| 25102 | _children = _new_children; |
| 25103 | } |
| 25104 | _children[_n++] = _res; |
| 25105 | _mark = p->mark; |
| 25106 | } |
| 25107 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25108 | 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] | 25109 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); |
| 25110 | } |
| 25111 | if (_n == 0 || p->error_indicator) { |
| 25112 | PyMem_Free(_children); |
| 25113 | D(p->level--); |
| 25114 | return NULL; |
| 25115 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25116 | 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] | 25117 | if (!_seq) { |
| 25118 | PyMem_Free(_children); |
| 25119 | p->error_indicator = 1; |
| 25120 | PyErr_NoMemory(); |
| 25121 | D(p->level--); |
| 25122 | return NULL; |
| 25123 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25124 | 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] | 25125 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25126 | _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25127 | D(p->level--); |
| 25128 | return _seq; |
| 25129 | } |
| 25130 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25131 | // _tmp_107: '!=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25132 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25133 | _tmp_107_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25134 | { |
| 25135 | D(p->level++); |
| 25136 | if (p->error_indicator) { |
| 25137 | D(p->level--); |
| 25138 | return NULL; |
| 25139 | } |
| 25140 | void * _res = NULL; |
| 25141 | int _mark = p->mark; |
| 25142 | { // '!=' |
| 25143 | if (p->error_indicator) { |
| 25144 | D(p->level--); |
| 25145 | return NULL; |
| 25146 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25147 | 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] | 25148 | Token * tok; |
| 25149 | if ( |
| 25150 | (tok = _PyPegen_expect_token(p, 28)) // token='!=' |
| 25151 | ) |
| 25152 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25153 | 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] | 25154 | _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25155 | if (_res == NULL && PyErr_Occurred()) { |
| 25156 | p->error_indicator = 1; |
| 25157 | D(p->level--); |
| 25158 | return NULL; |
| 25159 | } |
| 25160 | goto done; |
| 25161 | } |
| 25162 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25163 | 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] | 25164 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); |
| 25165 | } |
| 25166 | _res = NULL; |
| 25167 | done: |
| 25168 | D(p->level--); |
| 25169 | return _res; |
| 25170 | } |
| 25171 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25172 | // _loop0_109: ',' slice |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25173 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25174 | _loop0_109_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25175 | { |
| 25176 | D(p->level++); |
| 25177 | if (p->error_indicator) { |
| 25178 | D(p->level--); |
| 25179 | return NULL; |
| 25180 | } |
| 25181 | void *_res = NULL; |
| 25182 | int _mark = p->mark; |
| 25183 | int _start_mark = p->mark; |
| 25184 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25185 | if (!_children) { |
| 25186 | p->error_indicator = 1; |
| 25187 | PyErr_NoMemory(); |
| 25188 | D(p->level--); |
| 25189 | return NULL; |
| 25190 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25191 | Py_ssize_t _children_capacity = 1; |
| 25192 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25193 | { // ',' slice |
| 25194 | if (p->error_indicator) { |
| 25195 | D(p->level--); |
| 25196 | return NULL; |
| 25197 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25198 | 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] | 25199 | Token * _literal; |
| 25200 | expr_ty elem; |
| 25201 | while ( |
| 25202 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 25203 | && |
| 25204 | (elem = slice_rule(p)) // slice |
| 25205 | ) |
| 25206 | { |
| 25207 | _res = elem; |
| 25208 | if (_res == NULL && PyErr_Occurred()) { |
| 25209 | p->error_indicator = 1; |
| 25210 | PyMem_Free(_children); |
| 25211 | D(p->level--); |
| 25212 | return NULL; |
| 25213 | } |
| 25214 | if (_n == _children_capacity) { |
| 25215 | _children_capacity *= 2; |
| 25216 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25217 | if (!_new_children) { |
| 25218 | p->error_indicator = 1; |
| 25219 | PyErr_NoMemory(); |
| 25220 | D(p->level--); |
| 25221 | return NULL; |
| 25222 | } |
| 25223 | _children = _new_children; |
| 25224 | } |
| 25225 | _children[_n++] = _res; |
| 25226 | _mark = p->mark; |
| 25227 | } |
| 25228 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25229 | 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] | 25230 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); |
| 25231 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25232 | 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] | 25233 | if (!_seq) { |
| 25234 | PyMem_Free(_children); |
| 25235 | p->error_indicator = 1; |
| 25236 | PyErr_NoMemory(); |
| 25237 | D(p->level--); |
| 25238 | return NULL; |
| 25239 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25240 | 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] | 25241 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25242 | _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25243 | D(p->level--); |
| 25244 | return _seq; |
| 25245 | } |
| 25246 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25247 | // _gather_108: slice _loop0_109 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25248 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25249 | _gather_108_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25250 | { |
| 25251 | D(p->level++); |
| 25252 | if (p->error_indicator) { |
| 25253 | D(p->level--); |
| 25254 | return NULL; |
| 25255 | } |
| 25256 | asdl_seq * _res = NULL; |
| 25257 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25258 | { // slice _loop0_109 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25259 | if (p->error_indicator) { |
| 25260 | D(p->level--); |
| 25261 | return NULL; |
| 25262 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25263 | 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] | 25264 | expr_ty elem; |
| 25265 | asdl_seq * seq; |
| 25266 | if ( |
| 25267 | (elem = slice_rule(p)) // slice |
| 25268 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25269 | (seq = _loop0_109_rule(p)) // _loop0_109 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25270 | ) |
| 25271 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25272 | 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] | 25273 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 25274 | goto done; |
| 25275 | } |
| 25276 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25277 | D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ', |
| 25278 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_109")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25279 | } |
| 25280 | _res = NULL; |
| 25281 | done: |
| 25282 | D(p->level--); |
| 25283 | return _res; |
| 25284 | } |
| 25285 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25286 | // _tmp_110: ':' expression? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25287 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25288 | _tmp_110_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25289 | { |
| 25290 | D(p->level++); |
| 25291 | if (p->error_indicator) { |
| 25292 | D(p->level--); |
| 25293 | return NULL; |
| 25294 | } |
| 25295 | void * _res = NULL; |
| 25296 | int _mark = p->mark; |
| 25297 | { // ':' expression? |
| 25298 | if (p->error_indicator) { |
| 25299 | D(p->level--); |
| 25300 | return NULL; |
| 25301 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25302 | 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] | 25303 | Token * _literal; |
| 25304 | void *d; |
| 25305 | if ( |
| 25306 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 25307 | && |
| 25308 | (d = expression_rule(p), 1) // expression? |
| 25309 | ) |
| 25310 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25311 | 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] | 25312 | _res = d; |
| 25313 | if (_res == NULL && PyErr_Occurred()) { |
| 25314 | p->error_indicator = 1; |
| 25315 | D(p->level--); |
| 25316 | return NULL; |
| 25317 | } |
| 25318 | goto done; |
| 25319 | } |
| 25320 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25321 | 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] | 25322 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); |
| 25323 | } |
| 25324 | _res = NULL; |
| 25325 | done: |
| 25326 | D(p->level--); |
| 25327 | return _res; |
| 25328 | } |
| 25329 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25330 | // _tmp_111: tuple | group | genexp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25331 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25332 | _tmp_111_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25333 | { |
| 25334 | D(p->level++); |
| 25335 | if (p->error_indicator) { |
| 25336 | D(p->level--); |
| 25337 | return NULL; |
| 25338 | } |
| 25339 | void * _res = NULL; |
| 25340 | int _mark = p->mark; |
| 25341 | { // tuple |
| 25342 | if (p->error_indicator) { |
| 25343 | D(p->level--); |
| 25344 | return NULL; |
| 25345 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25346 | 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] | 25347 | expr_ty tuple_var; |
| 25348 | if ( |
| 25349 | (tuple_var = tuple_rule(p)) // tuple |
| 25350 | ) |
| 25351 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25352 | 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] | 25353 | _res = tuple_var; |
| 25354 | goto done; |
| 25355 | } |
| 25356 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25357 | 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] | 25358 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
| 25359 | } |
| 25360 | { // group |
| 25361 | if (p->error_indicator) { |
| 25362 | D(p->level--); |
| 25363 | return NULL; |
| 25364 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25365 | 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] | 25366 | expr_ty group_var; |
| 25367 | if ( |
| 25368 | (group_var = group_rule(p)) // group |
| 25369 | ) |
| 25370 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25371 | 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] | 25372 | _res = group_var; |
| 25373 | goto done; |
| 25374 | } |
| 25375 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25376 | 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] | 25377 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); |
| 25378 | } |
| 25379 | { // genexp |
| 25380 | if (p->error_indicator) { |
| 25381 | D(p->level--); |
| 25382 | return NULL; |
| 25383 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25384 | 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] | 25385 | expr_ty genexp_var; |
| 25386 | if ( |
| 25387 | (genexp_var = genexp_rule(p)) // genexp |
| 25388 | ) |
| 25389 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25390 | 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] | 25391 | _res = genexp_var; |
| 25392 | goto done; |
| 25393 | } |
| 25394 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25395 | 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] | 25396 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); |
| 25397 | } |
| 25398 | _res = NULL; |
| 25399 | done: |
| 25400 | D(p->level--); |
| 25401 | return _res; |
| 25402 | } |
| 25403 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25404 | // _tmp_112: list | listcomp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25405 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25406 | _tmp_112_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25407 | { |
| 25408 | D(p->level++); |
| 25409 | if (p->error_indicator) { |
| 25410 | D(p->level--); |
| 25411 | return NULL; |
| 25412 | } |
| 25413 | void * _res = NULL; |
| 25414 | int _mark = p->mark; |
| 25415 | { // list |
| 25416 | if (p->error_indicator) { |
| 25417 | D(p->level--); |
| 25418 | return NULL; |
| 25419 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25420 | 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] | 25421 | expr_ty list_var; |
| 25422 | if ( |
| 25423 | (list_var = list_rule(p)) // list |
| 25424 | ) |
| 25425 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25426 | 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] | 25427 | _res = list_var; |
| 25428 | goto done; |
| 25429 | } |
| 25430 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25431 | 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] | 25432 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
| 25433 | } |
| 25434 | { // listcomp |
| 25435 | if (p->error_indicator) { |
| 25436 | D(p->level--); |
| 25437 | return NULL; |
| 25438 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25439 | 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] | 25440 | expr_ty listcomp_var; |
| 25441 | if ( |
| 25442 | (listcomp_var = listcomp_rule(p)) // listcomp |
| 25443 | ) |
| 25444 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25445 | 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] | 25446 | _res = listcomp_var; |
| 25447 | goto done; |
| 25448 | } |
| 25449 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25450 | 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] | 25451 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); |
| 25452 | } |
| 25453 | _res = NULL; |
| 25454 | done: |
| 25455 | D(p->level--); |
| 25456 | return _res; |
| 25457 | } |
| 25458 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25459 | // _tmp_113: dict | set | dictcomp | setcomp |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25460 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25461 | _tmp_113_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25462 | { |
| 25463 | D(p->level++); |
| 25464 | if (p->error_indicator) { |
| 25465 | D(p->level--); |
| 25466 | return NULL; |
| 25467 | } |
| 25468 | void * _res = NULL; |
| 25469 | int _mark = p->mark; |
| 25470 | { // dict |
| 25471 | if (p->error_indicator) { |
| 25472 | D(p->level--); |
| 25473 | return NULL; |
| 25474 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25475 | 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] | 25476 | expr_ty dict_var; |
| 25477 | if ( |
| 25478 | (dict_var = dict_rule(p)) // dict |
| 25479 | ) |
| 25480 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25481 | 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] | 25482 | _res = dict_var; |
| 25483 | goto done; |
| 25484 | } |
| 25485 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25486 | 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] | 25487 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); |
| 25488 | } |
| 25489 | { // set |
| 25490 | if (p->error_indicator) { |
| 25491 | D(p->level--); |
| 25492 | return NULL; |
| 25493 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25494 | 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] | 25495 | expr_ty set_var; |
| 25496 | if ( |
| 25497 | (set_var = set_rule(p)) // set |
| 25498 | ) |
| 25499 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25500 | 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] | 25501 | _res = set_var; |
| 25502 | goto done; |
| 25503 | } |
| 25504 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25505 | 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] | 25506 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); |
| 25507 | } |
| 25508 | { // dictcomp |
| 25509 | if (p->error_indicator) { |
| 25510 | D(p->level--); |
| 25511 | return NULL; |
| 25512 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25513 | 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] | 25514 | expr_ty dictcomp_var; |
| 25515 | if ( |
| 25516 | (dictcomp_var = dictcomp_rule(p)) // dictcomp |
| 25517 | ) |
| 25518 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25519 | 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] | 25520 | _res = dictcomp_var; |
| 25521 | goto done; |
| 25522 | } |
| 25523 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25524 | 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] | 25525 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); |
| 25526 | } |
| 25527 | { // setcomp |
| 25528 | if (p->error_indicator) { |
| 25529 | D(p->level--); |
| 25530 | return NULL; |
| 25531 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25532 | 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] | 25533 | expr_ty setcomp_var; |
| 25534 | if ( |
| 25535 | (setcomp_var = setcomp_rule(p)) // setcomp |
| 25536 | ) |
| 25537 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25538 | 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] | 25539 | _res = setcomp_var; |
| 25540 | goto done; |
| 25541 | } |
| 25542 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25543 | 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] | 25544 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); |
| 25545 | } |
| 25546 | _res = NULL; |
| 25547 | done: |
| 25548 | D(p->level--); |
| 25549 | return _res; |
| 25550 | } |
| 25551 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25552 | // _loop1_114: STRING |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25553 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25554 | _loop1_114_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25555 | { |
| 25556 | D(p->level++); |
| 25557 | if (p->error_indicator) { |
| 25558 | D(p->level--); |
| 25559 | return NULL; |
| 25560 | } |
| 25561 | void *_res = NULL; |
| 25562 | int _mark = p->mark; |
| 25563 | int _start_mark = p->mark; |
| 25564 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25565 | if (!_children) { |
| 25566 | p->error_indicator = 1; |
| 25567 | PyErr_NoMemory(); |
| 25568 | D(p->level--); |
| 25569 | return NULL; |
| 25570 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25571 | Py_ssize_t _children_capacity = 1; |
| 25572 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25573 | { // STRING |
| 25574 | if (p->error_indicator) { |
| 25575 | D(p->level--); |
| 25576 | return NULL; |
| 25577 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25578 | 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] | 25579 | expr_ty string_var; |
| 25580 | while ( |
| 25581 | (string_var = _PyPegen_string_token(p)) // STRING |
| 25582 | ) |
| 25583 | { |
| 25584 | _res = string_var; |
| 25585 | if (_n == _children_capacity) { |
| 25586 | _children_capacity *= 2; |
| 25587 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25588 | if (!_new_children) { |
| 25589 | p->error_indicator = 1; |
| 25590 | PyErr_NoMemory(); |
| 25591 | D(p->level--); |
| 25592 | return NULL; |
| 25593 | } |
| 25594 | _children = _new_children; |
| 25595 | } |
| 25596 | _children[_n++] = _res; |
| 25597 | _mark = p->mark; |
| 25598 | } |
| 25599 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25600 | 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] | 25601 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); |
| 25602 | } |
| 25603 | if (_n == 0 || p->error_indicator) { |
| 25604 | PyMem_Free(_children); |
| 25605 | D(p->level--); |
| 25606 | return NULL; |
| 25607 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25608 | 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] | 25609 | if (!_seq) { |
| 25610 | PyMem_Free(_children); |
| 25611 | p->error_indicator = 1; |
| 25612 | PyErr_NoMemory(); |
| 25613 | D(p->level--); |
| 25614 | return NULL; |
| 25615 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25616 | 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] | 25617 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25618 | _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25619 | D(p->level--); |
| 25620 | return _seq; |
| 25621 | } |
| 25622 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25623 | // _tmp_115: star_named_expression ',' star_named_expressions? |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25624 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25625 | _tmp_115_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25626 | { |
| 25627 | D(p->level++); |
| 25628 | if (p->error_indicator) { |
| 25629 | D(p->level--); |
| 25630 | return NULL; |
| 25631 | } |
| 25632 | void * _res = NULL; |
| 25633 | int _mark = p->mark; |
| 25634 | { // star_named_expression ',' star_named_expressions? |
| 25635 | if (p->error_indicator) { |
| 25636 | D(p->level--); |
| 25637 | return NULL; |
| 25638 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25639 | 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] | 25640 | Token * _literal; |
| 25641 | expr_ty y; |
| 25642 | void *z; |
| 25643 | if ( |
| 25644 | (y = star_named_expression_rule(p)) // star_named_expression |
| 25645 | && |
| 25646 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 25647 | && |
| 25648 | (z = star_named_expressions_rule(p), 1) // star_named_expressions? |
| 25649 | ) |
| 25650 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25651 | 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] | 25652 | _res = _PyPegen_seq_insert_in_front ( p , y , z ); |
| 25653 | if (_res == NULL && PyErr_Occurred()) { |
| 25654 | p->error_indicator = 1; |
| 25655 | D(p->level--); |
| 25656 | return NULL; |
| 25657 | } |
| 25658 | goto done; |
| 25659 | } |
| 25660 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25661 | 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] | 25662 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
| 25663 | } |
| 25664 | _res = NULL; |
| 25665 | done: |
| 25666 | D(p->level--); |
| 25667 | return _res; |
| 25668 | } |
| 25669 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25670 | // _tmp_116: yield_expr | named_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25671 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25672 | _tmp_116_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25673 | { |
| 25674 | D(p->level++); |
| 25675 | if (p->error_indicator) { |
| 25676 | D(p->level--); |
| 25677 | return NULL; |
| 25678 | } |
| 25679 | void * _res = NULL; |
| 25680 | int _mark = p->mark; |
| 25681 | { // yield_expr |
| 25682 | if (p->error_indicator) { |
| 25683 | D(p->level--); |
| 25684 | return NULL; |
| 25685 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25686 | 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] | 25687 | expr_ty yield_expr_var; |
| 25688 | if ( |
| 25689 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 25690 | ) |
| 25691 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25692 | 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] | 25693 | _res = yield_expr_var; |
| 25694 | goto done; |
| 25695 | } |
| 25696 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25697 | 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] | 25698 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 25699 | } |
| 25700 | { // named_expression |
| 25701 | if (p->error_indicator) { |
| 25702 | D(p->level--); |
| 25703 | return NULL; |
| 25704 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25705 | 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] | 25706 | expr_ty named_expression_var; |
| 25707 | if ( |
| 25708 | (named_expression_var = named_expression_rule(p)) // named_expression |
| 25709 | ) |
| 25710 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25711 | 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] | 25712 | _res = named_expression_var; |
| 25713 | goto done; |
| 25714 | } |
| 25715 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25716 | 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] | 25717 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
| 25718 | } |
| 25719 | _res = NULL; |
| 25720 | done: |
| 25721 | D(p->level--); |
| 25722 | return _res; |
| 25723 | } |
| 25724 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25725 | // _loop0_118: ',' double_starred_kvpair |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25726 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25727 | _loop0_118_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25728 | { |
| 25729 | D(p->level++); |
| 25730 | if (p->error_indicator) { |
| 25731 | D(p->level--); |
| 25732 | return NULL; |
| 25733 | } |
| 25734 | void *_res = NULL; |
| 25735 | int _mark = p->mark; |
| 25736 | int _start_mark = p->mark; |
| 25737 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25738 | if (!_children) { |
| 25739 | p->error_indicator = 1; |
| 25740 | PyErr_NoMemory(); |
| 25741 | D(p->level--); |
| 25742 | return NULL; |
| 25743 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25744 | Py_ssize_t _children_capacity = 1; |
| 25745 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25746 | { // ',' double_starred_kvpair |
| 25747 | if (p->error_indicator) { |
| 25748 | D(p->level--); |
| 25749 | return NULL; |
| 25750 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25751 | 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] | 25752 | Token * _literal; |
| 25753 | KeyValuePair* elem; |
| 25754 | while ( |
| 25755 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 25756 | && |
| 25757 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
| 25758 | ) |
| 25759 | { |
| 25760 | _res = elem; |
| 25761 | if (_res == NULL && PyErr_Occurred()) { |
| 25762 | p->error_indicator = 1; |
| 25763 | PyMem_Free(_children); |
| 25764 | D(p->level--); |
| 25765 | return NULL; |
| 25766 | } |
| 25767 | if (_n == _children_capacity) { |
| 25768 | _children_capacity *= 2; |
| 25769 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25770 | if (!_new_children) { |
| 25771 | p->error_indicator = 1; |
| 25772 | PyErr_NoMemory(); |
| 25773 | D(p->level--); |
| 25774 | return NULL; |
| 25775 | } |
| 25776 | _children = _new_children; |
| 25777 | } |
| 25778 | _children[_n++] = _res; |
| 25779 | _mark = p->mark; |
| 25780 | } |
| 25781 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25782 | 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] | 25783 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); |
| 25784 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25785 | 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] | 25786 | if (!_seq) { |
| 25787 | PyMem_Free(_children); |
| 25788 | p->error_indicator = 1; |
| 25789 | PyErr_NoMemory(); |
| 25790 | D(p->level--); |
| 25791 | return NULL; |
| 25792 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25793 | 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] | 25794 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25795 | _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25796 | D(p->level--); |
| 25797 | return _seq; |
| 25798 | } |
| 25799 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25800 | // _gather_117: double_starred_kvpair _loop0_118 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25801 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25802 | _gather_117_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25803 | { |
| 25804 | D(p->level++); |
| 25805 | if (p->error_indicator) { |
| 25806 | D(p->level--); |
| 25807 | return NULL; |
| 25808 | } |
| 25809 | asdl_seq * _res = NULL; |
| 25810 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25811 | { // double_starred_kvpair _loop0_118 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25812 | if (p->error_indicator) { |
| 25813 | D(p->level--); |
| 25814 | return NULL; |
| 25815 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25816 | 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] | 25817 | KeyValuePair* elem; |
| 25818 | asdl_seq * seq; |
| 25819 | if ( |
| 25820 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
| 25821 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25822 | (seq = _loop0_118_rule(p)) // _loop0_118 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25823 | ) |
| 25824 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25825 | 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] | 25826 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 25827 | goto done; |
| 25828 | } |
| 25829 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25830 | D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ', |
| 25831 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_118")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25832 | } |
| 25833 | _res = NULL; |
| 25834 | done: |
| 25835 | D(p->level--); |
| 25836 | return _res; |
| 25837 | } |
| 25838 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25839 | // _loop1_119: for_if_clause |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25840 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25841 | _loop1_119_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25842 | { |
| 25843 | D(p->level++); |
| 25844 | if (p->error_indicator) { |
| 25845 | D(p->level--); |
| 25846 | return NULL; |
| 25847 | } |
| 25848 | void *_res = NULL; |
| 25849 | int _mark = p->mark; |
| 25850 | int _start_mark = p->mark; |
| 25851 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25852 | if (!_children) { |
| 25853 | p->error_indicator = 1; |
| 25854 | PyErr_NoMemory(); |
| 25855 | D(p->level--); |
| 25856 | return NULL; |
| 25857 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25858 | Py_ssize_t _children_capacity = 1; |
| 25859 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25860 | { // for_if_clause |
| 25861 | if (p->error_indicator) { |
| 25862 | D(p->level--); |
| 25863 | return NULL; |
| 25864 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25865 | 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] | 25866 | comprehension_ty for_if_clause_var; |
| 25867 | while ( |
| 25868 | (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause |
| 25869 | ) |
| 25870 | { |
| 25871 | _res = for_if_clause_var; |
| 25872 | if (_n == _children_capacity) { |
| 25873 | _children_capacity *= 2; |
| 25874 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25875 | if (!_new_children) { |
| 25876 | p->error_indicator = 1; |
| 25877 | PyErr_NoMemory(); |
| 25878 | D(p->level--); |
| 25879 | return NULL; |
| 25880 | } |
| 25881 | _children = _new_children; |
| 25882 | } |
| 25883 | _children[_n++] = _res; |
| 25884 | _mark = p->mark; |
| 25885 | } |
| 25886 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25887 | 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] | 25888 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); |
| 25889 | } |
| 25890 | if (_n == 0 || p->error_indicator) { |
| 25891 | PyMem_Free(_children); |
| 25892 | D(p->level--); |
| 25893 | return NULL; |
| 25894 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25895 | 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] | 25896 | if (!_seq) { |
| 25897 | PyMem_Free(_children); |
| 25898 | p->error_indicator = 1; |
| 25899 | PyErr_NoMemory(); |
| 25900 | D(p->level--); |
| 25901 | return NULL; |
| 25902 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25903 | 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] | 25904 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25905 | _PyPegen_insert_memo(p, _start_mark, _loop1_119_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25906 | D(p->level--); |
| 25907 | return _seq; |
| 25908 | } |
| 25909 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25910 | // _loop0_120: ('if' disjunction) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25911 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25912 | _loop0_120_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25913 | { |
| 25914 | D(p->level++); |
| 25915 | if (p->error_indicator) { |
| 25916 | D(p->level--); |
| 25917 | return NULL; |
| 25918 | } |
| 25919 | void *_res = NULL; |
| 25920 | int _mark = p->mark; |
| 25921 | int _start_mark = p->mark; |
| 25922 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25923 | if (!_children) { |
| 25924 | p->error_indicator = 1; |
| 25925 | PyErr_NoMemory(); |
| 25926 | D(p->level--); |
| 25927 | return NULL; |
| 25928 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25929 | Py_ssize_t _children_capacity = 1; |
| 25930 | Py_ssize_t _n = 0; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25931 | { // ('if' disjunction) |
| 25932 | if (p->error_indicator) { |
| 25933 | D(p->level--); |
| 25934 | return NULL; |
| 25935 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25936 | D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
| 25937 | void *_tmp_170_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25938 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25939 | (_tmp_170_var = _tmp_170_rule(p)) // 'if' disjunction |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25940 | ) |
| 25941 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25942 | _res = _tmp_170_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25943 | if (_n == _children_capacity) { |
| 25944 | _children_capacity *= 2; |
| 25945 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 25946 | if (!_new_children) { |
| 25947 | p->error_indicator = 1; |
| 25948 | PyErr_NoMemory(); |
| 25949 | D(p->level--); |
| 25950 | return NULL; |
| 25951 | } |
| 25952 | _children = _new_children; |
| 25953 | } |
| 25954 | _children[_n++] = _res; |
| 25955 | _mark = p->mark; |
| 25956 | } |
| 25957 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25958 | 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] | 25959 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
| 25960 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25961 | 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] | 25962 | if (!_seq) { |
| 25963 | PyMem_Free(_children); |
| 25964 | p->error_indicator = 1; |
| 25965 | PyErr_NoMemory(); |
| 25966 | D(p->level--); |
| 25967 | return NULL; |
| 25968 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 25969 | 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] | 25970 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25971 | _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 25972 | D(p->level--); |
| 25973 | return _seq; |
| 25974 | } |
| 25975 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25976 | // _loop0_121: ('if' disjunction) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 25977 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 25978 | _loop0_121_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 25979 | { |
| 25980 | D(p->level++); |
| 25981 | if (p->error_indicator) { |
| 25982 | D(p->level--); |
| 25983 | return NULL; |
| 25984 | } |
| 25985 | void *_res = NULL; |
| 25986 | int _mark = p->mark; |
| 25987 | int _start_mark = p->mark; |
| 25988 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 25989 | if (!_children) { |
| 25990 | p->error_indicator = 1; |
| 25991 | PyErr_NoMemory(); |
| 25992 | D(p->level--); |
| 25993 | return NULL; |
| 25994 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 25995 | Py_ssize_t _children_capacity = 1; |
| 25996 | Py_ssize_t _n = 0; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 25997 | { // ('if' disjunction) |
| 25998 | if (p->error_indicator) { |
| 25999 | D(p->level--); |
| 26000 | return NULL; |
| 26001 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26002 | D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
| 26003 | void *_tmp_171_var; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26004 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26005 | (_tmp_171_var = _tmp_171_rule(p)) // 'if' disjunction |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26006 | ) |
| 26007 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26008 | _res = _tmp_171_var; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26009 | if (_n == _children_capacity) { |
| 26010 | _children_capacity *= 2; |
| 26011 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26012 | if (!_new_children) { |
| 26013 | p->error_indicator = 1; |
| 26014 | PyErr_NoMemory(); |
| 26015 | D(p->level--); |
| 26016 | return NULL; |
| 26017 | } |
| 26018 | _children = _new_children; |
| 26019 | } |
| 26020 | _children[_n++] = _res; |
| 26021 | _mark = p->mark; |
| 26022 | } |
| 26023 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26024 | 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] | 26025 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
| 26026 | } |
| 26027 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26028 | if (!_seq) { |
| 26029 | PyMem_Free(_children); |
| 26030 | p->error_indicator = 1; |
| 26031 | PyErr_NoMemory(); |
| 26032 | D(p->level--); |
| 26033 | return NULL; |
| 26034 | } |
| 26035 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26036 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26037 | _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26038 | D(p->level--); |
| 26039 | return _seq; |
| 26040 | } |
| 26041 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26042 | // _loop0_123: ',' (starred_expression | named_expression !'=') |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 26043 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26044 | _loop0_123_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26045 | { |
| 26046 | D(p->level++); |
| 26047 | if (p->error_indicator) { |
| 26048 | D(p->level--); |
| 26049 | return NULL; |
| 26050 | } |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 26051 | void *_res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26052 | int _mark = p->mark; |
Lysandros Nikolaou | 01ece63 | 2020-06-19 02:10:43 +0300 | [diff] [blame] | 26053 | int _start_mark = p->mark; |
| 26054 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26055 | if (!_children) { |
| 26056 | p->error_indicator = 1; |
| 26057 | PyErr_NoMemory(); |
| 26058 | D(p->level--); |
| 26059 | return NULL; |
| 26060 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26061 | Py_ssize_t _children_capacity = 1; |
| 26062 | Py_ssize_t _n = 0; |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 26063 | { // ',' (starred_expression | named_expression !'=') |
| 26064 | if (p->error_indicator) { |
| 26065 | D(p->level--); |
| 26066 | return NULL; |
| 26067 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26068 | 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] | 26069 | Token * _literal; |
| 26070 | void *elem; |
| 26071 | while ( |
| 26072 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26073 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26074 | (elem = _tmp_172_rule(p)) // starred_expression | named_expression !'=' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26075 | ) |
| 26076 | { |
| 26077 | _res = elem; |
| 26078 | if (_res == NULL && PyErr_Occurred()) { |
| 26079 | p->error_indicator = 1; |
| 26080 | PyMem_Free(_children); |
| 26081 | D(p->level--); |
| 26082 | return NULL; |
| 26083 | } |
| 26084 | if (_n == _children_capacity) { |
| 26085 | _children_capacity *= 2; |
| 26086 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26087 | if (!_new_children) { |
| 26088 | p->error_indicator = 1; |
| 26089 | PyErr_NoMemory(); |
| 26090 | D(p->level--); |
| 26091 | return NULL; |
| 26092 | } |
| 26093 | _children = _new_children; |
| 26094 | } |
| 26095 | _children[_n++] = _res; |
| 26096 | _mark = p->mark; |
| 26097 | } |
| 26098 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26099 | 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] | 26100 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26101 | } |
| 26102 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26103 | if (!_seq) { |
| 26104 | PyMem_Free(_children); |
| 26105 | p->error_indicator = 1; |
| 26106 | PyErr_NoMemory(); |
| 26107 | D(p->level--); |
| 26108 | return NULL; |
| 26109 | } |
| 26110 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26111 | PyMem_Free(_children); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26112 | _PyPegen_insert_memo(p, _start_mark, _loop0_123_type, _seq); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26113 | D(p->level--); |
| 26114 | return _seq; |
| 26115 | } |
| 26116 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26117 | // _gather_122: (starred_expression | named_expression !'=') _loop0_123 |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26118 | static asdl_seq * |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26119 | _gather_122_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26120 | { |
| 26121 | D(p->level++); |
| 26122 | if (p->error_indicator) { |
| 26123 | D(p->level--); |
| 26124 | return NULL; |
| 26125 | } |
| 26126 | asdl_seq * _res = NULL; |
| 26127 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26128 | { // (starred_expression | named_expression !'=') _loop0_123 |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26129 | if (p->error_indicator) { |
| 26130 | D(p->level--); |
| 26131 | return NULL; |
| 26132 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26133 | D(fprintf(stderr, "%*c> _gather_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_123")); |
| 26134 | void *elem; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26135 | asdl_seq * seq; |
| 26136 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26137 | (elem = _tmp_172_rule(p)) // starred_expression | named_expression !'=' |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26138 | && |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26139 | (seq = _loop0_123_rule(p)) // _loop0_123 |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26140 | ) |
| 26141 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26142 | 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] | 26143 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 26144 | goto done; |
| 26145 | } |
| 26146 | p->mark = _mark; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26147 | 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] | 26148 | 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] | 26149 | } |
| 26150 | _res = NULL; |
| 26151 | done: |
| 26152 | D(p->level--); |
| 26153 | return _res; |
| 26154 | } |
| 26155 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26156 | // _tmp_124: ',' kwargs |
| 26157 | static void * |
| 26158 | _tmp_124_rule(Parser *p) |
| 26159 | { |
| 26160 | D(p->level++); |
| 26161 | if (p->error_indicator) { |
| 26162 | D(p->level--); |
| 26163 | return NULL; |
| 26164 | } |
| 26165 | void * _res = NULL; |
| 26166 | int _mark = p->mark; |
| 26167 | { // ',' kwargs |
| 26168 | if (p->error_indicator) { |
| 26169 | D(p->level--); |
| 26170 | return NULL; |
| 26171 | } |
| 26172 | D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); |
| 26173 | Token * _literal; |
| 26174 | asdl_seq* k; |
| 26175 | if ( |
| 26176 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26177 | && |
| 26178 | (k = kwargs_rule(p)) // kwargs |
| 26179 | ) |
| 26180 | { |
| 26181 | D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); |
| 26182 | _res = k; |
| 26183 | if (_res == NULL && PyErr_Occurred()) { |
| 26184 | p->error_indicator = 1; |
| 26185 | D(p->level--); |
| 26186 | return NULL; |
| 26187 | } |
| 26188 | goto done; |
| 26189 | } |
| 26190 | p->mark = _mark; |
| 26191 | D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', |
| 26192 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs")); |
| 26193 | } |
| 26194 | _res = NULL; |
| 26195 | done: |
| 26196 | D(p->level--); |
| 26197 | return _res; |
| 26198 | } |
| 26199 | |
| 26200 | // _loop0_126: ',' kwarg_or_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26201 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26202 | _loop0_126_rule(Parser *p) |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26203 | { |
| 26204 | D(p->level++); |
| 26205 | if (p->error_indicator) { |
| 26206 | D(p->level--); |
| 26207 | return NULL; |
| 26208 | } |
| 26209 | void *_res = NULL; |
| 26210 | int _mark = p->mark; |
| 26211 | int _start_mark = p->mark; |
| 26212 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26213 | if (!_children) { |
| 26214 | p->error_indicator = 1; |
| 26215 | PyErr_NoMemory(); |
| 26216 | D(p->level--); |
| 26217 | return NULL; |
| 26218 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26219 | Py_ssize_t _children_capacity = 1; |
| 26220 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26221 | { // ',' kwarg_or_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26222 | if (p->error_indicator) { |
| 26223 | D(p->level--); |
| 26224 | return NULL; |
| 26225 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26226 | 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] | 26227 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26228 | KeywordOrStarred* elem; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26229 | while ( |
| 26230 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26231 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26232 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26233 | ) |
| 26234 | { |
| 26235 | _res = elem; |
| 26236 | if (_res == NULL && PyErr_Occurred()) { |
| 26237 | p->error_indicator = 1; |
| 26238 | PyMem_Free(_children); |
| 26239 | D(p->level--); |
| 26240 | return NULL; |
| 26241 | } |
| 26242 | if (_n == _children_capacity) { |
| 26243 | _children_capacity *= 2; |
| 26244 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26245 | if (!_new_children) { |
| 26246 | p->error_indicator = 1; |
| 26247 | PyErr_NoMemory(); |
| 26248 | D(p->level--); |
| 26249 | return NULL; |
| 26250 | } |
| 26251 | _children = _new_children; |
| 26252 | } |
| 26253 | _children[_n++] = _res; |
| 26254 | _mark = p->mark; |
| 26255 | } |
| 26256 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26257 | D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', |
| 26258 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26259 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26260 | 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] | 26261 | if (!_seq) { |
| 26262 | PyMem_Free(_children); |
| 26263 | p->error_indicator = 1; |
| 26264 | PyErr_NoMemory(); |
| 26265 | D(p->level--); |
| 26266 | return NULL; |
| 26267 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26268 | 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] | 26269 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26270 | _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26271 | D(p->level--); |
| 26272 | return _seq; |
| 26273 | } |
| 26274 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26275 | // _gather_125: kwarg_or_starred _loop0_126 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26276 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26277 | _gather_125_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26278 | { |
| 26279 | D(p->level++); |
| 26280 | if (p->error_indicator) { |
| 26281 | D(p->level--); |
| 26282 | return NULL; |
| 26283 | } |
| 26284 | asdl_seq * _res = NULL; |
| 26285 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26286 | { // kwarg_or_starred _loop0_126 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26287 | if (p->error_indicator) { |
| 26288 | D(p->level--); |
| 26289 | return NULL; |
| 26290 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26291 | D(fprintf(stderr, "%*c> _gather_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); |
| 26292 | KeywordOrStarred* elem; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26293 | asdl_seq * seq; |
| 26294 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26295 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26296 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26297 | (seq = _loop0_126_rule(p)) // _loop0_126 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26298 | ) |
| 26299 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26300 | 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] | 26301 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 26302 | goto done; |
| 26303 | } |
| 26304 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26305 | D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ', |
| 26306 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_126")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26307 | } |
| 26308 | _res = NULL; |
| 26309 | done: |
| 26310 | D(p->level--); |
| 26311 | return _res; |
| 26312 | } |
| 26313 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26314 | // _loop0_128: ',' kwarg_or_double_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26315 | static asdl_seq * |
| 26316 | _loop0_128_rule(Parser *p) |
| 26317 | { |
| 26318 | D(p->level++); |
| 26319 | if (p->error_indicator) { |
| 26320 | D(p->level--); |
| 26321 | return NULL; |
| 26322 | } |
| 26323 | void *_res = NULL; |
| 26324 | int _mark = p->mark; |
| 26325 | int _start_mark = p->mark; |
| 26326 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26327 | if (!_children) { |
| 26328 | p->error_indicator = 1; |
| 26329 | PyErr_NoMemory(); |
| 26330 | D(p->level--); |
| 26331 | return NULL; |
| 26332 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26333 | Py_ssize_t _children_capacity = 1; |
| 26334 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26335 | { // ',' kwarg_or_double_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26336 | if (p->error_indicator) { |
| 26337 | D(p->level--); |
| 26338 | return NULL; |
| 26339 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26340 | D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); |
| 26341 | Token * _literal; |
| 26342 | KeywordOrStarred* elem; |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26343 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26344 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26345 | && |
| 26346 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26347 | ) |
| 26348 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26349 | _res = elem; |
| 26350 | if (_res == NULL && PyErr_Occurred()) { |
| 26351 | p->error_indicator = 1; |
| 26352 | PyMem_Free(_children); |
| 26353 | D(p->level--); |
| 26354 | return NULL; |
| 26355 | } |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26356 | if (_n == _children_capacity) { |
| 26357 | _children_capacity *= 2; |
| 26358 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26359 | if (!_new_children) { |
| 26360 | p->error_indicator = 1; |
| 26361 | PyErr_NoMemory(); |
| 26362 | D(p->level--); |
| 26363 | return NULL; |
| 26364 | } |
| 26365 | _children = _new_children; |
| 26366 | } |
| 26367 | _children[_n++] = _res; |
| 26368 | _mark = p->mark; |
| 26369 | } |
| 26370 | p->mark = _mark; |
| 26371 | 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] | 26372 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 26373 | } |
| 26374 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26375 | if (!_seq) { |
| 26376 | PyMem_Free(_children); |
| 26377 | p->error_indicator = 1; |
| 26378 | PyErr_NoMemory(); |
| 26379 | D(p->level--); |
| 26380 | return NULL; |
| 26381 | } |
| 26382 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26383 | PyMem_Free(_children); |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 26384 | _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26385 | D(p->level--); |
Lysandros Nikolaou | 4b85e60 | 2020-06-26 02:22:36 +0300 | [diff] [blame] | 26386 | return _seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26387 | } |
| 26388 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26389 | // _gather_127: kwarg_or_double_starred _loop0_128 |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26390 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26391 | _gather_127_rule(Parser *p) |
| 26392 | { |
| 26393 | D(p->level++); |
| 26394 | if (p->error_indicator) { |
| 26395 | D(p->level--); |
| 26396 | return NULL; |
| 26397 | } |
| 26398 | asdl_seq * _res = NULL; |
| 26399 | int _mark = p->mark; |
| 26400 | { // kwarg_or_double_starred _loop0_128 |
| 26401 | if (p->error_indicator) { |
| 26402 | D(p->level--); |
| 26403 | return NULL; |
| 26404 | } |
| 26405 | D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); |
| 26406 | KeywordOrStarred* elem; |
| 26407 | asdl_seq * seq; |
| 26408 | if ( |
| 26409 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
| 26410 | && |
| 26411 | (seq = _loop0_128_rule(p)) // _loop0_128 |
| 26412 | ) |
| 26413 | { |
| 26414 | D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); |
| 26415 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 26416 | goto done; |
| 26417 | } |
| 26418 | p->mark = _mark; |
| 26419 | D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', |
| 26420 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_128")); |
| 26421 | } |
| 26422 | _res = NULL; |
| 26423 | done: |
| 26424 | D(p->level--); |
| 26425 | return _res; |
| 26426 | } |
| 26427 | |
| 26428 | // _loop0_130: ',' kwarg_or_starred |
| 26429 | static asdl_seq * |
| 26430 | _loop0_130_rule(Parser *p) |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26431 | { |
| 26432 | D(p->level++); |
| 26433 | if (p->error_indicator) { |
| 26434 | D(p->level--); |
| 26435 | return NULL; |
| 26436 | } |
| 26437 | void *_res = NULL; |
| 26438 | int _mark = p->mark; |
| 26439 | int _start_mark = p->mark; |
| 26440 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26441 | if (!_children) { |
| 26442 | p->error_indicator = 1; |
| 26443 | PyErr_NoMemory(); |
| 26444 | D(p->level--); |
| 26445 | return NULL; |
| 26446 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26447 | Py_ssize_t _children_capacity = 1; |
| 26448 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26449 | { // ',' kwarg_or_starred |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26450 | if (p->error_indicator) { |
| 26451 | D(p->level--); |
| 26452 | return NULL; |
| 26453 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26454 | D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); |
| 26455 | Token * _literal; |
| 26456 | KeywordOrStarred* elem; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26457 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26458 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26459 | && |
| 26460 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26461 | ) |
| 26462 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26463 | _res = elem; |
| 26464 | if (_res == NULL && PyErr_Occurred()) { |
| 26465 | p->error_indicator = 1; |
| 26466 | PyMem_Free(_children); |
| 26467 | D(p->level--); |
| 26468 | return NULL; |
| 26469 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26470 | if (_n == _children_capacity) { |
| 26471 | _children_capacity *= 2; |
| 26472 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26473 | if (!_new_children) { |
| 26474 | p->error_indicator = 1; |
| 26475 | PyErr_NoMemory(); |
| 26476 | D(p->level--); |
| 26477 | return NULL; |
| 26478 | } |
| 26479 | _children = _new_children; |
| 26480 | } |
| 26481 | _children[_n++] = _res; |
| 26482 | _mark = p->mark; |
| 26483 | } |
| 26484 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26485 | D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', |
| 26486 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26487 | } |
| 26488 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26489 | if (!_seq) { |
| 26490 | PyMem_Free(_children); |
| 26491 | p->error_indicator = 1; |
| 26492 | PyErr_NoMemory(); |
| 26493 | D(p->level--); |
| 26494 | return NULL; |
| 26495 | } |
| 26496 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26497 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26498 | _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 26499 | D(p->level--); |
| 26500 | return _seq; |
| 26501 | } |
| 26502 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26503 | // _gather_129: kwarg_or_starred _loop0_130 |
| 26504 | static asdl_seq * |
| 26505 | _gather_129_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26506 | { |
| 26507 | D(p->level++); |
| 26508 | if (p->error_indicator) { |
| 26509 | D(p->level--); |
| 26510 | return NULL; |
| 26511 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26512 | asdl_seq * _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26513 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26514 | { // kwarg_or_starred _loop0_130 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26515 | if (p->error_indicator) { |
| 26516 | D(p->level--); |
| 26517 | return NULL; |
| 26518 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26519 | D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); |
| 26520 | KeywordOrStarred* elem; |
| 26521 | asdl_seq * seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26522 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26523 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
| 26524 | && |
| 26525 | (seq = _loop0_130_rule(p)) // _loop0_130 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26526 | ) |
| 26527 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26528 | D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); |
| 26529 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26530 | goto done; |
| 26531 | } |
| 26532 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26533 | D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', |
| 26534 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_130")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26535 | } |
| 26536 | _res = NULL; |
| 26537 | done: |
| 26538 | D(p->level--); |
| 26539 | return _res; |
| 26540 | } |
| 26541 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26542 | // _loop0_132: ',' kwarg_or_double_starred |
| 26543 | static asdl_seq * |
| 26544 | _loop0_132_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26545 | { |
| 26546 | D(p->level++); |
| 26547 | if (p->error_indicator) { |
| 26548 | D(p->level--); |
| 26549 | return NULL; |
| 26550 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26551 | void *_res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26552 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26553 | int _start_mark = p->mark; |
| 26554 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26555 | if (!_children) { |
| 26556 | p->error_indicator = 1; |
| 26557 | PyErr_NoMemory(); |
| 26558 | D(p->level--); |
| 26559 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26560 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26561 | Py_ssize_t _children_capacity = 1; |
| 26562 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26563 | { // ',' kwarg_or_double_starred |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26564 | if (p->error_indicator) { |
| 26565 | D(p->level--); |
| 26566 | return NULL; |
| 26567 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26568 | 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] | 26569 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26570 | KeywordOrStarred* elem; |
| 26571 | while ( |
| 26572 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26573 | && |
| 26574 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26575 | ) |
| 26576 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26577 | _res = elem; |
| 26578 | if (_res == NULL && PyErr_Occurred()) { |
| 26579 | p->error_indicator = 1; |
| 26580 | PyMem_Free(_children); |
| 26581 | D(p->level--); |
| 26582 | return NULL; |
| 26583 | } |
| 26584 | if (_n == _children_capacity) { |
| 26585 | _children_capacity *= 2; |
| 26586 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26587 | if (!_new_children) { |
| 26588 | p->error_indicator = 1; |
| 26589 | PyErr_NoMemory(); |
| 26590 | D(p->level--); |
| 26591 | return NULL; |
| 26592 | } |
| 26593 | _children = _new_children; |
| 26594 | } |
| 26595 | _children[_n++] = _res; |
| 26596 | _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26597 | } |
| 26598 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26599 | D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', |
| 26600 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26601 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26602 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26603 | if (!_seq) { |
| 26604 | PyMem_Free(_children); |
| 26605 | p->error_indicator = 1; |
| 26606 | PyErr_NoMemory(); |
| 26607 | D(p->level--); |
| 26608 | return NULL; |
| 26609 | } |
| 26610 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26611 | PyMem_Free(_children); |
| 26612 | _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); |
| 26613 | D(p->level--); |
| 26614 | return _seq; |
| 26615 | } |
| 26616 | |
| 26617 | // _gather_131: kwarg_or_double_starred _loop0_132 |
| 26618 | static asdl_seq * |
| 26619 | _gather_131_rule(Parser *p) |
| 26620 | { |
| 26621 | D(p->level++); |
| 26622 | if (p->error_indicator) { |
| 26623 | D(p->level--); |
| 26624 | return NULL; |
| 26625 | } |
| 26626 | asdl_seq * _res = NULL; |
| 26627 | int _mark = p->mark; |
| 26628 | { // kwarg_or_double_starred _loop0_132 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26629 | if (p->error_indicator) { |
| 26630 | D(p->level--); |
| 26631 | return NULL; |
| 26632 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26633 | D(fprintf(stderr, "%*c> _gather_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); |
| 26634 | KeywordOrStarred* elem; |
| 26635 | asdl_seq * seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26636 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26637 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
| 26638 | && |
| 26639 | (seq = _loop0_132_rule(p)) // _loop0_132 |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26640 | ) |
| 26641 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26642 | D(fprintf(stderr, "%*c+ _gather_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); |
| 26643 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26644 | goto done; |
| 26645 | } |
| 26646 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26647 | D(fprintf(stderr, "%*c%s _gather_131[%d-%d]: %s failed!\n", p->level, ' ', |
| 26648 | 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] | 26649 | } |
| 26650 | _res = NULL; |
| 26651 | done: |
| 26652 | D(p->level--); |
| 26653 | return _res; |
| 26654 | } |
| 26655 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26656 | // _loop0_133: (',' star_target) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26657 | static asdl_seq * |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26658 | _loop0_133_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26659 | { |
| 26660 | D(p->level++); |
| 26661 | if (p->error_indicator) { |
| 26662 | D(p->level--); |
| 26663 | return NULL; |
| 26664 | } |
| 26665 | void *_res = NULL; |
| 26666 | int _mark = p->mark; |
| 26667 | int _start_mark = p->mark; |
| 26668 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26669 | if (!_children) { |
| 26670 | p->error_indicator = 1; |
| 26671 | PyErr_NoMemory(); |
| 26672 | D(p->level--); |
| 26673 | return NULL; |
| 26674 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26675 | Py_ssize_t _children_capacity = 1; |
| 26676 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26677 | { // (',' star_target) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26678 | if (p->error_indicator) { |
| 26679 | D(p->level--); |
| 26680 | return NULL; |
| 26681 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26682 | D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); |
| 26683 | void *_tmp_173_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26684 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26685 | (_tmp_173_var = _tmp_173_rule(p)) // ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26686 | ) |
| 26687 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26688 | _res = _tmp_173_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26689 | if (_n == _children_capacity) { |
| 26690 | _children_capacity *= 2; |
| 26691 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26692 | if (!_new_children) { |
| 26693 | p->error_indicator = 1; |
| 26694 | PyErr_NoMemory(); |
| 26695 | D(p->level--); |
| 26696 | return NULL; |
| 26697 | } |
| 26698 | _children = _new_children; |
| 26699 | } |
| 26700 | _children[_n++] = _res; |
| 26701 | _mark = p->mark; |
| 26702 | } |
| 26703 | p->mark = _mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26704 | 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] | 26705 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26706 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26707 | 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] | 26708 | if (!_seq) { |
| 26709 | PyMem_Free(_children); |
| 26710 | p->error_indicator = 1; |
| 26711 | PyErr_NoMemory(); |
| 26712 | D(p->level--); |
| 26713 | return NULL; |
| 26714 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26715 | 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] | 26716 | PyMem_Free(_children); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26717 | _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26718 | D(p->level--); |
| 26719 | return _seq; |
| 26720 | } |
| 26721 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26722 | // _loop0_135: ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26723 | static asdl_seq * |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26724 | _loop0_135_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26725 | { |
| 26726 | D(p->level++); |
| 26727 | if (p->error_indicator) { |
| 26728 | D(p->level--); |
| 26729 | return NULL; |
| 26730 | } |
| 26731 | void *_res = NULL; |
| 26732 | int _mark = p->mark; |
| 26733 | int _start_mark = p->mark; |
| 26734 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26735 | if (!_children) { |
| 26736 | p->error_indicator = 1; |
| 26737 | PyErr_NoMemory(); |
| 26738 | D(p->level--); |
| 26739 | return NULL; |
| 26740 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26741 | Py_ssize_t _children_capacity = 1; |
| 26742 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26743 | { // ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26744 | if (p->error_indicator) { |
| 26745 | D(p->level--); |
| 26746 | return NULL; |
| 26747 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26748 | D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
| 26749 | Token * _literal; |
| 26750 | expr_ty elem; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26751 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26752 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26753 | && |
| 26754 | (elem = star_target_rule(p)) // star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26755 | ) |
| 26756 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26757 | _res = elem; |
| 26758 | if (_res == NULL && PyErr_Occurred()) { |
| 26759 | p->error_indicator = 1; |
| 26760 | PyMem_Free(_children); |
| 26761 | D(p->level--); |
| 26762 | return NULL; |
| 26763 | } |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26764 | if (_n == _children_capacity) { |
| 26765 | _children_capacity *= 2; |
| 26766 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26767 | if (!_new_children) { |
| 26768 | p->error_indicator = 1; |
| 26769 | PyErr_NoMemory(); |
| 26770 | D(p->level--); |
| 26771 | return NULL; |
| 26772 | } |
| 26773 | _children = _new_children; |
| 26774 | } |
| 26775 | _children[_n++] = _res; |
| 26776 | _mark = p->mark; |
| 26777 | } |
| 26778 | p->mark = _mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26779 | 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] | 26780 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26781 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26782 | 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] | 26783 | if (!_seq) { |
| 26784 | PyMem_Free(_children); |
| 26785 | p->error_indicator = 1; |
| 26786 | PyErr_NoMemory(); |
| 26787 | D(p->level--); |
| 26788 | return NULL; |
| 26789 | } |
Pablo Galindo | a5634c4 | 2020-09-16 19:42:00 +0100 | [diff] [blame] | 26790 | 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] | 26791 | PyMem_Free(_children); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26792 | _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26793 | D(p->level--); |
| 26794 | return _seq; |
| 26795 | } |
| 26796 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26797 | // _gather_134: star_target _loop0_135 |
| 26798 | static asdl_seq * |
| 26799 | _gather_134_rule(Parser *p) |
| 26800 | { |
| 26801 | D(p->level++); |
| 26802 | if (p->error_indicator) { |
| 26803 | D(p->level--); |
| 26804 | return NULL; |
| 26805 | } |
| 26806 | asdl_seq * _res = NULL; |
| 26807 | int _mark = p->mark; |
| 26808 | { // star_target _loop0_135 |
| 26809 | if (p->error_indicator) { |
| 26810 | D(p->level--); |
| 26811 | return NULL; |
| 26812 | } |
| 26813 | D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); |
| 26814 | expr_ty elem; |
| 26815 | asdl_seq * seq; |
| 26816 | if ( |
| 26817 | (elem = star_target_rule(p)) // star_target |
| 26818 | && |
| 26819 | (seq = _loop0_135_rule(p)) // _loop0_135 |
| 26820 | ) |
| 26821 | { |
| 26822 | D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); |
| 26823 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 26824 | goto done; |
| 26825 | } |
| 26826 | p->mark = _mark; |
| 26827 | D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', |
| 26828 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_135")); |
| 26829 | } |
| 26830 | _res = NULL; |
| 26831 | done: |
| 26832 | D(p->level--); |
| 26833 | return _res; |
| 26834 | } |
| 26835 | |
| 26836 | // _loop1_136: (',' star_target) |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26837 | static asdl_seq * |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26838 | _loop1_136_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26839 | { |
| 26840 | D(p->level++); |
| 26841 | if (p->error_indicator) { |
| 26842 | D(p->level--); |
| 26843 | return NULL; |
| 26844 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26845 | void *_res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26846 | int _mark = p->mark; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26847 | int _start_mark = p->mark; |
| 26848 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26849 | if (!_children) { |
| 26850 | p->error_indicator = 1; |
| 26851 | PyErr_NoMemory(); |
| 26852 | D(p->level--); |
| 26853 | return NULL; |
| 26854 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26855 | Py_ssize_t _children_capacity = 1; |
| 26856 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26857 | { // (',' star_target) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26858 | if (p->error_indicator) { |
| 26859 | D(p->level--); |
| 26860 | return NULL; |
| 26861 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26862 | D(fprintf(stderr, "%*c> _loop1_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); |
| 26863 | void *_tmp_174_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26864 | while ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26865 | (_tmp_174_var = _tmp_174_rule(p)) // ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26866 | ) |
| 26867 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26868 | _res = _tmp_174_var; |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26869 | if (_n == _children_capacity) { |
| 26870 | _children_capacity *= 2; |
| 26871 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26872 | if (!_new_children) { |
| 26873 | p->error_indicator = 1; |
| 26874 | PyErr_NoMemory(); |
| 26875 | D(p->level--); |
| 26876 | return NULL; |
| 26877 | } |
| 26878 | _children = _new_children; |
| 26879 | } |
| 26880 | _children[_n++] = _res; |
| 26881 | _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26882 | } |
| 26883 | p->mark = _mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26884 | 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] | 26885 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26886 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26887 | if (_n == 0 || p->error_indicator) { |
| 26888 | PyMem_Free(_children); |
| 26889 | D(p->level--); |
| 26890 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26891 | } |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26892 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 26893 | if (!_seq) { |
| 26894 | PyMem_Free(_children); |
| 26895 | p->error_indicator = 1; |
| 26896 | PyErr_NoMemory(); |
| 26897 | D(p->level--); |
| 26898 | return NULL; |
| 26899 | } |
| 26900 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 26901 | PyMem_Free(_children); |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26902 | _PyPegen_insert_memo(p, _start_mark, _loop1_136_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26903 | D(p->level--); |
Lysandros Nikolaou | 07dcd86 | 2021-01-08 00:31:25 +0200 | [diff] [blame] | 26904 | return _seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26905 | } |
| 26906 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26907 | // _tmp_137: !'*' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26908 | static void * |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26909 | _tmp_137_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26910 | { |
| 26911 | D(p->level++); |
| 26912 | if (p->error_indicator) { |
| 26913 | D(p->level--); |
| 26914 | return NULL; |
| 26915 | } |
| 26916 | void * _res = NULL; |
| 26917 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26918 | { // !'*' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26919 | if (p->error_indicator) { |
| 26920 | D(p->level--); |
| 26921 | return NULL; |
| 26922 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26923 | D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); |
| 26924 | expr_ty star_target_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26925 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26926 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26927 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26928 | (star_target_var = star_target_rule(p)) // star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26929 | ) |
| 26930 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26931 | D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); |
| 26932 | _res = star_target_var; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26933 | goto done; |
| 26934 | } |
| 26935 | p->mark = _mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 26936 | 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] | 26937 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26938 | } |
| 26939 | _res = NULL; |
| 26940 | done: |
| 26941 | D(p->level--); |
| 26942 | return _res; |
| 26943 | } |
| 26944 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26945 | // _loop0_139: ',' del_target |
| 26946 | static asdl_seq * |
| 26947 | _loop0_139_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26948 | { |
| 26949 | D(p->level++); |
| 26950 | if (p->error_indicator) { |
| 26951 | D(p->level--); |
| 26952 | return NULL; |
| 26953 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26954 | void *_res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26955 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26956 | int _start_mark = p->mark; |
| 26957 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 26958 | if (!_children) { |
| 26959 | p->error_indicator = 1; |
| 26960 | PyErr_NoMemory(); |
| 26961 | D(p->level--); |
| 26962 | return NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26963 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 26964 | Py_ssize_t _children_capacity = 1; |
| 26965 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26966 | { // ',' del_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26967 | if (p->error_indicator) { |
| 26968 | D(p->level--); |
| 26969 | return NULL; |
| 26970 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26971 | 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] | 26972 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26973 | expr_ty elem; |
| 26974 | while ( |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26975 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 26976 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26977 | (elem = del_target_rule(p)) // del_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 26978 | ) |
| 26979 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 26980 | _res = elem; |
| 26981 | if (_res == NULL && PyErr_Occurred()) { |
| 26982 | p->error_indicator = 1; |
| 26983 | PyMem_Free(_children); |
| 26984 | D(p->level--); |
| 26985 | return NULL; |
| 26986 | } |
| 26987 | if (_n == _children_capacity) { |
| 26988 | _children_capacity *= 2; |
| 26989 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 26990 | if (!_new_children) { |
| 26991 | p->error_indicator = 1; |
| 26992 | PyErr_NoMemory(); |
| 26993 | D(p->level--); |
| 26994 | return NULL; |
| 26995 | } |
| 26996 | _children = _new_children; |
| 26997 | } |
| 26998 | _children[_n++] = _res; |
| 26999 | _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27000 | } |
| 27001 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27002 | D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', |
| 27003 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27004 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27005 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27006 | if (!_seq) { |
| 27007 | PyMem_Free(_children); |
| 27008 | p->error_indicator = 1; |
| 27009 | PyErr_NoMemory(); |
| 27010 | D(p->level--); |
| 27011 | return NULL; |
| 27012 | } |
| 27013 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27014 | PyMem_Free(_children); |
| 27015 | _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27016 | D(p->level--); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27017 | return _seq; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27018 | } |
| 27019 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27020 | // _gather_138: del_target _loop0_139 |
| 27021 | static asdl_seq * |
| 27022 | _gather_138_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27023 | { |
| 27024 | D(p->level++); |
| 27025 | if (p->error_indicator) { |
| 27026 | D(p->level--); |
| 27027 | return NULL; |
| 27028 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27029 | asdl_seq * _res = NULL; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 27030 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27031 | { // del_target _loop0_139 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27032 | if (p->error_indicator) { |
| 27033 | D(p->level--); |
| 27034 | return NULL; |
| 27035 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27036 | D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_139")); |
| 27037 | expr_ty elem; |
| 27038 | asdl_seq * seq; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27039 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27040 | (elem = del_target_rule(p)) // del_target |
| 27041 | && |
| 27042 | (seq = _loop0_139_rule(p)) // _loop0_139 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27043 | ) |
| 27044 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27045 | D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_139")); |
| 27046 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27047 | goto done; |
| 27048 | } |
| 27049 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27050 | D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', |
| 27051 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_139")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27052 | } |
| 27053 | _res = NULL; |
| 27054 | done: |
| 27055 | D(p->level--); |
| 27056 | return _res; |
| 27057 | } |
| 27058 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27059 | // _loop0_141: ',' target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27060 | static asdl_seq * |
| 27061 | _loop0_141_rule(Parser *p) |
| 27062 | { |
| 27063 | D(p->level++); |
| 27064 | if (p->error_indicator) { |
| 27065 | D(p->level--); |
| 27066 | return NULL; |
| 27067 | } |
| 27068 | void *_res = NULL; |
| 27069 | int _mark = p->mark; |
| 27070 | int _start_mark = p->mark; |
| 27071 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27072 | if (!_children) { |
| 27073 | p->error_indicator = 1; |
| 27074 | PyErr_NoMemory(); |
| 27075 | D(p->level--); |
| 27076 | return NULL; |
| 27077 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27078 | Py_ssize_t _children_capacity = 1; |
| 27079 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27080 | { // ',' target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27081 | if (p->error_indicator) { |
| 27082 | D(p->level--); |
| 27083 | return NULL; |
| 27084 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27085 | 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] | 27086 | Token * _literal; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27087 | expr_ty elem; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27088 | while ( |
| 27089 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 27090 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27091 | (elem = target_rule(p)) // target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27092 | ) |
| 27093 | { |
| 27094 | _res = elem; |
| 27095 | if (_res == NULL && PyErr_Occurred()) { |
| 27096 | p->error_indicator = 1; |
| 27097 | PyMem_Free(_children); |
| 27098 | D(p->level--); |
| 27099 | return NULL; |
| 27100 | } |
| 27101 | if (_n == _children_capacity) { |
| 27102 | _children_capacity *= 2; |
| 27103 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27104 | if (!_new_children) { |
| 27105 | p->error_indicator = 1; |
| 27106 | PyErr_NoMemory(); |
| 27107 | D(p->level--); |
| 27108 | return NULL; |
| 27109 | } |
| 27110 | _children = _new_children; |
| 27111 | } |
| 27112 | _children[_n++] = _res; |
| 27113 | _mark = p->mark; |
| 27114 | } |
| 27115 | p->mark = _mark; |
| 27116 | 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] | 27117 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27118 | } |
| 27119 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27120 | if (!_seq) { |
| 27121 | PyMem_Free(_children); |
| 27122 | p->error_indicator = 1; |
| 27123 | PyErr_NoMemory(); |
| 27124 | D(p->level--); |
| 27125 | return NULL; |
| 27126 | } |
| 27127 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27128 | PyMem_Free(_children); |
| 27129 | _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); |
| 27130 | D(p->level--); |
| 27131 | return _seq; |
| 27132 | } |
| 27133 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27134 | // _gather_140: target _loop0_141 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27135 | static asdl_seq * |
| 27136 | _gather_140_rule(Parser *p) |
| 27137 | { |
| 27138 | D(p->level++); |
| 27139 | if (p->error_indicator) { |
| 27140 | D(p->level--); |
| 27141 | return NULL; |
| 27142 | } |
| 27143 | asdl_seq * _res = NULL; |
| 27144 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27145 | { // target _loop0_141 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27146 | if (p->error_indicator) { |
| 27147 | D(p->level--); |
| 27148 | return NULL; |
| 27149 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27150 | D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_141")); |
| 27151 | expr_ty elem; |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27152 | asdl_seq * seq; |
| 27153 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27154 | (elem = target_rule(p)) // target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27155 | && |
| 27156 | (seq = _loop0_141_rule(p)) // _loop0_141 |
| 27157 | ) |
| 27158 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27159 | 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] | 27160 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 27161 | goto done; |
| 27162 | } |
| 27163 | p->mark = _mark; |
| 27164 | 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] | 27165 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_141")); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27166 | } |
| 27167 | _res = NULL; |
| 27168 | done: |
| 27169 | D(p->level--); |
| 27170 | return _res; |
| 27171 | } |
| 27172 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27173 | // _tmp_142: args | expression for_if_clauses |
| 27174 | static void * |
| 27175 | _tmp_142_rule(Parser *p) |
| 27176 | { |
| 27177 | D(p->level++); |
| 27178 | if (p->error_indicator) { |
| 27179 | D(p->level--); |
| 27180 | return NULL; |
| 27181 | } |
| 27182 | void * _res = NULL; |
| 27183 | int _mark = p->mark; |
| 27184 | { // args |
| 27185 | if (p->error_indicator) { |
| 27186 | D(p->level--); |
| 27187 | return NULL; |
| 27188 | } |
| 27189 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); |
| 27190 | expr_ty args_var; |
| 27191 | if ( |
| 27192 | (args_var = args_rule(p)) // args |
| 27193 | ) |
| 27194 | { |
| 27195 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); |
| 27196 | _res = args_var; |
| 27197 | goto done; |
| 27198 | } |
| 27199 | p->mark = _mark; |
| 27200 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', |
| 27201 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); |
| 27202 | } |
| 27203 | { // expression for_if_clauses |
| 27204 | if (p->error_indicator) { |
| 27205 | D(p->level--); |
| 27206 | return NULL; |
| 27207 | } |
| 27208 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); |
| 27209 | expr_ty expression_var; |
| 27210 | asdl_comprehension_seq* for_if_clauses_var; |
| 27211 | if ( |
| 27212 | (expression_var = expression_rule(p)) // expression |
| 27213 | && |
| 27214 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 27215 | ) |
| 27216 | { |
| 27217 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); |
| 27218 | _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); |
| 27219 | goto done; |
| 27220 | } |
| 27221 | p->mark = _mark; |
| 27222 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', |
| 27223 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); |
| 27224 | } |
| 27225 | _res = NULL; |
| 27226 | done: |
| 27227 | D(p->level--); |
| 27228 | return _res; |
| 27229 | } |
| 27230 | |
| 27231 | // _loop0_143: star_named_expressions |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27232 | static asdl_seq * |
| 27233 | _loop0_143_rule(Parser *p) |
| 27234 | { |
| 27235 | D(p->level++); |
| 27236 | if (p->error_indicator) { |
| 27237 | D(p->level--); |
| 27238 | return NULL; |
| 27239 | } |
| 27240 | void *_res = NULL; |
| 27241 | int _mark = p->mark; |
| 27242 | int _start_mark = p->mark; |
| 27243 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27244 | if (!_children) { |
| 27245 | p->error_indicator = 1; |
| 27246 | PyErr_NoMemory(); |
| 27247 | D(p->level--); |
| 27248 | return NULL; |
| 27249 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27250 | Py_ssize_t _children_capacity = 1; |
| 27251 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27252 | { // star_named_expressions |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 27253 | if (p->error_indicator) { |
| 27254 | D(p->level--); |
| 27255 | return NULL; |
| 27256 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27257 | D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); |
| 27258 | asdl_expr_seq* star_named_expressions_var; |
| 27259 | while ( |
| 27260 | (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions |
| 27261 | ) |
| 27262 | { |
| 27263 | _res = star_named_expressions_var; |
| 27264 | if (_n == _children_capacity) { |
| 27265 | _children_capacity *= 2; |
| 27266 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27267 | if (!_new_children) { |
| 27268 | p->error_indicator = 1; |
| 27269 | PyErr_NoMemory(); |
| 27270 | D(p->level--); |
| 27271 | return NULL; |
| 27272 | } |
| 27273 | _children = _new_children; |
| 27274 | } |
| 27275 | _children[_n++] = _res; |
| 27276 | _mark = p->mark; |
| 27277 | } |
| 27278 | p->mark = _mark; |
| 27279 | D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', |
| 27280 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); |
| 27281 | } |
| 27282 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27283 | if (!_seq) { |
| 27284 | PyMem_Free(_children); |
| 27285 | p->error_indicator = 1; |
| 27286 | PyErr_NoMemory(); |
| 27287 | D(p->level--); |
| 27288 | return NULL; |
| 27289 | } |
| 27290 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27291 | PyMem_Free(_children); |
| 27292 | _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); |
| 27293 | D(p->level--); |
| 27294 | return _seq; |
| 27295 | } |
| 27296 | |
| 27297 | // _loop0_144: (star_targets '=') |
| 27298 | static asdl_seq * |
| 27299 | _loop0_144_rule(Parser *p) |
| 27300 | { |
| 27301 | D(p->level++); |
| 27302 | if (p->error_indicator) { |
| 27303 | D(p->level--); |
| 27304 | return NULL; |
| 27305 | } |
| 27306 | void *_res = NULL; |
| 27307 | int _mark = p->mark; |
| 27308 | int _start_mark = p->mark; |
| 27309 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27310 | if (!_children) { |
| 27311 | p->error_indicator = 1; |
| 27312 | PyErr_NoMemory(); |
| 27313 | D(p->level--); |
| 27314 | return NULL; |
| 27315 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27316 | Py_ssize_t _children_capacity = 1; |
| 27317 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27318 | { // (star_targets '=') |
| 27319 | if (p->error_indicator) { |
| 27320 | D(p->level--); |
| 27321 | return NULL; |
| 27322 | } |
| 27323 | D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
| 27324 | void *_tmp_175_var; |
| 27325 | while ( |
| 27326 | (_tmp_175_var = _tmp_175_rule(p)) // star_targets '=' |
| 27327 | ) |
| 27328 | { |
| 27329 | _res = _tmp_175_var; |
| 27330 | if (_n == _children_capacity) { |
| 27331 | _children_capacity *= 2; |
| 27332 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27333 | if (!_new_children) { |
| 27334 | p->error_indicator = 1; |
| 27335 | PyErr_NoMemory(); |
| 27336 | D(p->level--); |
| 27337 | return NULL; |
| 27338 | } |
| 27339 | _children = _new_children; |
| 27340 | } |
| 27341 | _children[_n++] = _res; |
| 27342 | _mark = p->mark; |
| 27343 | } |
| 27344 | p->mark = _mark; |
| 27345 | D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', |
| 27346 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
| 27347 | } |
| 27348 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27349 | if (!_seq) { |
| 27350 | PyMem_Free(_children); |
| 27351 | p->error_indicator = 1; |
| 27352 | PyErr_NoMemory(); |
| 27353 | D(p->level--); |
| 27354 | return NULL; |
| 27355 | } |
| 27356 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27357 | PyMem_Free(_children); |
| 27358 | _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); |
| 27359 | D(p->level--); |
| 27360 | return _seq; |
| 27361 | } |
| 27362 | |
| 27363 | // _loop0_145: (star_targets '=') |
| 27364 | static asdl_seq * |
| 27365 | _loop0_145_rule(Parser *p) |
| 27366 | { |
| 27367 | D(p->level++); |
| 27368 | if (p->error_indicator) { |
| 27369 | D(p->level--); |
| 27370 | return NULL; |
| 27371 | } |
| 27372 | void *_res = NULL; |
| 27373 | int _mark = p->mark; |
| 27374 | int _start_mark = p->mark; |
| 27375 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27376 | if (!_children) { |
| 27377 | p->error_indicator = 1; |
| 27378 | PyErr_NoMemory(); |
| 27379 | D(p->level--); |
| 27380 | return NULL; |
| 27381 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27382 | Py_ssize_t _children_capacity = 1; |
| 27383 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27384 | { // (star_targets '=') |
| 27385 | if (p->error_indicator) { |
| 27386 | D(p->level--); |
| 27387 | return NULL; |
| 27388 | } |
| 27389 | D(fprintf(stderr, "%*c> _loop0_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
| 27390 | void *_tmp_176_var; |
| 27391 | while ( |
| 27392 | (_tmp_176_var = _tmp_176_rule(p)) // star_targets '=' |
| 27393 | ) |
| 27394 | { |
| 27395 | _res = _tmp_176_var; |
| 27396 | if (_n == _children_capacity) { |
| 27397 | _children_capacity *= 2; |
| 27398 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27399 | if (!_new_children) { |
| 27400 | p->error_indicator = 1; |
| 27401 | PyErr_NoMemory(); |
| 27402 | D(p->level--); |
| 27403 | return NULL; |
| 27404 | } |
| 27405 | _children = _new_children; |
| 27406 | } |
| 27407 | _children[_n++] = _res; |
| 27408 | _mark = p->mark; |
| 27409 | } |
| 27410 | p->mark = _mark; |
| 27411 | D(fprintf(stderr, "%*c%s _loop0_145[%d-%d]: %s failed!\n", p->level, ' ', |
| 27412 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
| 27413 | } |
| 27414 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27415 | if (!_seq) { |
| 27416 | PyMem_Free(_children); |
| 27417 | p->error_indicator = 1; |
| 27418 | PyErr_NoMemory(); |
| 27419 | D(p->level--); |
| 27420 | return NULL; |
| 27421 | } |
| 27422 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27423 | PyMem_Free(_children); |
| 27424 | _PyPegen_insert_memo(p, _start_mark, _loop0_145_type, _seq); |
| 27425 | D(p->level--); |
| 27426 | return _seq; |
| 27427 | } |
| 27428 | |
| 27429 | // _tmp_146: yield_expr | star_expressions |
| 27430 | static void * |
| 27431 | _tmp_146_rule(Parser *p) |
| 27432 | { |
| 27433 | D(p->level++); |
| 27434 | if (p->error_indicator) { |
| 27435 | D(p->level--); |
| 27436 | return NULL; |
| 27437 | } |
| 27438 | void * _res = NULL; |
| 27439 | int _mark = p->mark; |
| 27440 | { // yield_expr |
| 27441 | if (p->error_indicator) { |
| 27442 | D(p->level--); |
| 27443 | return NULL; |
| 27444 | } |
| 27445 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 27446 | expr_ty yield_expr_var; |
| 27447 | if ( |
| 27448 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 27449 | ) |
| 27450 | { |
| 27451 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 27452 | _res = yield_expr_var; |
| 27453 | goto done; |
| 27454 | } |
| 27455 | p->mark = _mark; |
| 27456 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', |
| 27457 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 27458 | } |
| 27459 | { // star_expressions |
| 27460 | if (p->error_indicator) { |
| 27461 | D(p->level--); |
| 27462 | return NULL; |
| 27463 | } |
| 27464 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 27465 | expr_ty star_expressions_var; |
| 27466 | if ( |
| 27467 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 27468 | ) |
| 27469 | { |
| 27470 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 27471 | _res = star_expressions_var; |
| 27472 | goto done; |
| 27473 | } |
| 27474 | p->mark = _mark; |
| 27475 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', |
| 27476 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 27477 | } |
| 27478 | _res = NULL; |
| 27479 | done: |
| 27480 | D(p->level--); |
| 27481 | return _res; |
| 27482 | } |
| 27483 | |
| 27484 | // _tmp_147: '[' | '(' | '{' |
| 27485 | static void * |
| 27486 | _tmp_147_rule(Parser *p) |
| 27487 | { |
| 27488 | D(p->level++); |
| 27489 | if (p->error_indicator) { |
| 27490 | D(p->level--); |
| 27491 | return NULL; |
| 27492 | } |
| 27493 | void * _res = NULL; |
| 27494 | int _mark = p->mark; |
| 27495 | { // '[' |
| 27496 | if (p->error_indicator) { |
| 27497 | D(p->level--); |
| 27498 | return NULL; |
| 27499 | } |
| 27500 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
| 27501 | Token * _literal; |
| 27502 | if ( |
| 27503 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 27504 | ) |
| 27505 | { |
| 27506 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
| 27507 | _res = _literal; |
| 27508 | goto done; |
| 27509 | } |
| 27510 | p->mark = _mark; |
| 27511 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 27512 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
| 27513 | } |
| 27514 | { // '(' |
| 27515 | if (p->error_indicator) { |
| 27516 | D(p->level--); |
| 27517 | return NULL; |
| 27518 | } |
| 27519 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
| 27520 | Token * _literal; |
| 27521 | if ( |
| 27522 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
| 27523 | ) |
| 27524 | { |
| 27525 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
| 27526 | _res = _literal; |
| 27527 | goto done; |
| 27528 | } |
| 27529 | p->mark = _mark; |
| 27530 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 27531 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
| 27532 | } |
| 27533 | { // '{' |
| 27534 | if (p->error_indicator) { |
| 27535 | D(p->level--); |
| 27536 | return NULL; |
| 27537 | } |
| 27538 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); |
| 27539 | Token * _literal; |
| 27540 | if ( |
| 27541 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 27542 | ) |
| 27543 | { |
| 27544 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); |
| 27545 | _res = _literal; |
| 27546 | goto done; |
| 27547 | } |
| 27548 | p->mark = _mark; |
| 27549 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 27550 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); |
| 27551 | } |
| 27552 | _res = NULL; |
| 27553 | done: |
| 27554 | D(p->level--); |
| 27555 | return _res; |
| 27556 | } |
| 27557 | |
| 27558 | // _tmp_148: '[' | '{' |
| 27559 | static void * |
| 27560 | _tmp_148_rule(Parser *p) |
| 27561 | { |
| 27562 | D(p->level++); |
| 27563 | if (p->error_indicator) { |
| 27564 | D(p->level--); |
| 27565 | return NULL; |
| 27566 | } |
| 27567 | void * _res = NULL; |
| 27568 | int _mark = p->mark; |
| 27569 | { // '[' |
| 27570 | if (p->error_indicator) { |
| 27571 | D(p->level--); |
| 27572 | return NULL; |
| 27573 | } |
| 27574 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
| 27575 | Token * _literal; |
| 27576 | if ( |
| 27577 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
| 27578 | ) |
| 27579 | { |
| 27580 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
| 27581 | _res = _literal; |
| 27582 | goto done; |
| 27583 | } |
| 27584 | p->mark = _mark; |
| 27585 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', |
| 27586 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
| 27587 | } |
| 27588 | { // '{' |
| 27589 | if (p->error_indicator) { |
| 27590 | D(p->level--); |
| 27591 | return NULL; |
| 27592 | } |
| 27593 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); |
| 27594 | Token * _literal; |
| 27595 | if ( |
| 27596 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 27597 | ) |
| 27598 | { |
| 27599 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); |
| 27600 | _res = _literal; |
| 27601 | goto done; |
| 27602 | } |
| 27603 | p->mark = _mark; |
| 27604 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', |
| 27605 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); |
| 27606 | } |
| 27607 | _res = NULL; |
| 27608 | done: |
| 27609 | D(p->level--); |
| 27610 | return _res; |
| 27611 | } |
| 27612 | |
| 27613 | // _loop0_149: param_no_default |
| 27614 | static asdl_seq * |
| 27615 | _loop0_149_rule(Parser *p) |
| 27616 | { |
| 27617 | D(p->level++); |
| 27618 | if (p->error_indicator) { |
| 27619 | D(p->level--); |
| 27620 | return NULL; |
| 27621 | } |
| 27622 | void *_res = NULL; |
| 27623 | int _mark = p->mark; |
| 27624 | int _start_mark = p->mark; |
| 27625 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27626 | if (!_children) { |
| 27627 | p->error_indicator = 1; |
| 27628 | PyErr_NoMemory(); |
| 27629 | D(p->level--); |
| 27630 | return NULL; |
| 27631 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27632 | Py_ssize_t _children_capacity = 1; |
| 27633 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27634 | { // param_no_default |
| 27635 | if (p->error_indicator) { |
| 27636 | D(p->level--); |
| 27637 | return NULL; |
| 27638 | } |
| 27639 | D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
| 27640 | arg_ty param_no_default_var; |
| 27641 | while ( |
| 27642 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
| 27643 | ) |
| 27644 | { |
| 27645 | _res = param_no_default_var; |
| 27646 | if (_n == _children_capacity) { |
| 27647 | _children_capacity *= 2; |
| 27648 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27649 | if (!_new_children) { |
| 27650 | p->error_indicator = 1; |
| 27651 | PyErr_NoMemory(); |
| 27652 | D(p->level--); |
| 27653 | return NULL; |
| 27654 | } |
| 27655 | _children = _new_children; |
| 27656 | } |
| 27657 | _children[_n++] = _res; |
| 27658 | _mark = p->mark; |
| 27659 | } |
| 27660 | p->mark = _mark; |
| 27661 | D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', |
| 27662 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
| 27663 | } |
| 27664 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27665 | if (!_seq) { |
| 27666 | PyMem_Free(_children); |
| 27667 | p->error_indicator = 1; |
| 27668 | PyErr_NoMemory(); |
| 27669 | D(p->level--); |
| 27670 | return NULL; |
| 27671 | } |
| 27672 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27673 | PyMem_Free(_children); |
| 27674 | _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); |
| 27675 | D(p->level--); |
| 27676 | return _seq; |
| 27677 | } |
| 27678 | |
| 27679 | // _loop1_150: param_with_default |
| 27680 | static asdl_seq * |
| 27681 | _loop1_150_rule(Parser *p) |
| 27682 | { |
| 27683 | D(p->level++); |
| 27684 | if (p->error_indicator) { |
| 27685 | D(p->level--); |
| 27686 | return NULL; |
| 27687 | } |
| 27688 | void *_res = NULL; |
| 27689 | int _mark = p->mark; |
| 27690 | int _start_mark = p->mark; |
| 27691 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27692 | if (!_children) { |
| 27693 | p->error_indicator = 1; |
| 27694 | PyErr_NoMemory(); |
| 27695 | D(p->level--); |
| 27696 | return NULL; |
| 27697 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27698 | Py_ssize_t _children_capacity = 1; |
| 27699 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27700 | { // param_with_default |
| 27701 | if (p->error_indicator) { |
| 27702 | D(p->level--); |
| 27703 | return NULL; |
| 27704 | } |
| 27705 | D(fprintf(stderr, "%*c> _loop1_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
| 27706 | NameDefaultPair* param_with_default_var; |
| 27707 | while ( |
| 27708 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
| 27709 | ) |
| 27710 | { |
| 27711 | _res = param_with_default_var; |
| 27712 | if (_n == _children_capacity) { |
| 27713 | _children_capacity *= 2; |
| 27714 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27715 | if (!_new_children) { |
| 27716 | p->error_indicator = 1; |
| 27717 | PyErr_NoMemory(); |
| 27718 | D(p->level--); |
| 27719 | return NULL; |
| 27720 | } |
| 27721 | _children = _new_children; |
| 27722 | } |
| 27723 | _children[_n++] = _res; |
| 27724 | _mark = p->mark; |
| 27725 | } |
| 27726 | p->mark = _mark; |
| 27727 | D(fprintf(stderr, "%*c%s _loop1_150[%d-%d]: %s failed!\n", p->level, ' ', |
| 27728 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
| 27729 | } |
| 27730 | if (_n == 0 || p->error_indicator) { |
| 27731 | PyMem_Free(_children); |
| 27732 | D(p->level--); |
| 27733 | return NULL; |
| 27734 | } |
| 27735 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27736 | if (!_seq) { |
| 27737 | PyMem_Free(_children); |
| 27738 | p->error_indicator = 1; |
| 27739 | PyErr_NoMemory(); |
| 27740 | D(p->level--); |
| 27741 | return NULL; |
| 27742 | } |
| 27743 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27744 | PyMem_Free(_children); |
| 27745 | _PyPegen_insert_memo(p, _start_mark, _loop1_150_type, _seq); |
| 27746 | D(p->level--); |
| 27747 | return _seq; |
| 27748 | } |
| 27749 | |
| 27750 | // _loop0_151: lambda_param_no_default |
| 27751 | static asdl_seq * |
| 27752 | _loop0_151_rule(Parser *p) |
| 27753 | { |
| 27754 | D(p->level++); |
| 27755 | if (p->error_indicator) { |
| 27756 | D(p->level--); |
| 27757 | return NULL; |
| 27758 | } |
| 27759 | void *_res = NULL; |
| 27760 | int _mark = p->mark; |
| 27761 | int _start_mark = p->mark; |
| 27762 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27763 | if (!_children) { |
| 27764 | p->error_indicator = 1; |
| 27765 | PyErr_NoMemory(); |
| 27766 | D(p->level--); |
| 27767 | return NULL; |
| 27768 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27769 | Py_ssize_t _children_capacity = 1; |
| 27770 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27771 | { // lambda_param_no_default |
| 27772 | if (p->error_indicator) { |
| 27773 | D(p->level--); |
| 27774 | return NULL; |
| 27775 | } |
| 27776 | D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
| 27777 | arg_ty lambda_param_no_default_var; |
| 27778 | while ( |
| 27779 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
| 27780 | ) |
| 27781 | { |
| 27782 | _res = lambda_param_no_default_var; |
| 27783 | if (_n == _children_capacity) { |
| 27784 | _children_capacity *= 2; |
| 27785 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27786 | if (!_new_children) { |
| 27787 | p->error_indicator = 1; |
| 27788 | PyErr_NoMemory(); |
| 27789 | D(p->level--); |
| 27790 | return NULL; |
| 27791 | } |
| 27792 | _children = _new_children; |
| 27793 | } |
| 27794 | _children[_n++] = _res; |
| 27795 | _mark = p->mark; |
| 27796 | } |
| 27797 | p->mark = _mark; |
| 27798 | D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', |
| 27799 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
| 27800 | } |
| 27801 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27802 | if (!_seq) { |
| 27803 | PyMem_Free(_children); |
| 27804 | p->error_indicator = 1; |
| 27805 | PyErr_NoMemory(); |
| 27806 | D(p->level--); |
| 27807 | return NULL; |
| 27808 | } |
| 27809 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27810 | PyMem_Free(_children); |
| 27811 | _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); |
| 27812 | D(p->level--); |
| 27813 | return _seq; |
| 27814 | } |
| 27815 | |
| 27816 | // _loop1_152: lambda_param_with_default |
| 27817 | static asdl_seq * |
| 27818 | _loop1_152_rule(Parser *p) |
| 27819 | { |
| 27820 | D(p->level++); |
| 27821 | if (p->error_indicator) { |
| 27822 | D(p->level--); |
| 27823 | return NULL; |
| 27824 | } |
| 27825 | void *_res = NULL; |
| 27826 | int _mark = p->mark; |
| 27827 | int _start_mark = p->mark; |
| 27828 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 27829 | if (!_children) { |
| 27830 | p->error_indicator = 1; |
| 27831 | PyErr_NoMemory(); |
| 27832 | D(p->level--); |
| 27833 | return NULL; |
| 27834 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 27835 | Py_ssize_t _children_capacity = 1; |
| 27836 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 27837 | { // lambda_param_with_default |
| 27838 | if (p->error_indicator) { |
| 27839 | D(p->level--); |
| 27840 | return NULL; |
| 27841 | } |
| 27842 | D(fprintf(stderr, "%*c> _loop1_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
| 27843 | NameDefaultPair* lambda_param_with_default_var; |
| 27844 | while ( |
| 27845 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
| 27846 | ) |
| 27847 | { |
| 27848 | _res = lambda_param_with_default_var; |
| 27849 | if (_n == _children_capacity) { |
| 27850 | _children_capacity *= 2; |
| 27851 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 27852 | if (!_new_children) { |
| 27853 | p->error_indicator = 1; |
| 27854 | PyErr_NoMemory(); |
| 27855 | D(p->level--); |
| 27856 | return NULL; |
| 27857 | } |
| 27858 | _children = _new_children; |
| 27859 | } |
| 27860 | _children[_n++] = _res; |
| 27861 | _mark = p->mark; |
| 27862 | } |
| 27863 | p->mark = _mark; |
| 27864 | D(fprintf(stderr, "%*c%s _loop1_152[%d-%d]: %s failed!\n", p->level, ' ', |
| 27865 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
| 27866 | } |
| 27867 | if (_n == 0 || p->error_indicator) { |
| 27868 | PyMem_Free(_children); |
| 27869 | D(p->level--); |
| 27870 | return NULL; |
| 27871 | } |
| 27872 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 27873 | if (!_seq) { |
| 27874 | PyMem_Free(_children); |
| 27875 | p->error_indicator = 1; |
| 27876 | PyErr_NoMemory(); |
| 27877 | D(p->level--); |
| 27878 | return NULL; |
| 27879 | } |
| 27880 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 27881 | PyMem_Free(_children); |
| 27882 | _PyPegen_insert_memo(p, _start_mark, _loop1_152_type, _seq); |
| 27883 | D(p->level--); |
| 27884 | return _seq; |
| 27885 | } |
| 27886 | |
| 27887 | // _tmp_153: ')' | ',' (')' | '**') |
| 27888 | static void * |
| 27889 | _tmp_153_rule(Parser *p) |
| 27890 | { |
| 27891 | D(p->level++); |
| 27892 | if (p->error_indicator) { |
| 27893 | D(p->level--); |
| 27894 | return NULL; |
| 27895 | } |
| 27896 | void * _res = NULL; |
| 27897 | int _mark = p->mark; |
| 27898 | { // ')' |
| 27899 | if (p->error_indicator) { |
| 27900 | D(p->level--); |
| 27901 | return NULL; |
| 27902 | } |
| 27903 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
| 27904 | Token * _literal; |
| 27905 | if ( |
| 27906 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 27907 | ) |
| 27908 | { |
| 27909 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
| 27910 | _res = _literal; |
| 27911 | goto done; |
| 27912 | } |
| 27913 | p->mark = _mark; |
| 27914 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', |
| 27915 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
| 27916 | } |
| 27917 | { // ',' (')' | '**') |
| 27918 | if (p->error_indicator) { |
| 27919 | D(p->level--); |
| 27920 | return NULL; |
| 27921 | } |
| 27922 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
| 27923 | Token * _literal; |
| 27924 | void *_tmp_177_var; |
| 27925 | if ( |
| 27926 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 27927 | && |
| 27928 | (_tmp_177_var = _tmp_177_rule(p)) // ')' | '**' |
| 27929 | ) |
| 27930 | { |
| 27931 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
| 27932 | _res = _PyPegen_dummy_name(p, _literal, _tmp_177_var); |
| 27933 | goto done; |
| 27934 | } |
| 27935 | p->mark = _mark; |
| 27936 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', |
| 27937 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); |
| 27938 | } |
| 27939 | _res = NULL; |
| 27940 | done: |
| 27941 | D(p->level--); |
| 27942 | return _res; |
| 27943 | } |
| 27944 | |
| 27945 | // _tmp_154: ':' | ',' (':' | '**') |
| 27946 | static void * |
| 27947 | _tmp_154_rule(Parser *p) |
| 27948 | { |
| 27949 | D(p->level++); |
| 27950 | if (p->error_indicator) { |
| 27951 | D(p->level--); |
| 27952 | return NULL; |
| 27953 | } |
| 27954 | void * _res = NULL; |
| 27955 | int _mark = p->mark; |
| 27956 | { // ':' |
| 27957 | if (p->error_indicator) { |
| 27958 | D(p->level--); |
| 27959 | return NULL; |
| 27960 | } |
| 27961 | D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
| 27962 | Token * _literal; |
| 27963 | if ( |
| 27964 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 27965 | ) |
| 27966 | { |
| 27967 | D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
| 27968 | _res = _literal; |
| 27969 | goto done; |
| 27970 | } |
| 27971 | p->mark = _mark; |
| 27972 | D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', |
| 27973 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
| 27974 | } |
| 27975 | { // ',' (':' | '**') |
| 27976 | if (p->error_indicator) { |
| 27977 | D(p->level--); |
| 27978 | return NULL; |
| 27979 | } |
| 27980 | D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
| 27981 | Token * _literal; |
| 27982 | void *_tmp_178_var; |
| 27983 | if ( |
| 27984 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 27985 | && |
| 27986 | (_tmp_178_var = _tmp_178_rule(p)) // ':' | '**' |
| 27987 | ) |
| 27988 | { |
| 27989 | D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
| 27990 | _res = _PyPegen_dummy_name(p, _literal, _tmp_178_var); |
| 27991 | goto done; |
| 27992 | } |
| 27993 | p->mark = _mark; |
| 27994 | D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', |
| 27995 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); |
| 27996 | } |
| 27997 | _res = NULL; |
| 27998 | done: |
| 27999 | D(p->level--); |
| 28000 | return _res; |
| 28001 | } |
| 28002 | |
| 28003 | // _tmp_155: ',' | ')' | ':' |
| 28004 | static void * |
| 28005 | _tmp_155_rule(Parser *p) |
| 28006 | { |
| 28007 | D(p->level++); |
| 28008 | if (p->error_indicator) { |
| 28009 | D(p->level--); |
| 28010 | return NULL; |
| 28011 | } |
| 28012 | void * _res = NULL; |
| 28013 | int _mark = p->mark; |
| 28014 | { // ',' |
| 28015 | if (p->error_indicator) { |
| 28016 | D(p->level--); |
| 28017 | return NULL; |
| 28018 | } |
| 28019 | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
| 28020 | Token * _literal; |
| 28021 | if ( |
| 28022 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28023 | ) |
| 28024 | { |
| 28025 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
| 28026 | _res = _literal; |
| 28027 | goto done; |
| 28028 | } |
| 28029 | p->mark = _mark; |
| 28030 | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
| 28031 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
| 28032 | } |
| 28033 | { // ')' |
| 28034 | if (p->error_indicator) { |
| 28035 | D(p->level--); |
| 28036 | return NULL; |
| 28037 | } |
| 28038 | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
| 28039 | Token * _literal; |
| 28040 | if ( |
| 28041 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 28042 | ) |
| 28043 | { |
| 28044 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
| 28045 | _res = _literal; |
| 28046 | goto done; |
| 28047 | } |
| 28048 | p->mark = _mark; |
| 28049 | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
| 28050 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
| 28051 | } |
| 28052 | { // ':' |
| 28053 | if (p->error_indicator) { |
| 28054 | D(p->level--); |
| 28055 | return NULL; |
| 28056 | } |
| 28057 | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
| 28058 | Token * _literal; |
| 28059 | if ( |
| 28060 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 28061 | ) |
| 28062 | { |
| 28063 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
| 28064 | _res = _literal; |
| 28065 | goto done; |
| 28066 | } |
| 28067 | p->mark = _mark; |
| 28068 | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
| 28069 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
| 28070 | } |
| 28071 | _res = NULL; |
| 28072 | done: |
| 28073 | D(p->level--); |
| 28074 | return _res; |
| 28075 | } |
| 28076 | |
| 28077 | // _loop0_157: ',' (expression ['as' star_target]) |
| 28078 | static asdl_seq * |
| 28079 | _loop0_157_rule(Parser *p) |
| 28080 | { |
| 28081 | D(p->level++); |
| 28082 | if (p->error_indicator) { |
| 28083 | D(p->level--); |
| 28084 | return NULL; |
| 28085 | } |
| 28086 | void *_res = NULL; |
| 28087 | int _mark = p->mark; |
| 28088 | int _start_mark = p->mark; |
| 28089 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 28090 | if (!_children) { |
| 28091 | p->error_indicator = 1; |
| 28092 | PyErr_NoMemory(); |
| 28093 | D(p->level--); |
| 28094 | return NULL; |
| 28095 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 28096 | Py_ssize_t _children_capacity = 1; |
| 28097 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28098 | { // ',' (expression ['as' star_target]) |
| 28099 | if (p->error_indicator) { |
| 28100 | D(p->level--); |
| 28101 | return NULL; |
| 28102 | } |
| 28103 | 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] | 28104 | Token * _literal; |
| 28105 | void *elem; |
| 28106 | while ( |
| 28107 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28108 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28109 | (elem = _tmp_179_rule(p)) // expression ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28110 | ) |
| 28111 | { |
| 28112 | _res = elem; |
| 28113 | if (_res == NULL && PyErr_Occurred()) { |
| 28114 | p->error_indicator = 1; |
| 28115 | PyMem_Free(_children); |
| 28116 | D(p->level--); |
| 28117 | return NULL; |
| 28118 | } |
| 28119 | if (_n == _children_capacity) { |
| 28120 | _children_capacity *= 2; |
| 28121 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 28122 | if (!_new_children) { |
| 28123 | p->error_indicator = 1; |
| 28124 | PyErr_NoMemory(); |
| 28125 | D(p->level--); |
| 28126 | return NULL; |
| 28127 | } |
| 28128 | _children = _new_children; |
| 28129 | } |
| 28130 | _children[_n++] = _res; |
| 28131 | _mark = p->mark; |
| 28132 | } |
| 28133 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28134 | D(fprintf(stderr, "%*c%s _loop0_157[%d-%d]: %s failed!\n", p->level, ' ', |
| 28135 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])")); |
| 28136 | } |
| 28137 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 28138 | if (!_seq) { |
| 28139 | PyMem_Free(_children); |
| 28140 | p->error_indicator = 1; |
| 28141 | PyErr_NoMemory(); |
| 28142 | D(p->level--); |
| 28143 | return NULL; |
| 28144 | } |
| 28145 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 28146 | PyMem_Free(_children); |
| 28147 | _PyPegen_insert_memo(p, _start_mark, _loop0_157_type, _seq); |
| 28148 | D(p->level--); |
| 28149 | return _seq; |
| 28150 | } |
| 28151 | |
| 28152 | // _gather_156: (expression ['as' star_target]) _loop0_157 |
| 28153 | static asdl_seq * |
| 28154 | _gather_156_rule(Parser *p) |
| 28155 | { |
| 28156 | D(p->level++); |
| 28157 | if (p->error_indicator) { |
| 28158 | D(p->level--); |
| 28159 | return NULL; |
| 28160 | } |
| 28161 | asdl_seq * _res = NULL; |
| 28162 | int _mark = p->mark; |
| 28163 | { // (expression ['as' star_target]) _loop0_157 |
| 28164 | if (p->error_indicator) { |
| 28165 | D(p->level--); |
| 28166 | return NULL; |
| 28167 | } |
| 28168 | D(fprintf(stderr, "%*c> _gather_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_157")); |
| 28169 | void *elem; |
| 28170 | asdl_seq * seq; |
| 28171 | if ( |
| 28172 | (elem = _tmp_179_rule(p)) // expression ['as' star_target] |
| 28173 | && |
| 28174 | (seq = _loop0_157_rule(p)) // _loop0_157 |
| 28175 | ) |
| 28176 | { |
| 28177 | D(fprintf(stderr, "%*c+ _gather_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_157")); |
| 28178 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 28179 | goto done; |
| 28180 | } |
| 28181 | p->mark = _mark; |
| 28182 | D(fprintf(stderr, "%*c%s _gather_156[%d-%d]: %s failed!\n", p->level, ' ', |
| 28183 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_157")); |
| 28184 | } |
| 28185 | _res = NULL; |
| 28186 | done: |
| 28187 | D(p->level--); |
| 28188 | return _res; |
| 28189 | } |
| 28190 | |
| 28191 | // _loop0_159: ',' (expressions ['as' star_target]) |
| 28192 | static asdl_seq * |
| 28193 | _loop0_159_rule(Parser *p) |
| 28194 | { |
| 28195 | D(p->level++); |
| 28196 | if (p->error_indicator) { |
| 28197 | D(p->level--); |
| 28198 | return NULL; |
| 28199 | } |
| 28200 | void *_res = NULL; |
| 28201 | int _mark = p->mark; |
| 28202 | int _start_mark = p->mark; |
| 28203 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 28204 | if (!_children) { |
| 28205 | p->error_indicator = 1; |
| 28206 | PyErr_NoMemory(); |
| 28207 | D(p->level--); |
| 28208 | return NULL; |
| 28209 | } |
Jozef Grajciar | c994ffe | 2021-03-01 12:18:33 +0100 | [diff] [blame] | 28210 | Py_ssize_t _children_capacity = 1; |
| 28211 | Py_ssize_t _n = 0; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28212 | { // ',' (expressions ['as' star_target]) |
| 28213 | if (p->error_indicator) { |
| 28214 | D(p->level--); |
| 28215 | return NULL; |
| 28216 | } |
| 28217 | D(fprintf(stderr, "%*c> _loop0_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); |
| 28218 | Token * _literal; |
| 28219 | void *elem; |
| 28220 | while ( |
| 28221 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28222 | && |
| 28223 | (elem = _tmp_180_rule(p)) // expressions ['as' star_target] |
| 28224 | ) |
| 28225 | { |
| 28226 | _res = elem; |
| 28227 | if (_res == NULL && PyErr_Occurred()) { |
| 28228 | p->error_indicator = 1; |
| 28229 | PyMem_Free(_children); |
| 28230 | D(p->level--); |
| 28231 | return NULL; |
| 28232 | } |
| 28233 | if (_n == _children_capacity) { |
| 28234 | _children_capacity *= 2; |
| 28235 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 28236 | if (!_new_children) { |
| 28237 | p->error_indicator = 1; |
| 28238 | PyErr_NoMemory(); |
| 28239 | D(p->level--); |
| 28240 | return NULL; |
| 28241 | } |
| 28242 | _children = _new_children; |
| 28243 | } |
| 28244 | _children[_n++] = _res; |
| 28245 | _mark = p->mark; |
| 28246 | } |
| 28247 | p->mark = _mark; |
| 28248 | 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] | 28249 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])")); |
| 28250 | } |
| 28251 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
| 28252 | if (!_seq) { |
| 28253 | PyMem_Free(_children); |
| 28254 | p->error_indicator = 1; |
| 28255 | PyErr_NoMemory(); |
| 28256 | D(p->level--); |
| 28257 | return NULL; |
| 28258 | } |
| 28259 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
| 28260 | PyMem_Free(_children); |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28261 | _PyPegen_insert_memo(p, _start_mark, _loop0_159_type, _seq); |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28262 | D(p->level--); |
| 28263 | return _seq; |
| 28264 | } |
| 28265 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28266 | // _gather_158: (expressions ['as' star_target]) _loop0_159 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28267 | static asdl_seq * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28268 | _gather_158_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28269 | { |
| 28270 | D(p->level++); |
| 28271 | if (p->error_indicator) { |
| 28272 | D(p->level--); |
| 28273 | return NULL; |
| 28274 | } |
| 28275 | asdl_seq * _res = NULL; |
| 28276 | int _mark = p->mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28277 | { // (expressions ['as' star_target]) _loop0_159 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28278 | if (p->error_indicator) { |
| 28279 | D(p->level--); |
| 28280 | return NULL; |
| 28281 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28282 | 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] | 28283 | void *elem; |
| 28284 | asdl_seq * seq; |
| 28285 | if ( |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28286 | (elem = _tmp_180_rule(p)) // expressions ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28287 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28288 | (seq = _loop0_159_rule(p)) // _loop0_159 |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28289 | ) |
| 28290 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28291 | 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] | 28292 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
| 28293 | goto done; |
| 28294 | } |
| 28295 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28296 | D(fprintf(stderr, "%*c%s _gather_158[%d-%d]: %s failed!\n", p->level, ' ', |
| 28297 | 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] | 28298 | } |
| 28299 | _res = NULL; |
| 28300 | done: |
| 28301 | D(p->level--); |
| 28302 | return _res; |
| 28303 | } |
| 28304 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28305 | // _tmp_160: 'as' NAME |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28306 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28307 | _tmp_160_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 28308 | { |
| 28309 | D(p->level++); |
| 28310 | if (p->error_indicator) { |
| 28311 | D(p->level--); |
| 28312 | return NULL; |
| 28313 | } |
| 28314 | void * _res = NULL; |
| 28315 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28316 | { // 'as' NAME |
| 28317 | if (p->error_indicator) { |
| 28318 | D(p->level--); |
| 28319 | return NULL; |
| 28320 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28321 | 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] | 28322 | Token * _keyword; |
| 28323 | expr_ty name_var; |
| 28324 | if ( |
| 28325 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 28326 | && |
| 28327 | (name_var = _PyPegen_name_token(p)) // NAME |
| 28328 | ) |
| 28329 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28330 | 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] | 28331 | _res = _PyPegen_dummy_name(p, _keyword, name_var); |
| 28332 | goto done; |
| 28333 | } |
| 28334 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28335 | 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] | 28336 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 28337 | } |
| 28338 | _res = NULL; |
| 28339 | done: |
| 28340 | D(p->level--); |
| 28341 | return _res; |
| 28342 | } |
| 28343 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28344 | // _tmp_161: 'as' NAME |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28345 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28346 | _tmp_161_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28347 | { |
| 28348 | D(p->level++); |
| 28349 | if (p->error_indicator) { |
| 28350 | D(p->level--); |
| 28351 | return NULL; |
| 28352 | } |
| 28353 | void * _res = NULL; |
| 28354 | int _mark = p->mark; |
| 28355 | { // 'as' NAME |
| 28356 | if (p->error_indicator) { |
| 28357 | D(p->level--); |
| 28358 | return NULL; |
| 28359 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28360 | 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] | 28361 | Token * _keyword; |
| 28362 | expr_ty name_var; |
| 28363 | if ( |
| 28364 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 28365 | && |
| 28366 | (name_var = _PyPegen_name_token(p)) // NAME |
| 28367 | ) |
| 28368 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28369 | 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] | 28370 | _res = _PyPegen_dummy_name(p, _keyword, name_var); |
| 28371 | goto done; |
| 28372 | } |
| 28373 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28374 | 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] | 28375 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
| 28376 | } |
| 28377 | _res = NULL; |
| 28378 | done: |
| 28379 | D(p->level--); |
| 28380 | return _res; |
| 28381 | } |
| 28382 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28383 | // _tmp_162: star_targets '=' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28384 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28385 | _tmp_162_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28386 | { |
| 28387 | D(p->level++); |
| 28388 | if (p->error_indicator) { |
| 28389 | D(p->level--); |
| 28390 | return NULL; |
| 28391 | } |
| 28392 | void * _res = NULL; |
| 28393 | int _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28394 | { // star_targets '=' |
| 28395 | if (p->error_indicator) { |
| 28396 | D(p->level--); |
| 28397 | return NULL; |
| 28398 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28399 | 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] | 28400 | Token * _literal; |
| 28401 | expr_ty z; |
| 28402 | if ( |
| 28403 | (z = star_targets_rule(p)) // star_targets |
| 28404 | && |
| 28405 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 28406 | ) |
| 28407 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28408 | 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] | 28409 | _res = z; |
| 28410 | if (_res == NULL && PyErr_Occurred()) { |
| 28411 | p->error_indicator = 1; |
| 28412 | D(p->level--); |
| 28413 | return NULL; |
| 28414 | } |
| 28415 | goto done; |
| 28416 | } |
| 28417 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28418 | 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] | 28419 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
| 28420 | } |
| 28421 | _res = NULL; |
| 28422 | done: |
| 28423 | D(p->level--); |
| 28424 | return _res; |
| 28425 | } |
| 28426 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28427 | // _tmp_163: '.' | '...' |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28428 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28429 | _tmp_163_rule(Parser *p) |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28430 | { |
| 28431 | D(p->level++); |
| 28432 | if (p->error_indicator) { |
| 28433 | D(p->level--); |
| 28434 | return NULL; |
| 28435 | } |
| 28436 | void * _res = NULL; |
| 28437 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28438 | { // '.' |
| 28439 | if (p->error_indicator) { |
| 28440 | D(p->level--); |
| 28441 | return NULL; |
| 28442 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28443 | 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] | 28444 | Token * _literal; |
| 28445 | if ( |
| 28446 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 28447 | ) |
| 28448 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28449 | 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] | 28450 | _res = _literal; |
| 28451 | goto done; |
| 28452 | } |
| 28453 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28454 | 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] | 28455 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 28456 | } |
| 28457 | { // '...' |
| 28458 | if (p->error_indicator) { |
| 28459 | D(p->level--); |
| 28460 | return NULL; |
| 28461 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28462 | 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] | 28463 | Token * _literal; |
| 28464 | if ( |
| 28465 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 28466 | ) |
| 28467 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28468 | 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] | 28469 | _res = _literal; |
| 28470 | goto done; |
| 28471 | } |
| 28472 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28473 | 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] | 28474 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
| 28475 | } |
| 28476 | _res = NULL; |
| 28477 | done: |
| 28478 | D(p->level--); |
| 28479 | return _res; |
| 28480 | } |
| 28481 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28482 | // _tmp_164: '.' | '...' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28483 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28484 | _tmp_164_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28485 | { |
| 28486 | D(p->level++); |
| 28487 | if (p->error_indicator) { |
| 28488 | D(p->level--); |
| 28489 | return NULL; |
| 28490 | } |
| 28491 | void * _res = NULL; |
| 28492 | int _mark = p->mark; |
| 28493 | { // '.' |
| 28494 | if (p->error_indicator) { |
| 28495 | D(p->level--); |
| 28496 | return NULL; |
| 28497 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28498 | 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] | 28499 | Token * _literal; |
| 28500 | if ( |
| 28501 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 28502 | ) |
| 28503 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28504 | 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] | 28505 | _res = _literal; |
| 28506 | goto done; |
| 28507 | } |
| 28508 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28509 | 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] | 28510 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 28511 | } |
| 28512 | { // '...' |
| 28513 | if (p->error_indicator) { |
| 28514 | D(p->level--); |
| 28515 | return NULL; |
| 28516 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28517 | 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] | 28518 | Token * _literal; |
| 28519 | if ( |
| 28520 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 28521 | ) |
| 28522 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28523 | 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] | 28524 | _res = _literal; |
| 28525 | goto done; |
| 28526 | } |
| 28527 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28528 | 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] | 28529 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
| 28530 | } |
| 28531 | _res = NULL; |
| 28532 | done: |
| 28533 | D(p->level--); |
| 28534 | return _res; |
| 28535 | } |
| 28536 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28537 | // _tmp_165: '@' named_expression NEWLINE |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28538 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28539 | _tmp_165_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28540 | { |
| 28541 | D(p->level++); |
| 28542 | if (p->error_indicator) { |
| 28543 | D(p->level--); |
| 28544 | return NULL; |
| 28545 | } |
| 28546 | void * _res = NULL; |
| 28547 | int _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28548 | { // '@' named_expression NEWLINE |
| 28549 | if (p->error_indicator) { |
| 28550 | D(p->level--); |
| 28551 | return NULL; |
| 28552 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28553 | 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] | 28554 | Token * _literal; |
| 28555 | expr_ty f; |
| 28556 | Token * newline_var; |
| 28557 | if ( |
| 28558 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
| 28559 | && |
| 28560 | (f = named_expression_rule(p)) // named_expression |
| 28561 | && |
| 28562 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 28563 | ) |
| 28564 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28565 | 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] | 28566 | _res = f; |
| 28567 | if (_res == NULL && PyErr_Occurred()) { |
| 28568 | p->error_indicator = 1; |
| 28569 | D(p->level--); |
| 28570 | return NULL; |
| 28571 | } |
| 28572 | goto done; |
| 28573 | } |
| 28574 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28575 | 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] | 28576 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); |
| 28577 | } |
| 28578 | _res = NULL; |
| 28579 | done: |
| 28580 | D(p->level--); |
| 28581 | return _res; |
| 28582 | } |
| 28583 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28584 | // _tmp_166: ',' star_expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28585 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28586 | _tmp_166_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28587 | { |
| 28588 | D(p->level++); |
| 28589 | if (p->error_indicator) { |
| 28590 | D(p->level--); |
| 28591 | return NULL; |
| 28592 | } |
| 28593 | void * _res = NULL; |
| 28594 | int _mark = p->mark; |
| 28595 | { // ',' star_expression |
| 28596 | if (p->error_indicator) { |
| 28597 | D(p->level--); |
| 28598 | return NULL; |
| 28599 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28600 | 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] | 28601 | Token * _literal; |
| 28602 | expr_ty c; |
| 28603 | if ( |
| 28604 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28605 | && |
| 28606 | (c = star_expression_rule(p)) // star_expression |
| 28607 | ) |
| 28608 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28609 | 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] | 28610 | _res = c; |
| 28611 | if (_res == NULL && PyErr_Occurred()) { |
| 28612 | p->error_indicator = 1; |
| 28613 | D(p->level--); |
| 28614 | return NULL; |
| 28615 | } |
| 28616 | goto done; |
| 28617 | } |
| 28618 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28619 | 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] | 28620 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); |
| 28621 | } |
| 28622 | _res = NULL; |
| 28623 | done: |
| 28624 | D(p->level--); |
| 28625 | return _res; |
| 28626 | } |
| 28627 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28628 | // _tmp_167: ',' expression |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28629 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28630 | _tmp_167_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28631 | { |
| 28632 | D(p->level++); |
| 28633 | if (p->error_indicator) { |
| 28634 | D(p->level--); |
| 28635 | return NULL; |
| 28636 | } |
| 28637 | void * _res = NULL; |
| 28638 | int _mark = p->mark; |
| 28639 | { // ',' expression |
| 28640 | if (p->error_indicator) { |
| 28641 | D(p->level--); |
| 28642 | return NULL; |
| 28643 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28644 | 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] | 28645 | Token * _literal; |
| 28646 | expr_ty c; |
| 28647 | if ( |
| 28648 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28649 | && |
| 28650 | (c = expression_rule(p)) // expression |
| 28651 | ) |
| 28652 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28653 | 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] | 28654 | _res = c; |
| 28655 | if (_res == NULL && PyErr_Occurred()) { |
| 28656 | p->error_indicator = 1; |
| 28657 | D(p->level--); |
| 28658 | return NULL; |
| 28659 | } |
| 28660 | goto done; |
| 28661 | } |
| 28662 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28663 | 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] | 28664 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
| 28665 | } |
| 28666 | _res = NULL; |
| 28667 | done: |
| 28668 | D(p->level--); |
| 28669 | return _res; |
| 28670 | } |
| 28671 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28672 | // _tmp_168: 'or' conjunction |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28673 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28674 | _tmp_168_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28675 | { |
| 28676 | D(p->level++); |
| 28677 | if (p->error_indicator) { |
| 28678 | D(p->level--); |
| 28679 | return NULL; |
| 28680 | } |
| 28681 | void * _res = NULL; |
| 28682 | int _mark = p->mark; |
| 28683 | { // 'or' conjunction |
| 28684 | if (p->error_indicator) { |
| 28685 | D(p->level--); |
| 28686 | return NULL; |
| 28687 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28688 | 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] | 28689 | Token * _keyword; |
| 28690 | expr_ty c; |
| 28691 | if ( |
| 28692 | (_keyword = _PyPegen_expect_token(p, 531)) // token='or' |
| 28693 | && |
| 28694 | (c = conjunction_rule(p)) // conjunction |
| 28695 | ) |
| 28696 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28697 | 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] | 28698 | _res = c; |
| 28699 | if (_res == NULL && PyErr_Occurred()) { |
| 28700 | p->error_indicator = 1; |
| 28701 | D(p->level--); |
| 28702 | return NULL; |
| 28703 | } |
| 28704 | goto done; |
| 28705 | } |
| 28706 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28707 | 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] | 28708 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); |
| 28709 | } |
| 28710 | _res = NULL; |
| 28711 | done: |
| 28712 | D(p->level--); |
| 28713 | return _res; |
| 28714 | } |
| 28715 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28716 | // _tmp_169: 'and' inversion |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28717 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28718 | _tmp_169_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28719 | { |
| 28720 | D(p->level++); |
| 28721 | if (p->error_indicator) { |
| 28722 | D(p->level--); |
| 28723 | return NULL; |
| 28724 | } |
| 28725 | void * _res = NULL; |
| 28726 | int _mark = p->mark; |
| 28727 | { // 'and' inversion |
| 28728 | if (p->error_indicator) { |
| 28729 | D(p->level--); |
| 28730 | return NULL; |
| 28731 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28732 | 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] | 28733 | Token * _keyword; |
| 28734 | expr_ty c; |
| 28735 | if ( |
| 28736 | (_keyword = _PyPegen_expect_token(p, 532)) // token='and' |
| 28737 | && |
| 28738 | (c = inversion_rule(p)) // inversion |
| 28739 | ) |
| 28740 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28741 | 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] | 28742 | _res = c; |
| 28743 | if (_res == NULL && PyErr_Occurred()) { |
| 28744 | p->error_indicator = 1; |
| 28745 | D(p->level--); |
| 28746 | return NULL; |
| 28747 | } |
| 28748 | goto done; |
| 28749 | } |
| 28750 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28751 | 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] | 28752 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); |
Pablo Galindo | b0aba1f | 2020-11-17 01:17:12 +0000 | [diff] [blame] | 28753 | } |
| 28754 | _res = NULL; |
| 28755 | done: |
| 28756 | D(p->level--); |
| 28757 | return _res; |
| 28758 | } |
| 28759 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28760 | // _tmp_170: 'if' disjunction |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28761 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28762 | _tmp_170_rule(Parser *p) |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 28763 | { |
| 28764 | D(p->level++); |
| 28765 | if (p->error_indicator) { |
| 28766 | D(p->level--); |
| 28767 | return NULL; |
| 28768 | } |
| 28769 | void * _res = NULL; |
| 28770 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28771 | { // 'if' disjunction |
| 28772 | if (p->error_indicator) { |
| 28773 | D(p->level--); |
| 28774 | return NULL; |
| 28775 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28776 | 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] | 28777 | Token * _keyword; |
| 28778 | expr_ty z; |
| 28779 | if ( |
| 28780 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 28781 | && |
| 28782 | (z = disjunction_rule(p)) // disjunction |
| 28783 | ) |
| 28784 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28785 | 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] | 28786 | _res = z; |
| 28787 | if (_res == NULL && PyErr_Occurred()) { |
| 28788 | p->error_indicator = 1; |
| 28789 | D(p->level--); |
| 28790 | return NULL; |
| 28791 | } |
| 28792 | goto done; |
| 28793 | } |
| 28794 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28795 | 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] | 28796 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
| 28797 | } |
| 28798 | _res = NULL; |
| 28799 | done: |
| 28800 | D(p->level--); |
| 28801 | return _res; |
| 28802 | } |
| 28803 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28804 | // _tmp_171: 'if' disjunction |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28805 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28806 | _tmp_171_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28807 | { |
| 28808 | D(p->level++); |
| 28809 | if (p->error_indicator) { |
| 28810 | D(p->level--); |
| 28811 | return NULL; |
| 28812 | } |
| 28813 | void * _res = NULL; |
| 28814 | int _mark = p->mark; |
| 28815 | { // 'if' disjunction |
| 28816 | if (p->error_indicator) { |
| 28817 | D(p->level--); |
| 28818 | return NULL; |
| 28819 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28820 | 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] | 28821 | Token * _keyword; |
| 28822 | expr_ty z; |
| 28823 | if ( |
| 28824 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 28825 | && |
| 28826 | (z = disjunction_rule(p)) // disjunction |
| 28827 | ) |
| 28828 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28829 | 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] | 28830 | _res = z; |
| 28831 | if (_res == NULL && PyErr_Occurred()) { |
| 28832 | p->error_indicator = 1; |
| 28833 | D(p->level--); |
| 28834 | return NULL; |
| 28835 | } |
| 28836 | goto done; |
| 28837 | } |
| 28838 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28839 | 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] | 28840 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
| 28841 | } |
| 28842 | _res = NULL; |
| 28843 | done: |
| 28844 | D(p->level--); |
| 28845 | return _res; |
| 28846 | } |
| 28847 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28848 | // _tmp_172: starred_expression | named_expression !'=' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28849 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28850 | _tmp_172_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28851 | { |
| 28852 | D(p->level++); |
| 28853 | if (p->error_indicator) { |
| 28854 | D(p->level--); |
| 28855 | return NULL; |
| 28856 | } |
| 28857 | void * _res = NULL; |
| 28858 | int _mark = p->mark; |
Pablo Galindo | 4a97b15 | 2020-09-02 17:44:19 +0100 | [diff] [blame] | 28859 | { // starred_expression |
| 28860 | if (p->error_indicator) { |
| 28861 | D(p->level--); |
| 28862 | return NULL; |
| 28863 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28864 | 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] | 28865 | expr_ty starred_expression_var; |
| 28866 | if ( |
| 28867 | (starred_expression_var = starred_expression_rule(p)) // starred_expression |
| 28868 | ) |
| 28869 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28870 | 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] | 28871 | _res = starred_expression_var; |
| 28872 | goto done; |
| 28873 | } |
| 28874 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28875 | 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] | 28876 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
| 28877 | } |
| 28878 | { // named_expression !'=' |
| 28879 | if (p->error_indicator) { |
| 28880 | D(p->level--); |
| 28881 | return NULL; |
| 28882 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28883 | 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] | 28884 | expr_ty named_expression_var; |
| 28885 | if ( |
| 28886 | (named_expression_var = named_expression_rule(p)) // named_expression |
| 28887 | && |
| 28888 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
| 28889 | ) |
| 28890 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28891 | 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] | 28892 | _res = named_expression_var; |
| 28893 | goto done; |
| 28894 | } |
| 28895 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28896 | 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] | 28897 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28898 | } |
| 28899 | _res = NULL; |
| 28900 | done: |
| 28901 | D(p->level--); |
| 28902 | return _res; |
| 28903 | } |
| 28904 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28905 | // _tmp_173: ',' star_target |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28906 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28907 | _tmp_173_rule(Parser *p) |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28908 | { |
| 28909 | D(p->level++); |
| 28910 | if (p->error_indicator) { |
| 28911 | D(p->level--); |
| 28912 | return NULL; |
| 28913 | } |
| 28914 | void * _res = NULL; |
| 28915 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28916 | { // ',' star_target |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28917 | if (p->error_indicator) { |
| 28918 | D(p->level--); |
| 28919 | return NULL; |
| 28920 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28921 | 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] | 28922 | Token * _literal; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28923 | expr_ty c; |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28924 | if ( |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28925 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28926 | && |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28927 | (c = star_target_rule(p)) // star_target |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28928 | ) |
| 28929 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28930 | 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] | 28931 | _res = c; |
| 28932 | if (_res == NULL && PyErr_Occurred()) { |
| 28933 | p->error_indicator = 1; |
| 28934 | D(p->level--); |
| 28935 | return NULL; |
| 28936 | } |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28937 | goto done; |
| 28938 | } |
| 28939 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28940 | 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] | 28941 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
Lysandros Nikolaou | 2ea320d | 2021-01-03 01:14:21 +0200 | [diff] [blame] | 28942 | } |
| 28943 | _res = NULL; |
| 28944 | done: |
| 28945 | D(p->level--); |
| 28946 | return _res; |
| 28947 | } |
| 28948 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28949 | // _tmp_174: ',' star_target |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28950 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28951 | _tmp_174_rule(Parser *p) |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 28952 | { |
| 28953 | D(p->level++); |
| 28954 | if (p->error_indicator) { |
| 28955 | D(p->level--); |
| 28956 | return NULL; |
| 28957 | } |
| 28958 | void * _res = NULL; |
| 28959 | int _mark = p->mark; |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28960 | { // ',' star_target |
| 28961 | if (p->error_indicator) { |
| 28962 | D(p->level--); |
| 28963 | return NULL; |
| 28964 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28965 | 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] | 28966 | Token * _literal; |
| 28967 | expr_ty c; |
| 28968 | if ( |
| 28969 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 28970 | && |
| 28971 | (c = star_target_rule(p)) // star_target |
| 28972 | ) |
| 28973 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28974 | 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] | 28975 | _res = c; |
| 28976 | if (_res == NULL && PyErr_Occurred()) { |
| 28977 | p->error_indicator = 1; |
| 28978 | D(p->level--); |
| 28979 | return NULL; |
| 28980 | } |
| 28981 | goto done; |
| 28982 | } |
| 28983 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28984 | 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] | 28985 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
| 28986 | } |
| 28987 | _res = NULL; |
| 28988 | done: |
| 28989 | D(p->level--); |
| 28990 | return _res; |
| 28991 | } |
| 28992 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28993 | // _tmp_175: star_targets '=' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28994 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 28995 | _tmp_175_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 28996 | { |
| 28997 | D(p->level++); |
| 28998 | if (p->error_indicator) { |
| 28999 | D(p->level--); |
| 29000 | return NULL; |
| 29001 | } |
| 29002 | void * _res = NULL; |
| 29003 | int _mark = p->mark; |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29004 | { // star_targets '=' |
| 29005 | if (p->error_indicator) { |
| 29006 | D(p->level--); |
| 29007 | return NULL; |
| 29008 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29009 | 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] | 29010 | Token * _literal; |
| 29011 | expr_ty star_targets_var; |
| 29012 | if ( |
| 29013 | (star_targets_var = star_targets_rule(p)) // star_targets |
| 29014 | && |
| 29015 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 29016 | ) |
| 29017 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29018 | 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] | 29019 | _res = _PyPegen_dummy_name(p, star_targets_var, _literal); |
| 29020 | goto done; |
| 29021 | } |
| 29022 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29023 | 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] | 29024 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
| 29025 | } |
| 29026 | _res = NULL; |
| 29027 | done: |
| 29028 | D(p->level--); |
| 29029 | return _res; |
| 29030 | } |
| 29031 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29032 | // _tmp_176: star_targets '=' |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29033 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29034 | _tmp_176_rule(Parser *p) |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 29035 | { |
| 29036 | D(p->level++); |
| 29037 | if (p->error_indicator) { |
| 29038 | D(p->level--); |
| 29039 | return NULL; |
| 29040 | } |
| 29041 | void * _res = NULL; |
| 29042 | int _mark = p->mark; |
| 29043 | { // star_targets '=' |
| 29044 | if (p->error_indicator) { |
| 29045 | D(p->level--); |
| 29046 | return NULL; |
| 29047 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29048 | 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] | 29049 | Token * _literal; |
| 29050 | expr_ty star_targets_var; |
| 29051 | if ( |
| 29052 | (star_targets_var = star_targets_rule(p)) // star_targets |
| 29053 | && |
| 29054 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 29055 | ) |
| 29056 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29057 | 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] | 29058 | _res = _PyPegen_dummy_name(p, star_targets_var, _literal); |
| 29059 | goto done; |
| 29060 | } |
| 29061 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29062 | 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] | 29063 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
| 29064 | } |
| 29065 | _res = NULL; |
| 29066 | done: |
| 29067 | D(p->level--); |
| 29068 | return _res; |
| 29069 | } |
| 29070 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29071 | // _tmp_177: ')' | '**' |
Pablo Galindo | 206cbda | 2021-02-07 18:42:21 +0000 | [diff] [blame] | 29072 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29073 | _tmp_177_rule(Parser *p) |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29074 | { |
| 29075 | D(p->level++); |
| 29076 | if (p->error_indicator) { |
| 29077 | D(p->level--); |
| 29078 | return NULL; |
| 29079 | } |
| 29080 | void * _res = NULL; |
| 29081 | int _mark = p->mark; |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29082 | { // ')' |
| 29083 | if (p->error_indicator) { |
| 29084 | D(p->level--); |
| 29085 | return NULL; |
| 29086 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29087 | 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] | 29088 | Token * _literal; |
| 29089 | if ( |
| 29090 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 29091 | ) |
| 29092 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29093 | 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] | 29094 | _res = _literal; |
| 29095 | goto done; |
| 29096 | } |
| 29097 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29098 | 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] | 29099 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29100 | } |
| 29101 | { // '**' |
| 29102 | if (p->error_indicator) { |
| 29103 | D(p->level--); |
| 29104 | return NULL; |
| 29105 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29106 | 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] | 29107 | Token * _literal; |
| 29108 | if ( |
| 29109 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 29110 | ) |
| 29111 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29112 | 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] | 29113 | _res = _literal; |
| 29114 | goto done; |
| 29115 | } |
| 29116 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29117 | 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] | 29118 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
| 29119 | } |
| 29120 | _res = NULL; |
| 29121 | done: |
| 29122 | D(p->level--); |
| 29123 | return _res; |
| 29124 | } |
| 29125 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29126 | // _tmp_178: ':' | '**' |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29127 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29128 | _tmp_178_rule(Parser *p) |
Pablo Galindo | 835f14f | 2021-01-31 22:52:56 +0000 | [diff] [blame] | 29129 | { |
| 29130 | D(p->level++); |
| 29131 | if (p->error_indicator) { |
| 29132 | D(p->level--); |
| 29133 | return NULL; |
| 29134 | } |
| 29135 | void * _res = NULL; |
| 29136 | int _mark = p->mark; |
| 29137 | { // ':' |
| 29138 | if (p->error_indicator) { |
| 29139 | D(p->level--); |
| 29140 | return NULL; |
| 29141 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29142 | 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] | 29143 | Token * _literal; |
| 29144 | if ( |
| 29145 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
| 29146 | ) |
| 29147 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29148 | 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] | 29149 | _res = _literal; |
| 29150 | goto done; |
| 29151 | } |
| 29152 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29153 | 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] | 29154 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
| 29155 | } |
| 29156 | { // '**' |
| 29157 | if (p->error_indicator) { |
| 29158 | D(p->level--); |
| 29159 | return NULL; |
| 29160 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29161 | 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] | 29162 | Token * _literal; |
| 29163 | if ( |
| 29164 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
| 29165 | ) |
| 29166 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29167 | 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] | 29168 | _res = _literal; |
| 29169 | goto done; |
| 29170 | } |
| 29171 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29172 | 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] | 29173 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
| 29174 | } |
| 29175 | _res = NULL; |
| 29176 | done: |
| 29177 | D(p->level--); |
| 29178 | return _res; |
| 29179 | } |
| 29180 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29181 | // _tmp_179: expression ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29182 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29183 | _tmp_179_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29184 | { |
| 29185 | D(p->level++); |
| 29186 | if (p->error_indicator) { |
| 29187 | D(p->level--); |
| 29188 | return NULL; |
| 29189 | } |
| 29190 | void * _res = NULL; |
| 29191 | int _mark = p->mark; |
| 29192 | { // expression ['as' star_target] |
| 29193 | if (p->error_indicator) { |
| 29194 | D(p->level--); |
| 29195 | return NULL; |
| 29196 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29197 | 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] | 29198 | void *_opt_var; |
| 29199 | UNUSED(_opt_var); // Silence compiler warnings |
| 29200 | expr_ty expression_var; |
| 29201 | if ( |
| 29202 | (expression_var = expression_rule(p)) // expression |
| 29203 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29204 | (_opt_var = _tmp_181_rule(p), 1) // ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29205 | ) |
| 29206 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29207 | 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] | 29208 | _res = _PyPegen_dummy_name(p, expression_var, _opt_var); |
| 29209 | goto done; |
| 29210 | } |
| 29211 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29212 | 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] | 29213 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); |
| 29214 | } |
| 29215 | _res = NULL; |
| 29216 | done: |
| 29217 | D(p->level--); |
| 29218 | return _res; |
| 29219 | } |
| 29220 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29221 | // _tmp_180: expressions ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29222 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29223 | _tmp_180_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29224 | { |
| 29225 | D(p->level++); |
| 29226 | if (p->error_indicator) { |
| 29227 | D(p->level--); |
| 29228 | return NULL; |
| 29229 | } |
| 29230 | void * _res = NULL; |
| 29231 | int _mark = p->mark; |
| 29232 | { // expressions ['as' star_target] |
| 29233 | if (p->error_indicator) { |
| 29234 | D(p->level--); |
| 29235 | return NULL; |
| 29236 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29237 | 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] | 29238 | void *_opt_var; |
| 29239 | UNUSED(_opt_var); // Silence compiler warnings |
| 29240 | expr_ty expressions_var; |
| 29241 | if ( |
| 29242 | (expressions_var = expressions_rule(p)) // expressions |
| 29243 | && |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29244 | (_opt_var = _tmp_182_rule(p), 1) // ['as' star_target] |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29245 | ) |
| 29246 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29247 | 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] | 29248 | _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); |
| 29249 | goto done; |
| 29250 | } |
| 29251 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29252 | 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] | 29253 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); |
| 29254 | } |
| 29255 | _res = NULL; |
| 29256 | done: |
| 29257 | D(p->level--); |
| 29258 | return _res; |
| 29259 | } |
| 29260 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29261 | // _tmp_181: 'as' star_target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29262 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29263 | _tmp_181_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29264 | { |
| 29265 | D(p->level++); |
| 29266 | if (p->error_indicator) { |
| 29267 | D(p->level--); |
| 29268 | return NULL; |
| 29269 | } |
| 29270 | void * _res = NULL; |
| 29271 | int _mark = p->mark; |
| 29272 | { // 'as' star_target |
| 29273 | if (p->error_indicator) { |
| 29274 | D(p->level--); |
| 29275 | return NULL; |
| 29276 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29277 | 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] | 29278 | Token * _keyword; |
| 29279 | expr_ty star_target_var; |
| 29280 | if ( |
| 29281 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 29282 | && |
| 29283 | (star_target_var = star_target_rule(p)) // star_target |
| 29284 | ) |
| 29285 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29286 | 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] | 29287 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
| 29288 | goto done; |
| 29289 | } |
| 29290 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29291 | 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] | 29292 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); |
| 29293 | } |
| 29294 | _res = NULL; |
| 29295 | done: |
| 29296 | D(p->level--); |
| 29297 | return _res; |
| 29298 | } |
| 29299 | |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29300 | // _tmp_182: 'as' star_target |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29301 | static void * |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29302 | _tmp_182_rule(Parser *p) |
Pablo Galindo | 58fb156 | 2021-02-02 19:54:22 +0000 | [diff] [blame] | 29303 | { |
| 29304 | D(p->level++); |
| 29305 | if (p->error_indicator) { |
| 29306 | D(p->level--); |
| 29307 | return NULL; |
| 29308 | } |
| 29309 | void * _res = NULL; |
| 29310 | int _mark = p->mark; |
| 29311 | { // 'as' star_target |
| 29312 | if (p->error_indicator) { |
| 29313 | D(p->level--); |
| 29314 | return NULL; |
| 29315 | } |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29316 | 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] | 29317 | Token * _keyword; |
| 29318 | expr_ty star_target_var; |
| 29319 | if ( |
| 29320 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
| 29321 | && |
| 29322 | (star_target_var = star_target_rule(p)) // star_target |
| 29323 | ) |
| 29324 | { |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29325 | 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] | 29326 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
| 29327 | goto done; |
| 29328 | } |
| 29329 | p->mark = _mark; |
Brandt Bucher | 145bf26 | 2021-02-26 14:51:55 -0800 | [diff] [blame] | 29330 | 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] | 29331 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); |
| 29332 | } |
| 29333 | _res = NULL; |
| 29334 | done: |
| 29335 | D(p->level--); |
| 29336 | return _res; |
| 29337 | } |
| 29338 | |
Pablo Galindo | 1ed83ad | 2020-06-11 17:30:46 +0100 | [diff] [blame] | 29339 | void * |
| 29340 | _PyPegen_parse(Parser *p) |
| 29341 | { |
| 29342 | // Initialize keywords |
| 29343 | p->keywords = reserved_keywords; |
| 29344 | p->n_keyword_lists = n_keyword_lists; |
| 29345 | |
| 29346 | // Run parser |
| 29347 | void *result = NULL; |
| 29348 | if (p->start_rule == Py_file_input) { |
| 29349 | result = file_rule(p); |
| 29350 | } else if (p->start_rule == Py_single_input) { |
| 29351 | result = interactive_rule(p); |
| 29352 | } else if (p->start_rule == Py_eval_input) { |
| 29353 | result = eval_rule(p); |
| 29354 | } else if (p->start_rule == Py_func_type_input) { |
| 29355 | result = func_type_rule(p); |
| 29356 | } else if (p->start_rule == Py_fstring_input) { |
| 29357 | result = fstring_rule(p); |
| 29358 | } |
| 29359 | |
| 29360 | return result; |
| 29361 | } |
| 29362 | |
| 29363 | // The end |