Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1 | // @generated by pegen.py from ./Grammar/python.gram |
| 2 | #include "pegen.h" |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3 | |
Miss Islington (bot) | 31084be | 2020-05-25 12:37:56 -0700 | [diff] [blame^] | 4 | #if defined(Py_DEBUG) && defined(Py_BUILD_CORE) |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5 | extern int Py_DebugFlag; |
| 6 | #define D(x) if (Py_DebugFlag) x; |
| 7 | #else |
| 8 | #define D(x) |
| 9 | #endif |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10 | static const int n_keyword_lists = 15; |
| 11 | static KeywordToken *reserved_keywords[] = { |
| 12 | NULL, |
| 13 | NULL, |
| 14 | (KeywordToken[]) { |
| 15 | {"if", 510}, |
| 16 | {"in", 518}, |
| 17 | {"is", 526}, |
| 18 | {"as", 531}, |
| 19 | {"or", 532}, |
| 20 | {NULL, -1}, |
| 21 | }, |
| 22 | (KeywordToken[]) { |
| 23 | {"del", 503}, |
| 24 | {"try", 511}, |
| 25 | {"for", 517}, |
| 26 | {"def", 522}, |
| 27 | {"not", 525}, |
| 28 | {"and", 533}, |
| 29 | {NULL, -1}, |
| 30 | }, |
| 31 | (KeywordToken[]) { |
| 32 | {"pass", 502}, |
| 33 | {"from", 514}, |
| 34 | {"elif", 515}, |
| 35 | {"else", 516}, |
| 36 | {"with", 519}, |
| 37 | {"True", 527}, |
| 38 | {"None", 529}, |
| 39 | {NULL, -1}, |
| 40 | }, |
| 41 | (KeywordToken[]) { |
| 42 | {"raise", 501}, |
| 43 | {"yield", 504}, |
| 44 | {"break", 506}, |
| 45 | {"while", 512}, |
| 46 | {"class", 523}, |
| 47 | {"False", 528}, |
| 48 | {NULL, -1}, |
| 49 | }, |
| 50 | (KeywordToken[]) { |
| 51 | {"return", 500}, |
| 52 | {"assert", 505}, |
| 53 | {"global", 508}, |
| 54 | {"import", 513}, |
| 55 | {"except", 520}, |
| 56 | {"lambda", 524}, |
| 57 | {NULL, -1}, |
| 58 | }, |
| 59 | (KeywordToken[]) { |
| 60 | {"finally", 521}, |
| 61 | {NULL, -1}, |
| 62 | }, |
| 63 | (KeywordToken[]) { |
| 64 | {"continue", 507}, |
| 65 | {"nonlocal", 509}, |
| 66 | {NULL, -1}, |
| 67 | }, |
| 68 | NULL, |
| 69 | NULL, |
| 70 | NULL, |
| 71 | NULL, |
| 72 | NULL, |
| 73 | (KeywordToken[]) { |
| 74 | {"__new_parser__", 530}, |
| 75 | {NULL, -1}, |
| 76 | }, |
| 77 | }; |
| 78 | #define file_type 1000 |
| 79 | #define interactive_type 1001 |
| 80 | #define eval_type 1002 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 81 | #define func_type_type 1003 |
| 82 | #define fstring_type 1004 |
| 83 | #define type_expressions_type 1005 |
| 84 | #define statements_type 1006 |
| 85 | #define statement_type 1007 |
| 86 | #define statement_newline_type 1008 |
| 87 | #define simple_stmt_type 1009 |
| 88 | #define small_stmt_type 1010 |
| 89 | #define compound_stmt_type 1011 |
| 90 | #define assignment_type 1012 |
| 91 | #define augassign_type 1013 |
| 92 | #define global_stmt_type 1014 |
| 93 | #define nonlocal_stmt_type 1015 |
| 94 | #define yield_stmt_type 1016 |
| 95 | #define assert_stmt_type 1017 |
| 96 | #define del_stmt_type 1018 |
| 97 | #define import_stmt_type 1019 |
| 98 | #define import_name_type 1020 |
| 99 | #define import_from_type 1021 |
| 100 | #define import_from_targets_type 1022 |
| 101 | #define import_from_as_names_type 1023 |
| 102 | #define import_from_as_name_type 1024 |
| 103 | #define dotted_as_names_type 1025 |
| 104 | #define dotted_as_name_type 1026 |
| 105 | #define dotted_name_type 1027 // Left-recursive |
| 106 | #define if_stmt_type 1028 |
| 107 | #define elif_stmt_type 1029 |
| 108 | #define else_block_type 1030 |
| 109 | #define while_stmt_type 1031 |
| 110 | #define for_stmt_type 1032 |
| 111 | #define with_stmt_type 1033 |
| 112 | #define with_item_type 1034 |
| 113 | #define try_stmt_type 1035 |
| 114 | #define except_block_type 1036 |
| 115 | #define finally_block_type 1037 |
| 116 | #define return_stmt_type 1038 |
| 117 | #define raise_stmt_type 1039 |
| 118 | #define function_def_type 1040 |
| 119 | #define function_def_raw_type 1041 |
| 120 | #define func_type_comment_type 1042 |
| 121 | #define params_type 1043 |
| 122 | #define parameters_type 1044 |
| 123 | #define slash_no_default_type 1045 |
| 124 | #define slash_with_default_type 1046 |
| 125 | #define star_etc_type 1047 |
| 126 | #define kwds_type 1048 |
| 127 | #define param_no_default_type 1049 |
| 128 | #define param_with_default_type 1050 |
| 129 | #define param_maybe_default_type 1051 |
| 130 | #define param_type 1052 |
| 131 | #define annotation_type 1053 |
| 132 | #define default_type 1054 |
| 133 | #define decorators_type 1055 |
| 134 | #define class_def_type 1056 |
| 135 | #define class_def_raw_type 1057 |
| 136 | #define block_type 1058 |
| 137 | #define expressions_list_type 1059 |
| 138 | #define star_expressions_type 1060 |
| 139 | #define star_expression_type 1061 |
| 140 | #define star_named_expressions_type 1062 |
| 141 | #define star_named_expression_type 1063 |
| 142 | #define named_expression_type 1064 |
| 143 | #define annotated_rhs_type 1065 |
| 144 | #define expressions_type 1066 |
| 145 | #define expression_type 1067 |
| 146 | #define lambdef_type 1068 |
| 147 | #define lambda_parameters_type 1069 |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 148 | #define lambda_slash_no_default_type 1070 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 149 | #define lambda_slash_with_default_type 1071 |
| 150 | #define lambda_star_etc_type 1072 |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 151 | #define lambda_kwds_type 1073 |
| 152 | #define lambda_param_no_default_type 1074 |
| 153 | #define lambda_param_with_default_type 1075 |
| 154 | #define lambda_param_maybe_default_type 1076 |
| 155 | #define lambda_param_type 1077 |
| 156 | #define disjunction_type 1078 |
| 157 | #define conjunction_type 1079 |
| 158 | #define inversion_type 1080 |
| 159 | #define comparison_type 1081 |
| 160 | #define compare_op_bitwise_or_pair_type 1082 |
| 161 | #define eq_bitwise_or_type 1083 |
| 162 | #define noteq_bitwise_or_type 1084 |
| 163 | #define lte_bitwise_or_type 1085 |
| 164 | #define lt_bitwise_or_type 1086 |
| 165 | #define gte_bitwise_or_type 1087 |
| 166 | #define gt_bitwise_or_type 1088 |
| 167 | #define notin_bitwise_or_type 1089 |
| 168 | #define in_bitwise_or_type 1090 |
| 169 | #define isnot_bitwise_or_type 1091 |
| 170 | #define is_bitwise_or_type 1092 |
| 171 | #define bitwise_or_type 1093 // Left-recursive |
| 172 | #define bitwise_xor_type 1094 // Left-recursive |
| 173 | #define bitwise_and_type 1095 // Left-recursive |
| 174 | #define shift_expr_type 1096 // Left-recursive |
| 175 | #define sum_type 1097 // Left-recursive |
| 176 | #define term_type 1098 // Left-recursive |
| 177 | #define factor_type 1099 |
| 178 | #define power_type 1100 |
| 179 | #define await_primary_type 1101 |
| 180 | #define primary_type 1102 // Left-recursive |
| 181 | #define slices_type 1103 |
| 182 | #define slice_type 1104 |
| 183 | #define atom_type 1105 |
| 184 | #define strings_type 1106 |
| 185 | #define list_type 1107 |
| 186 | #define listcomp_type 1108 |
| 187 | #define tuple_type 1109 |
| 188 | #define group_type 1110 |
| 189 | #define genexp_type 1111 |
| 190 | #define set_type 1112 |
| 191 | #define setcomp_type 1113 |
| 192 | #define dict_type 1114 |
| 193 | #define dictcomp_type 1115 |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 194 | #define double_starred_kvpairs_type 1116 |
| 195 | #define double_starred_kvpair_type 1117 |
| 196 | #define kvpair_type 1118 |
| 197 | #define for_if_clauses_type 1119 |
| 198 | #define for_if_clause_type 1120 |
| 199 | #define yield_expr_type 1121 |
| 200 | #define arguments_type 1122 |
| 201 | #define args_type 1123 |
| 202 | #define kwargs_type 1124 |
| 203 | #define starred_expression_type 1125 |
| 204 | #define kwarg_or_starred_type 1126 |
| 205 | #define kwarg_or_double_starred_type 1127 |
| 206 | #define star_targets_type 1128 |
| 207 | #define star_targets_seq_type 1129 |
| 208 | #define star_target_type 1130 |
| 209 | #define star_atom_type 1131 |
| 210 | #define single_target_type 1132 |
| 211 | #define single_subscript_attribute_target_type 1133 |
| 212 | #define del_targets_type 1134 |
| 213 | #define del_target_type 1135 |
| 214 | #define del_t_atom_type 1136 |
| 215 | #define del_target_end_type 1137 |
| 216 | #define targets_type 1138 |
| 217 | #define target_type 1139 |
| 218 | #define t_primary_type 1140 // Left-recursive |
| 219 | #define t_lookahead_type 1141 |
| 220 | #define t_atom_type 1142 |
| 221 | #define incorrect_arguments_type 1143 |
| 222 | #define invalid_kwarg_type 1144 |
| 223 | #define invalid_named_expression_type 1145 |
| 224 | #define invalid_assignment_type 1146 |
| 225 | #define invalid_block_type 1147 |
| 226 | #define invalid_comprehension_type 1148 |
| 227 | #define invalid_dict_comprehension_type 1149 |
| 228 | #define invalid_parameters_type 1150 |
| 229 | #define invalid_star_etc_type 1151 |
| 230 | #define invalid_lambda_star_etc_type 1152 |
| 231 | #define invalid_double_type_comments_type 1153 |
| 232 | #define invalid_del_target_type 1154 |
| 233 | #define invalid_import_from_targets_type 1155 |
| 234 | #define _loop0_1_type 1156 |
| 235 | #define _loop0_2_type 1157 |
| 236 | #define _loop0_4_type 1158 |
| 237 | #define _gather_3_type 1159 |
| 238 | #define _loop0_6_type 1160 |
| 239 | #define _gather_5_type 1161 |
| 240 | #define _loop0_8_type 1162 |
| 241 | #define _gather_7_type 1163 |
| 242 | #define _loop0_10_type 1164 |
| 243 | #define _gather_9_type 1165 |
| 244 | #define _loop1_11_type 1166 |
| 245 | #define _loop0_13_type 1167 |
| 246 | #define _gather_12_type 1168 |
| 247 | #define _tmp_14_type 1169 |
| 248 | #define _tmp_15_type 1170 |
| 249 | #define _tmp_16_type 1171 |
| 250 | #define _tmp_17_type 1172 |
| 251 | #define _tmp_18_type 1173 |
| 252 | #define _tmp_19_type 1174 |
| 253 | #define _tmp_20_type 1175 |
| 254 | #define _tmp_21_type 1176 |
| 255 | #define _loop1_22_type 1177 |
| 256 | #define _tmp_23_type 1178 |
| 257 | #define _tmp_24_type 1179 |
| 258 | #define _loop0_26_type 1180 |
| 259 | #define _gather_25_type 1181 |
| 260 | #define _loop0_28_type 1182 |
| 261 | #define _gather_27_type 1183 |
| 262 | #define _tmp_29_type 1184 |
| 263 | #define _loop0_30_type 1185 |
| 264 | #define _loop1_31_type 1186 |
| 265 | #define _loop0_33_type 1187 |
| 266 | #define _gather_32_type 1188 |
| 267 | #define _tmp_34_type 1189 |
| 268 | #define _loop0_36_type 1190 |
| 269 | #define _gather_35_type 1191 |
| 270 | #define _tmp_37_type 1192 |
| 271 | #define _loop0_39_type 1193 |
| 272 | #define _gather_38_type 1194 |
| 273 | #define _loop0_41_type 1195 |
| 274 | #define _gather_40_type 1196 |
| 275 | #define _loop0_43_type 1197 |
| 276 | #define _gather_42_type 1198 |
| 277 | #define _loop0_45_type 1199 |
| 278 | #define _gather_44_type 1200 |
| 279 | #define _tmp_46_type 1201 |
| 280 | #define _loop1_47_type 1202 |
| 281 | #define _tmp_48_type 1203 |
| 282 | #define _tmp_49_type 1204 |
| 283 | #define _tmp_50_type 1205 |
| 284 | #define _tmp_51_type 1206 |
| 285 | #define _tmp_52_type 1207 |
| 286 | #define _loop0_53_type 1208 |
| 287 | #define _loop0_54_type 1209 |
| 288 | #define _loop0_55_type 1210 |
| 289 | #define _loop1_56_type 1211 |
| 290 | #define _loop0_57_type 1212 |
| 291 | #define _loop1_58_type 1213 |
| 292 | #define _loop1_59_type 1214 |
| 293 | #define _loop1_60_type 1215 |
| 294 | #define _loop0_61_type 1216 |
| 295 | #define _loop1_62_type 1217 |
| 296 | #define _loop0_63_type 1218 |
| 297 | #define _loop1_64_type 1219 |
| 298 | #define _loop0_65_type 1220 |
| 299 | #define _loop1_66_type 1221 |
| 300 | #define _loop1_67_type 1222 |
| 301 | #define _tmp_68_type 1223 |
| 302 | #define _loop0_70_type 1224 |
| 303 | #define _gather_69_type 1225 |
| 304 | #define _loop1_71_type 1226 |
| 305 | #define _loop0_73_type 1227 |
| 306 | #define _gather_72_type 1228 |
| 307 | #define _loop1_74_type 1229 |
| 308 | #define _loop0_75_type 1230 |
| 309 | #define _loop0_76_type 1231 |
| 310 | #define _loop0_77_type 1232 |
| 311 | #define _loop1_78_type 1233 |
| 312 | #define _loop0_79_type 1234 |
| 313 | #define _loop1_80_type 1235 |
| 314 | #define _loop1_81_type 1236 |
| 315 | #define _loop1_82_type 1237 |
| 316 | #define _loop0_83_type 1238 |
| 317 | #define _loop1_84_type 1239 |
| 318 | #define _loop0_85_type 1240 |
| 319 | #define _loop1_86_type 1241 |
| 320 | #define _loop0_87_type 1242 |
| 321 | #define _loop1_88_type 1243 |
| 322 | #define _loop1_89_type 1244 |
| 323 | #define _loop1_90_type 1245 |
| 324 | #define _loop1_91_type 1246 |
| 325 | #define _tmp_92_type 1247 |
| 326 | #define _loop0_94_type 1248 |
| 327 | #define _gather_93_type 1249 |
| 328 | #define _tmp_95_type 1250 |
| 329 | #define _tmp_96_type 1251 |
| 330 | #define _tmp_97_type 1252 |
| 331 | #define _tmp_98_type 1253 |
| 332 | #define _loop1_99_type 1254 |
| 333 | #define _tmp_100_type 1255 |
| 334 | #define _tmp_101_type 1256 |
| 335 | #define _loop0_103_type 1257 |
| 336 | #define _gather_102_type 1258 |
| 337 | #define _loop1_104_type 1259 |
| 338 | #define _loop0_105_type 1260 |
| 339 | #define _loop0_106_type 1261 |
| 340 | #define _tmp_107_type 1262 |
| 341 | #define _tmp_108_type 1263 |
| 342 | #define _loop0_110_type 1264 |
| 343 | #define _gather_109_type 1265 |
| 344 | #define _loop0_112_type 1266 |
| 345 | #define _gather_111_type 1267 |
| 346 | #define _loop0_114_type 1268 |
| 347 | #define _gather_113_type 1269 |
| 348 | #define _loop0_116_type 1270 |
| 349 | #define _gather_115_type 1271 |
| 350 | #define _loop0_117_type 1272 |
| 351 | #define _loop0_119_type 1273 |
| 352 | #define _gather_118_type 1274 |
| 353 | #define _tmp_120_type 1275 |
| 354 | #define _loop0_122_type 1276 |
| 355 | #define _gather_121_type 1277 |
| 356 | #define _loop0_124_type 1278 |
| 357 | #define _gather_123_type 1279 |
| 358 | #define _tmp_125_type 1280 |
| 359 | #define _loop0_126_type 1281 |
| 360 | #define _tmp_127_type 1282 |
| 361 | #define _tmp_128_type 1283 |
| 362 | #define _tmp_129_type 1284 |
| 363 | #define _tmp_130_type 1285 |
| 364 | #define _loop0_131_type 1286 |
| 365 | #define _tmp_132_type 1287 |
| 366 | #define _tmp_133_type 1288 |
| 367 | #define _tmp_134_type 1289 |
| 368 | #define _tmp_135_type 1290 |
| 369 | #define _tmp_136_type 1291 |
| 370 | #define _tmp_137_type 1292 |
| 371 | #define _tmp_138_type 1293 |
| 372 | #define _tmp_139_type 1294 |
| 373 | #define _tmp_140_type 1295 |
| 374 | #define _tmp_141_type 1296 |
| 375 | #define _tmp_142_type 1297 |
| 376 | #define _tmp_143_type 1298 |
| 377 | #define _tmp_144_type 1299 |
| 378 | #define _tmp_145_type 1300 |
| 379 | #define _loop1_146_type 1301 |
| 380 | #define _tmp_147_type 1302 |
| 381 | #define _tmp_148_type 1303 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 382 | |
| 383 | static mod_ty file_rule(Parser *p); |
| 384 | static mod_ty interactive_rule(Parser *p); |
| 385 | static mod_ty eval_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 386 | static mod_ty func_type_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 387 | static expr_ty fstring_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 388 | static asdl_seq* type_expressions_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 389 | static asdl_seq* statements_rule(Parser *p); |
| 390 | static asdl_seq* statement_rule(Parser *p); |
| 391 | static asdl_seq* statement_newline_rule(Parser *p); |
| 392 | static asdl_seq* simple_stmt_rule(Parser *p); |
| 393 | static stmt_ty small_stmt_rule(Parser *p); |
| 394 | static stmt_ty compound_stmt_rule(Parser *p); |
Lysandros Nikolaou | 999ec9a | 2020-05-06 21:11:04 +0300 | [diff] [blame] | 395 | static stmt_ty assignment_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 396 | static AugOperator* augassign_rule(Parser *p); |
| 397 | static stmt_ty global_stmt_rule(Parser *p); |
| 398 | static stmt_ty nonlocal_stmt_rule(Parser *p); |
| 399 | static stmt_ty yield_stmt_rule(Parser *p); |
| 400 | static stmt_ty assert_stmt_rule(Parser *p); |
| 401 | static stmt_ty del_stmt_rule(Parser *p); |
| 402 | static stmt_ty import_stmt_rule(Parser *p); |
| 403 | static stmt_ty import_name_rule(Parser *p); |
| 404 | static stmt_ty import_from_rule(Parser *p); |
| 405 | static asdl_seq* import_from_targets_rule(Parser *p); |
| 406 | static asdl_seq* import_from_as_names_rule(Parser *p); |
| 407 | static alias_ty import_from_as_name_rule(Parser *p); |
| 408 | static asdl_seq* dotted_as_names_rule(Parser *p); |
| 409 | static alias_ty dotted_as_name_rule(Parser *p); |
| 410 | static expr_ty dotted_name_rule(Parser *p); |
| 411 | static stmt_ty if_stmt_rule(Parser *p); |
| 412 | static stmt_ty elif_stmt_rule(Parser *p); |
| 413 | static asdl_seq* else_block_rule(Parser *p); |
| 414 | static stmt_ty while_stmt_rule(Parser *p); |
| 415 | static stmt_ty for_stmt_rule(Parser *p); |
| 416 | static stmt_ty with_stmt_rule(Parser *p); |
| 417 | static withitem_ty with_item_rule(Parser *p); |
| 418 | static stmt_ty try_stmt_rule(Parser *p); |
| 419 | static excepthandler_ty except_block_rule(Parser *p); |
| 420 | static asdl_seq* finally_block_rule(Parser *p); |
| 421 | static stmt_ty return_stmt_rule(Parser *p); |
| 422 | static stmt_ty raise_stmt_rule(Parser *p); |
| 423 | static stmt_ty function_def_rule(Parser *p); |
| 424 | static stmt_ty function_def_raw_rule(Parser *p); |
Pablo Galindo | d955241 | 2020-05-01 16:32:09 +0100 | [diff] [blame] | 425 | static Token* func_type_comment_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 426 | static arguments_ty params_rule(Parser *p); |
| 427 | static arguments_ty parameters_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 428 | static asdl_seq* slash_no_default_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 429 | static SlashWithDefault* slash_with_default_rule(Parser *p); |
| 430 | static StarEtc* star_etc_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 431 | static arg_ty kwds_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 432 | static arg_ty param_no_default_rule(Parser *p); |
| 433 | static NameDefaultPair* param_with_default_rule(Parser *p); |
| 434 | static NameDefaultPair* param_maybe_default_rule(Parser *p); |
| 435 | static arg_ty param_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 436 | static expr_ty annotation_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 437 | static expr_ty default_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 438 | static asdl_seq* decorators_rule(Parser *p); |
| 439 | static stmt_ty class_def_rule(Parser *p); |
| 440 | static stmt_ty class_def_raw_rule(Parser *p); |
| 441 | static asdl_seq* block_rule(Parser *p); |
| 442 | static asdl_seq* expressions_list_rule(Parser *p); |
| 443 | static expr_ty star_expressions_rule(Parser *p); |
| 444 | static expr_ty star_expression_rule(Parser *p); |
| 445 | static asdl_seq* star_named_expressions_rule(Parser *p); |
| 446 | static expr_ty star_named_expression_rule(Parser *p); |
| 447 | static expr_ty named_expression_rule(Parser *p); |
| 448 | static expr_ty annotated_rhs_rule(Parser *p); |
| 449 | static expr_ty expressions_rule(Parser *p); |
| 450 | static expr_ty expression_rule(Parser *p); |
| 451 | static expr_ty lambdef_rule(Parser *p); |
| 452 | static arguments_ty lambda_parameters_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 453 | static asdl_seq* lambda_slash_no_default_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 454 | static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); |
| 455 | static StarEtc* lambda_star_etc_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 456 | static arg_ty lambda_kwds_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 457 | static arg_ty lambda_param_no_default_rule(Parser *p); |
| 458 | static NameDefaultPair* lambda_param_with_default_rule(Parser *p); |
| 459 | static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p); |
| 460 | static arg_ty lambda_param_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 461 | static expr_ty disjunction_rule(Parser *p); |
| 462 | static expr_ty conjunction_rule(Parser *p); |
| 463 | static expr_ty inversion_rule(Parser *p); |
| 464 | static expr_ty comparison_rule(Parser *p); |
| 465 | static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p); |
| 466 | static CmpopExprPair* eq_bitwise_or_rule(Parser *p); |
| 467 | static CmpopExprPair* noteq_bitwise_or_rule(Parser *p); |
| 468 | static CmpopExprPair* lte_bitwise_or_rule(Parser *p); |
| 469 | static CmpopExprPair* lt_bitwise_or_rule(Parser *p); |
| 470 | static CmpopExprPair* gte_bitwise_or_rule(Parser *p); |
| 471 | static CmpopExprPair* gt_bitwise_or_rule(Parser *p); |
| 472 | static CmpopExprPair* notin_bitwise_or_rule(Parser *p); |
| 473 | static CmpopExprPair* in_bitwise_or_rule(Parser *p); |
| 474 | static CmpopExprPair* isnot_bitwise_or_rule(Parser *p); |
| 475 | static CmpopExprPair* is_bitwise_or_rule(Parser *p); |
| 476 | static expr_ty bitwise_or_rule(Parser *p); |
| 477 | static expr_ty bitwise_xor_rule(Parser *p); |
| 478 | static expr_ty bitwise_and_rule(Parser *p); |
| 479 | static expr_ty shift_expr_rule(Parser *p); |
| 480 | static expr_ty sum_rule(Parser *p); |
| 481 | static expr_ty term_rule(Parser *p); |
| 482 | static expr_ty factor_rule(Parser *p); |
| 483 | static expr_ty power_rule(Parser *p); |
| 484 | static expr_ty await_primary_rule(Parser *p); |
| 485 | static expr_ty primary_rule(Parser *p); |
| 486 | static expr_ty slices_rule(Parser *p); |
| 487 | static expr_ty slice_rule(Parser *p); |
| 488 | static expr_ty atom_rule(Parser *p); |
| 489 | static expr_ty strings_rule(Parser *p); |
| 490 | static expr_ty list_rule(Parser *p); |
| 491 | static expr_ty listcomp_rule(Parser *p); |
| 492 | static expr_ty tuple_rule(Parser *p); |
| 493 | static expr_ty group_rule(Parser *p); |
| 494 | static expr_ty genexp_rule(Parser *p); |
| 495 | static expr_ty set_rule(Parser *p); |
| 496 | static expr_ty setcomp_rule(Parser *p); |
| 497 | static expr_ty dict_rule(Parser *p); |
| 498 | static expr_ty dictcomp_rule(Parser *p); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 499 | static asdl_seq* double_starred_kvpairs_rule(Parser *p); |
| 500 | static KeyValuePair* double_starred_kvpair_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 501 | static KeyValuePair* kvpair_rule(Parser *p); |
| 502 | static asdl_seq* for_if_clauses_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 503 | static comprehension_ty for_if_clause_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 504 | static expr_ty yield_expr_rule(Parser *p); |
| 505 | static expr_ty arguments_rule(Parser *p); |
| 506 | static expr_ty args_rule(Parser *p); |
| 507 | static asdl_seq* kwargs_rule(Parser *p); |
| 508 | static expr_ty starred_expression_rule(Parser *p); |
| 509 | static KeywordOrStarred* kwarg_or_starred_rule(Parser *p); |
| 510 | static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p); |
| 511 | static expr_ty star_targets_rule(Parser *p); |
| 512 | static asdl_seq* star_targets_seq_rule(Parser *p); |
| 513 | static expr_ty star_target_rule(Parser *p); |
| 514 | static expr_ty star_atom_rule(Parser *p); |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 515 | static expr_ty single_target_rule(Parser *p); |
| 516 | static expr_ty single_subscript_attribute_target_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 517 | static asdl_seq* del_targets_rule(Parser *p); |
| 518 | static expr_ty del_target_rule(Parser *p); |
| 519 | static expr_ty del_t_atom_rule(Parser *p); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 520 | static void *del_target_end_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 521 | static asdl_seq* targets_rule(Parser *p); |
| 522 | static expr_ty target_rule(Parser *p); |
| 523 | static expr_ty t_primary_rule(Parser *p); |
| 524 | static void *t_lookahead_rule(Parser *p); |
| 525 | static expr_ty t_atom_rule(Parser *p); |
| 526 | static void *incorrect_arguments_rule(Parser *p); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 527 | static void *invalid_kwarg_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 528 | static void *invalid_named_expression_rule(Parser *p); |
| 529 | static void *invalid_assignment_rule(Parser *p); |
| 530 | static void *invalid_block_rule(Parser *p); |
| 531 | static void *invalid_comprehension_rule(Parser *p); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 532 | static void *invalid_dict_comprehension_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 533 | static void *invalid_parameters_rule(Parser *p); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 534 | static void *invalid_star_etc_rule(Parser *p); |
| 535 | static void *invalid_lambda_star_etc_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 536 | static void *invalid_double_type_comments_rule(Parser *p); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 537 | static void *invalid_del_target_rule(Parser *p); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 538 | static void *invalid_import_from_targets_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 539 | static asdl_seq *_loop0_1_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 540 | static asdl_seq *_loop0_2_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 541 | static asdl_seq *_loop0_4_rule(Parser *p); |
| 542 | static asdl_seq *_gather_3_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 543 | static asdl_seq *_loop0_6_rule(Parser *p); |
| 544 | static asdl_seq *_gather_5_rule(Parser *p); |
| 545 | static asdl_seq *_loop0_8_rule(Parser *p); |
| 546 | static asdl_seq *_gather_7_rule(Parser *p); |
| 547 | static asdl_seq *_loop0_10_rule(Parser *p); |
| 548 | static asdl_seq *_gather_9_rule(Parser *p); |
| 549 | static asdl_seq *_loop1_11_rule(Parser *p); |
| 550 | static asdl_seq *_loop0_13_rule(Parser *p); |
| 551 | static asdl_seq *_gather_12_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 552 | static void *_tmp_14_rule(Parser *p); |
| 553 | static void *_tmp_15_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 554 | static void *_tmp_16_rule(Parser *p); |
| 555 | static void *_tmp_17_rule(Parser *p); |
| 556 | static void *_tmp_18_rule(Parser *p); |
| 557 | static void *_tmp_19_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 558 | static void *_tmp_20_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 559 | static void *_tmp_21_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 560 | static asdl_seq *_loop1_22_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 561 | static void *_tmp_23_rule(Parser *p); |
| 562 | static void *_tmp_24_rule(Parser *p); |
| 563 | static asdl_seq *_loop0_26_rule(Parser *p); |
| 564 | static asdl_seq *_gather_25_rule(Parser *p); |
| 565 | static asdl_seq *_loop0_28_rule(Parser *p); |
| 566 | static asdl_seq *_gather_27_rule(Parser *p); |
| 567 | static void *_tmp_29_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 568 | static asdl_seq *_loop0_30_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 569 | static asdl_seq *_loop1_31_rule(Parser *p); |
| 570 | static asdl_seq *_loop0_33_rule(Parser *p); |
| 571 | static asdl_seq *_gather_32_rule(Parser *p); |
| 572 | static void *_tmp_34_rule(Parser *p); |
| 573 | static asdl_seq *_loop0_36_rule(Parser *p); |
| 574 | static asdl_seq *_gather_35_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 575 | static void *_tmp_37_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 576 | static asdl_seq *_loop0_39_rule(Parser *p); |
| 577 | static asdl_seq *_gather_38_rule(Parser *p); |
| 578 | static asdl_seq *_loop0_41_rule(Parser *p); |
| 579 | static asdl_seq *_gather_40_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 580 | static asdl_seq *_loop0_43_rule(Parser *p); |
| 581 | static asdl_seq *_gather_42_rule(Parser *p); |
| 582 | static asdl_seq *_loop0_45_rule(Parser *p); |
| 583 | static asdl_seq *_gather_44_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 584 | static void *_tmp_46_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 585 | static asdl_seq *_loop1_47_rule(Parser *p); |
| 586 | static void *_tmp_48_rule(Parser *p); |
| 587 | static void *_tmp_49_rule(Parser *p); |
| 588 | static void *_tmp_50_rule(Parser *p); |
| 589 | static void *_tmp_51_rule(Parser *p); |
| 590 | static void *_tmp_52_rule(Parser *p); |
| 591 | static asdl_seq *_loop0_53_rule(Parser *p); |
| 592 | static asdl_seq *_loop0_54_rule(Parser *p); |
| 593 | static asdl_seq *_loop0_55_rule(Parser *p); |
| 594 | static asdl_seq *_loop1_56_rule(Parser *p); |
| 595 | static asdl_seq *_loop0_57_rule(Parser *p); |
| 596 | static asdl_seq *_loop1_58_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 597 | static asdl_seq *_loop1_59_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 598 | static asdl_seq *_loop1_60_rule(Parser *p); |
| 599 | static asdl_seq *_loop0_61_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 600 | static asdl_seq *_loop1_62_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 601 | static asdl_seq *_loop0_63_rule(Parser *p); |
| 602 | static asdl_seq *_loop1_64_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 603 | static asdl_seq *_loop0_65_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 604 | static asdl_seq *_loop1_66_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 605 | static asdl_seq *_loop1_67_rule(Parser *p); |
| 606 | static void *_tmp_68_rule(Parser *p); |
| 607 | static asdl_seq *_loop0_70_rule(Parser *p); |
| 608 | static asdl_seq *_gather_69_rule(Parser *p); |
| 609 | static asdl_seq *_loop1_71_rule(Parser *p); |
| 610 | static asdl_seq *_loop0_73_rule(Parser *p); |
| 611 | static asdl_seq *_gather_72_rule(Parser *p); |
| 612 | static asdl_seq *_loop1_74_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 613 | static asdl_seq *_loop0_75_rule(Parser *p); |
| 614 | static asdl_seq *_loop0_76_rule(Parser *p); |
| 615 | static asdl_seq *_loop0_77_rule(Parser *p); |
| 616 | static asdl_seq *_loop1_78_rule(Parser *p); |
| 617 | static asdl_seq *_loop0_79_rule(Parser *p); |
| 618 | static asdl_seq *_loop1_80_rule(Parser *p); |
| 619 | static asdl_seq *_loop1_81_rule(Parser *p); |
| 620 | static asdl_seq *_loop1_82_rule(Parser *p); |
| 621 | static asdl_seq *_loop0_83_rule(Parser *p); |
| 622 | static asdl_seq *_loop1_84_rule(Parser *p); |
| 623 | static asdl_seq *_loop0_85_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 624 | static asdl_seq *_loop1_86_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 625 | static asdl_seq *_loop0_87_rule(Parser *p); |
| 626 | static asdl_seq *_loop1_88_rule(Parser *p); |
| 627 | static asdl_seq *_loop1_89_rule(Parser *p); |
| 628 | static asdl_seq *_loop1_90_rule(Parser *p); |
| 629 | static asdl_seq *_loop1_91_rule(Parser *p); |
| 630 | static void *_tmp_92_rule(Parser *p); |
| 631 | static asdl_seq *_loop0_94_rule(Parser *p); |
| 632 | static asdl_seq *_gather_93_rule(Parser *p); |
| 633 | static void *_tmp_95_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 634 | static void *_tmp_96_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 635 | static void *_tmp_97_rule(Parser *p); |
| 636 | static void *_tmp_98_rule(Parser *p); |
| 637 | static asdl_seq *_loop1_99_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 638 | static void *_tmp_100_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 639 | static void *_tmp_101_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 640 | static asdl_seq *_loop0_103_rule(Parser *p); |
| 641 | static asdl_seq *_gather_102_rule(Parser *p); |
| 642 | static asdl_seq *_loop1_104_rule(Parser *p); |
| 643 | static asdl_seq *_loop0_105_rule(Parser *p); |
| 644 | static asdl_seq *_loop0_106_rule(Parser *p); |
| 645 | static void *_tmp_107_rule(Parser *p); |
| 646 | static void *_tmp_108_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 647 | static asdl_seq *_loop0_110_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 648 | static asdl_seq *_gather_109_rule(Parser *p); |
| 649 | static asdl_seq *_loop0_112_rule(Parser *p); |
| 650 | static asdl_seq *_gather_111_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 651 | static asdl_seq *_loop0_114_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 652 | static asdl_seq *_gather_113_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 653 | static asdl_seq *_loop0_116_rule(Parser *p); |
| 654 | static asdl_seq *_gather_115_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 655 | static asdl_seq *_loop0_117_rule(Parser *p); |
| 656 | static asdl_seq *_loop0_119_rule(Parser *p); |
| 657 | static asdl_seq *_gather_118_rule(Parser *p); |
| 658 | static void *_tmp_120_rule(Parser *p); |
| 659 | static asdl_seq *_loop0_122_rule(Parser *p); |
| 660 | static asdl_seq *_gather_121_rule(Parser *p); |
| 661 | static asdl_seq *_loop0_124_rule(Parser *p); |
| 662 | static asdl_seq *_gather_123_rule(Parser *p); |
| 663 | static void *_tmp_125_rule(Parser *p); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 664 | static asdl_seq *_loop0_126_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 665 | static void *_tmp_127_rule(Parser *p); |
| 666 | static void *_tmp_128_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 667 | static void *_tmp_129_rule(Parser *p); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 668 | static void *_tmp_130_rule(Parser *p); |
| 669 | static asdl_seq *_loop0_131_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 670 | static void *_tmp_132_rule(Parser *p); |
| 671 | static void *_tmp_133_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 672 | static void *_tmp_134_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 673 | static void *_tmp_135_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 674 | static void *_tmp_136_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 675 | static void *_tmp_137_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 676 | static void *_tmp_138_rule(Parser *p); |
| 677 | static void *_tmp_139_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 678 | static void *_tmp_140_rule(Parser *p); |
| 679 | static void *_tmp_141_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 680 | static void *_tmp_142_rule(Parser *p); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 681 | static void *_tmp_143_rule(Parser *p); |
| 682 | static void *_tmp_144_rule(Parser *p); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 683 | static void *_tmp_145_rule(Parser *p); |
| 684 | static asdl_seq *_loop1_146_rule(Parser *p); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 685 | static void *_tmp_147_rule(Parser *p); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 686 | static void *_tmp_148_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 687 | |
| 688 | |
| 689 | // file: statements? $ |
| 690 | static mod_ty |
| 691 | file_rule(Parser *p) |
| 692 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 693 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 694 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 695 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 696 | return NULL; |
| 697 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 698 | mod_ty _res = NULL; |
| 699 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 700 | { // statements? $ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 701 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 702 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 703 | return NULL; |
| 704 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 705 | D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 706 | void *a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 707 | Token * endmarker_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 708 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 709 | (a = statements_rule(p), 1) // statements? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 710 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 711 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 712 | ) |
| 713 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 714 | D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 715 | _res = _PyPegen_make_module ( p , a ); |
| 716 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 717 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 718 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 719 | return NULL; |
| 720 | } |
| 721 | goto done; |
| 722 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 723 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 724 | D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ', |
| 725 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 726 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 727 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 728 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 729 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 730 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 731 | } |
| 732 | |
| 733 | // interactive: statement_newline |
| 734 | static mod_ty |
| 735 | interactive_rule(Parser *p) |
| 736 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 737 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 738 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 739 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 740 | return NULL; |
| 741 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 742 | mod_ty _res = NULL; |
| 743 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 744 | { // statement_newline |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 745 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 746 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 747 | return NULL; |
| 748 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 749 | D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 750 | asdl_seq* a; |
| 751 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 752 | (a = statement_newline_rule(p)) // statement_newline |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 753 | ) |
| 754 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 755 | D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 756 | _res = Interactive ( a , p -> arena ); |
| 757 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 758 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 759 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 760 | return NULL; |
| 761 | } |
| 762 | goto done; |
| 763 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 764 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 765 | D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ', |
| 766 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 767 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 768 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 769 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 770 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 771 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 772 | } |
| 773 | |
| 774 | // eval: expressions NEWLINE* $ |
| 775 | static mod_ty |
| 776 | eval_rule(Parser *p) |
| 777 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 778 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 779 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 780 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 781 | return NULL; |
| 782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 783 | mod_ty _res = NULL; |
| 784 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 785 | { // expressions NEWLINE* $ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 786 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 787 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 788 | return NULL; |
| 789 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 790 | D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 791 | asdl_seq * _loop0_1_var; |
| 792 | expr_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 793 | Token * endmarker_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 794 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 795 | (a = expressions_rule(p)) // expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 796 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 797 | (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 798 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 799 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 800 | ) |
| 801 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 802 | D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 803 | _res = Expression ( a , p -> arena ); |
| 804 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 805 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 806 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 807 | return NULL; |
| 808 | } |
| 809 | goto done; |
| 810 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 811 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 812 | D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ', |
| 813 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 814 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 815 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 816 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 817 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 818 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 819 | } |
| 820 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 821 | // func_type: '(' type_expressions? ')' '->' expression NEWLINE* $ |
| 822 | static mod_ty |
| 823 | func_type_rule(Parser *p) |
| 824 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 825 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 826 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 827 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 828 | return NULL; |
| 829 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 830 | mod_ty _res = NULL; |
| 831 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 832 | { // '(' type_expressions? ')' '->' expression NEWLINE* $ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 833 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 834 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 835 | return NULL; |
| 836 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 837 | D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 838 | Token * _literal; |
| 839 | Token * _literal_1; |
| 840 | Token * _literal_2; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 841 | asdl_seq * _loop0_2_var; |
| 842 | void *a; |
| 843 | expr_ty b; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 844 | Token * endmarker_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 845 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 846 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 847 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 848 | (a = type_expressions_rule(p), 1) // type_expressions? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 849 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 850 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 851 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 852 | (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 853 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 854 | (b = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 855 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 856 | (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 857 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 858 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 859 | ) |
| 860 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 861 | D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 862 | _res = FunctionType ( a , b , p -> arena ); |
| 863 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 864 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 865 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 866 | return NULL; |
| 867 | } |
| 868 | goto done; |
| 869 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 870 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 871 | D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ', |
| 872 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 873 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 874 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 875 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 876 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 877 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 878 | } |
| 879 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 880 | // fstring: star_expressions |
| 881 | static expr_ty |
| 882 | fstring_rule(Parser *p) |
| 883 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 884 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 885 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 886 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 887 | return NULL; |
| 888 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 889 | expr_ty _res = NULL; |
| 890 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 891 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 892 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 893 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 894 | return NULL; |
| 895 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 896 | D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 897 | expr_ty star_expressions_var; |
| 898 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 899 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 900 | ) |
| 901 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 902 | D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 903 | _res = star_expressions_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 904 | goto done; |
| 905 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 906 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 907 | D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ', |
| 908 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 909 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 910 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 911 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 912 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 913 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 914 | } |
| 915 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 916 | // type_expressions: |
| 917 | // | ','.expression+ ',' '*' expression ',' '**' expression |
| 918 | // | ','.expression+ ',' '*' expression |
| 919 | // | ','.expression+ ',' '**' expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 920 | // | '*' expression ',' '**' expression |
| 921 | // | '*' expression |
| 922 | // | '**' expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 923 | // | ','.expression+ |
| 924 | static asdl_seq* |
| 925 | type_expressions_rule(Parser *p) |
| 926 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 927 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 928 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 929 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 930 | return NULL; |
| 931 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 932 | asdl_seq* _res = NULL; |
| 933 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 934 | { // ','.expression+ ',' '*' expression ',' '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 935 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 936 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 937 | return NULL; |
| 938 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 939 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 940 | Token * _literal; |
| 941 | Token * _literal_1; |
| 942 | Token * _literal_2; |
| 943 | Token * _literal_3; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 944 | asdl_seq * a; |
| 945 | expr_ty b; |
| 946 | expr_ty c; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 947 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 948 | (a = _gather_3_rule(p)) // ','.expression+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 949 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 950 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 951 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 952 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 953 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 954 | (b = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 955 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 956 | (_literal_2 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 957 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 958 | (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 959 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 960 | (c = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 961 | ) |
| 962 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 963 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 964 | _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c ); |
| 965 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 966 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 967 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 968 | return NULL; |
| 969 | } |
| 970 | goto done; |
| 971 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 972 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 973 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 974 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 975 | } |
| 976 | { // ','.expression+ ',' '*' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 977 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 978 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 979 | return NULL; |
| 980 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 981 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 982 | Token * _literal; |
| 983 | Token * _literal_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 984 | asdl_seq * a; |
| 985 | expr_ty b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 986 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 987 | (a = _gather_5_rule(p)) // ','.expression+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 988 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 989 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 990 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 991 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 992 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 993 | (b = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 994 | ) |
| 995 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 996 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 997 | _res = _PyPegen_seq_append_to_end ( p , a , b ); |
| 998 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 999 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1000 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1001 | return NULL; |
| 1002 | } |
| 1003 | goto done; |
| 1004 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1005 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1006 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1007 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1008 | } |
| 1009 | { // ','.expression+ ',' '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1010 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1011 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1012 | return NULL; |
| 1013 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1014 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1015 | Token * _literal; |
| 1016 | Token * _literal_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1017 | asdl_seq * a; |
| 1018 | expr_ty b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1019 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1020 | (a = _gather_7_rule(p)) // ','.expression+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1021 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1022 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1023 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1024 | (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1025 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1026 | (b = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1027 | ) |
| 1028 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1029 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1030 | _res = _PyPegen_seq_append_to_end ( p , a , b ); |
| 1031 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1032 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1033 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1034 | return NULL; |
| 1035 | } |
| 1036 | goto done; |
| 1037 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1038 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1039 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1040 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1041 | } |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1042 | { // '*' expression ',' '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1043 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1044 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1045 | return NULL; |
| 1046 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1047 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1048 | Token * _literal; |
| 1049 | Token * _literal_1; |
| 1050 | Token * _literal_2; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1051 | expr_ty a; |
| 1052 | expr_ty b; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1053 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1054 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1055 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1056 | (a = expression_rule(p)) // expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1057 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1058 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1059 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1060 | (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1061 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1062 | (b = expression_rule(p)) // expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1063 | ) |
| 1064 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1065 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1066 | _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b ); |
| 1067 | if (_res == NULL && PyErr_Occurred()) { |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1068 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1069 | D(p->level--); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1070 | return NULL; |
| 1071 | } |
| 1072 | goto done; |
| 1073 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1074 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1075 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1076 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression")); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1077 | } |
| 1078 | { // '*' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1079 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1080 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1081 | return NULL; |
| 1082 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1083 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1084 | Token * _literal; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1085 | expr_ty a; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1086 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1087 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1088 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1089 | (a = expression_rule(p)) // expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1090 | ) |
| 1091 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1092 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1093 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1094 | if (_res == NULL && PyErr_Occurred()) { |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1095 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1096 | D(p->level--); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1097 | return NULL; |
| 1098 | } |
| 1099 | goto done; |
| 1100 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1101 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1102 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1103 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1104 | } |
| 1105 | { // '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1106 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1107 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1108 | return NULL; |
| 1109 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1110 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1111 | Token * _literal; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1112 | expr_ty a; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1113 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1114 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1115 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1116 | (a = expression_rule(p)) // expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1117 | ) |
| 1118 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1119 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1120 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1121 | if (_res == NULL && PyErr_Occurred()) { |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1122 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1123 | D(p->level--); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1124 | return NULL; |
| 1125 | } |
| 1126 | goto done; |
| 1127 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1128 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1129 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1130 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1131 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1132 | { // ','.expression+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1133 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1134 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1135 | return NULL; |
| 1136 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1137 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1138 | asdl_seq * _gather_9_var; |
| 1139 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1140 | (_gather_9_var = _gather_9_rule(p)) // ','.expression+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1141 | ) |
| 1142 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1143 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1144 | _res = _gather_9_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1145 | goto done; |
| 1146 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1147 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1148 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1149 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1150 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1151 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1152 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1153 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1154 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1155 | } |
| 1156 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1157 | // statements: statement+ |
| 1158 | static asdl_seq* |
| 1159 | statements_rule(Parser *p) |
| 1160 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1161 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1162 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1163 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1164 | return NULL; |
| 1165 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1166 | asdl_seq* _res = NULL; |
| 1167 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1168 | { // statement+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1169 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1170 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1171 | return NULL; |
| 1172 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1173 | D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1174 | asdl_seq * a; |
| 1175 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1176 | (a = _loop1_11_rule(p)) // statement+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1177 | ) |
| 1178 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1179 | D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1180 | _res = _PyPegen_seq_flatten ( p , a ); |
| 1181 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1182 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1183 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1184 | return NULL; |
| 1185 | } |
| 1186 | goto done; |
| 1187 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1188 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1189 | D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ', |
| 1190 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1191 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1192 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1193 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1194 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1195 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1196 | } |
| 1197 | |
| 1198 | // statement: compound_stmt | simple_stmt |
| 1199 | static asdl_seq* |
| 1200 | statement_rule(Parser *p) |
| 1201 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1202 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1203 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1204 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1205 | return NULL; |
| 1206 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1207 | asdl_seq* _res = NULL; |
| 1208 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1209 | { // compound_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1210 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1211 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1212 | return NULL; |
| 1213 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1214 | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1215 | stmt_ty a; |
| 1216 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1217 | (a = compound_stmt_rule(p)) // compound_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1218 | ) |
| 1219 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1220 | D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1221 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1222 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1223 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1224 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1225 | return NULL; |
| 1226 | } |
| 1227 | goto done; |
| 1228 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1229 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1230 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
| 1231 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1232 | } |
| 1233 | { // simple_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1234 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1235 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1236 | return NULL; |
| 1237 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1238 | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1239 | asdl_seq* simple_stmt_var; |
| 1240 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1241 | (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1242 | ) |
| 1243 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1244 | D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1245 | _res = simple_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1246 | goto done; |
| 1247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1248 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1249 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
| 1250 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1251 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1252 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1253 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1254 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1255 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1256 | } |
| 1257 | |
| 1258 | // statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $ |
| 1259 | static asdl_seq* |
| 1260 | statement_newline_rule(Parser *p) |
| 1261 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1262 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1263 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1264 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1265 | return NULL; |
| 1266 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1267 | asdl_seq* _res = NULL; |
| 1268 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1269 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 1270 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1271 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1272 | return NULL; |
| 1273 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1274 | int _start_lineno = p->tokens[_mark]->lineno; |
| 1275 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 1276 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 1277 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1278 | { // compound_stmt NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1279 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1280 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1281 | return NULL; |
| 1282 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1283 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1284 | stmt_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 1285 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1286 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1287 | (a = compound_stmt_rule(p)) // compound_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1288 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1289 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1290 | ) |
| 1291 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1292 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1293 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1294 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1295 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1296 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1297 | return NULL; |
| 1298 | } |
| 1299 | goto done; |
| 1300 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1301 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1302 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1303 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1304 | } |
| 1305 | { // simple_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1306 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1307 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1308 | return NULL; |
| 1309 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1310 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1311 | asdl_seq* simple_stmt_var; |
| 1312 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1313 | (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1314 | ) |
| 1315 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1316 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1317 | _res = simple_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1318 | goto done; |
| 1319 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1320 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1321 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1322 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1323 | } |
| 1324 | { // NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1325 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1326 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1327 | return NULL; |
| 1328 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1329 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 1330 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1331 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1332 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1333 | ) |
| 1334 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1335 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1336 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1337 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1338 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1339 | return NULL; |
| 1340 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1341 | int _end_lineno = _token->end_lineno; |
| 1342 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1343 | int _end_col_offset = _token->end_col_offset; |
| 1344 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1345 | _res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) ); |
| 1346 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1347 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1348 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1349 | return NULL; |
| 1350 | } |
| 1351 | goto done; |
| 1352 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1353 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1354 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1355 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1356 | } |
| 1357 | { // $ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1358 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1359 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1360 | return NULL; |
| 1361 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1362 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 1363 | Token * endmarker_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1364 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1365 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1366 | ) |
| 1367 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1368 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1369 | _res = _PyPegen_interactive_exit ( p ); |
| 1370 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1371 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1372 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1373 | return NULL; |
| 1374 | } |
| 1375 | goto done; |
| 1376 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1377 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1378 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1379 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1380 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1381 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1382 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1383 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1384 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1385 | } |
| 1386 | |
| 1387 | // simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE |
| 1388 | static asdl_seq* |
| 1389 | simple_stmt_rule(Parser *p) |
| 1390 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1391 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1392 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1393 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1394 | return NULL; |
| 1395 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1396 | asdl_seq* _res = NULL; |
| 1397 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1398 | { // small_stmt !';' NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1399 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1400 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1401 | return NULL; |
| 1402 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1403 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1404 | stmt_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 1405 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1406 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1407 | (a = small_stmt_rule(p)) // small_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1408 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1409 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1410 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1411 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1412 | ) |
| 1413 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1414 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1415 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1416 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1417 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1418 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1419 | return NULL; |
| 1420 | } |
| 1421 | goto done; |
| 1422 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1423 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1424 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1425 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1426 | } |
| 1427 | { // ';'.small_stmt+ ';'? NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1428 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1429 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1430 | return NULL; |
| 1431 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1432 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1433 | void *_opt_var; |
| 1434 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1435 | asdl_seq * a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 1436 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1437 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1438 | (a = _gather_12_rule(p)) // ';'.small_stmt+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1439 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1440 | (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1441 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1442 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1443 | ) |
| 1444 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1445 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1446 | _res = a; |
| 1447 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1448 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1449 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1450 | return NULL; |
| 1451 | } |
| 1452 | goto done; |
| 1453 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1454 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1455 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1456 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1457 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1458 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1459 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1460 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1461 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1462 | } |
| 1463 | |
| 1464 | // small_stmt: |
| 1465 | // | assignment |
| 1466 | // | star_expressions |
| 1467 | // | &'return' return_stmt |
| 1468 | // | &('import' | 'from') import_stmt |
| 1469 | // | &'raise' raise_stmt |
| 1470 | // | 'pass' |
| 1471 | // | &'del' del_stmt |
| 1472 | // | &'yield' yield_stmt |
| 1473 | // | &'assert' assert_stmt |
| 1474 | // | 'break' |
| 1475 | // | 'continue' |
| 1476 | // | &'global' global_stmt |
| 1477 | // | &'nonlocal' nonlocal_stmt |
| 1478 | static stmt_ty |
| 1479 | small_stmt_rule(Parser *p) |
| 1480 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1481 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1482 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1483 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1484 | return NULL; |
| 1485 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1486 | stmt_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1487 | if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) { |
| 1488 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1489 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1490 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1491 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1492 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 1493 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1494 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1495 | return NULL; |
| 1496 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1497 | int _start_lineno = p->tokens[_mark]->lineno; |
| 1498 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 1499 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 1500 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1501 | { // assignment |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1502 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1503 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1504 | return NULL; |
| 1505 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1506 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment")); |
Lysandros Nikolaou | 999ec9a | 2020-05-06 21:11:04 +0300 | [diff] [blame] | 1507 | stmt_ty assignment_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1508 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1509 | (assignment_var = assignment_rule(p)) // assignment |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1510 | ) |
| 1511 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1512 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1513 | _res = assignment_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1514 | goto done; |
| 1515 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1516 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1517 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1518 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1519 | } |
| 1520 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1521 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1522 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1523 | return NULL; |
| 1524 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1525 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1526 | expr_ty e; |
| 1527 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1528 | (e = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1529 | ) |
| 1530 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1531 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1532 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1533 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1534 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1535 | return NULL; |
| 1536 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1537 | int _end_lineno = _token->end_lineno; |
| 1538 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1539 | int _end_col_offset = _token->end_col_offset; |
| 1540 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1541 | _res = _Py_Expr ( e , EXTRA ); |
| 1542 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1543 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1544 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1545 | return NULL; |
| 1546 | } |
| 1547 | goto done; |
| 1548 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1549 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1550 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1551 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1552 | } |
| 1553 | { // &'return' return_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1554 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1555 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1556 | return NULL; |
| 1557 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1558 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1559 | stmt_ty return_stmt_var; |
| 1560 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1561 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1562 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1563 | (return_stmt_var = return_stmt_rule(p)) // return_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1564 | ) |
| 1565 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1566 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1567 | _res = return_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1568 | goto done; |
| 1569 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1570 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1571 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1572 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1573 | } |
| 1574 | { // &('import' | 'from') import_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1575 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1576 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1577 | return NULL; |
| 1578 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1579 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1580 | stmt_ty import_stmt_var; |
| 1581 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1582 | _PyPegen_lookahead(1, _tmp_14_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1583 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1584 | (import_stmt_var = import_stmt_rule(p)) // import_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1585 | ) |
| 1586 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1587 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1588 | _res = import_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1589 | goto done; |
| 1590 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1591 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1592 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1593 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1594 | } |
| 1595 | { // &'raise' raise_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1596 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1597 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1598 | return NULL; |
| 1599 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1600 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1601 | stmt_ty raise_stmt_var; |
| 1602 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1603 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1604 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1605 | (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1606 | ) |
| 1607 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1608 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1609 | _res = raise_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1610 | goto done; |
| 1611 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1612 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1613 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1614 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1615 | } |
| 1616 | { // 'pass' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1617 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1618 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1619 | return NULL; |
| 1620 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1621 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1622 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1623 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1624 | (_keyword = _PyPegen_expect_token(p, 502)) // token='pass' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1625 | ) |
| 1626 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1627 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1628 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1629 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1630 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1631 | return NULL; |
| 1632 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1633 | int _end_lineno = _token->end_lineno; |
| 1634 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1635 | int _end_col_offset = _token->end_col_offset; |
| 1636 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1637 | _res = _Py_Pass ( EXTRA ); |
| 1638 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1639 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1640 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1641 | return NULL; |
| 1642 | } |
| 1643 | goto done; |
| 1644 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1645 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1646 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1647 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1648 | } |
| 1649 | { // &'del' del_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1650 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1651 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1652 | return NULL; |
| 1653 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1654 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1655 | stmt_ty del_stmt_var; |
| 1656 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1657 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1658 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1659 | (del_stmt_var = del_stmt_rule(p)) // del_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1660 | ) |
| 1661 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1662 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1663 | _res = del_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1664 | goto done; |
| 1665 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1666 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1667 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1668 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1669 | } |
| 1670 | { // &'yield' yield_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1671 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1672 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1673 | return NULL; |
| 1674 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1675 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1676 | stmt_ty yield_stmt_var; |
| 1677 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1678 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1679 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1680 | (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1681 | ) |
| 1682 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1683 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1684 | _res = yield_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1685 | goto done; |
| 1686 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1687 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1688 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1689 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1690 | } |
| 1691 | { // &'assert' assert_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1692 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1693 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1694 | return NULL; |
| 1695 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1696 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1697 | stmt_ty assert_stmt_var; |
| 1698 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1699 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1700 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1701 | (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1702 | ) |
| 1703 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1704 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1705 | _res = assert_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1706 | goto done; |
| 1707 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1708 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1709 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1710 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1711 | } |
| 1712 | { // 'break' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1713 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1714 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1715 | return NULL; |
| 1716 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1717 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1718 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1719 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1720 | (_keyword = _PyPegen_expect_token(p, 506)) // token='break' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1721 | ) |
| 1722 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1723 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1724 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1725 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1726 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1727 | return NULL; |
| 1728 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1729 | int _end_lineno = _token->end_lineno; |
| 1730 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1731 | int _end_col_offset = _token->end_col_offset; |
| 1732 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1733 | _res = _Py_Break ( EXTRA ); |
| 1734 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1735 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1736 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1737 | return NULL; |
| 1738 | } |
| 1739 | goto done; |
| 1740 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1741 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1742 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1743 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1744 | } |
| 1745 | { // 'continue' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1746 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1747 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1748 | return NULL; |
| 1749 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1750 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1751 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1752 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1753 | (_keyword = _PyPegen_expect_token(p, 507)) // token='continue' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1754 | ) |
| 1755 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1756 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1757 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1758 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1759 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1760 | return NULL; |
| 1761 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1762 | int _end_lineno = _token->end_lineno; |
| 1763 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1764 | int _end_col_offset = _token->end_col_offset; |
| 1765 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1766 | _res = _Py_Continue ( EXTRA ); |
| 1767 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1768 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1769 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1770 | return NULL; |
| 1771 | } |
| 1772 | goto done; |
| 1773 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1774 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1775 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1776 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1777 | } |
| 1778 | { // &'global' global_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1779 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1780 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1781 | return NULL; |
| 1782 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1783 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1784 | stmt_ty global_stmt_var; |
| 1785 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1786 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1787 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1788 | (global_stmt_var = global_stmt_rule(p)) // global_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1789 | ) |
| 1790 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1791 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1792 | _res = global_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1793 | goto done; |
| 1794 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1795 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1796 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1797 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1798 | } |
| 1799 | { // &'nonlocal' nonlocal_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1800 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1801 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1802 | return NULL; |
| 1803 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1804 | D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1805 | stmt_ty nonlocal_stmt_var; |
| 1806 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1807 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1808 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1809 | (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1810 | ) |
| 1811 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1812 | D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1813 | _res = nonlocal_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1814 | goto done; |
| 1815 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1816 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1817 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1818 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1819 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1820 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1821 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1822 | _PyPegen_insert_memo(p, _mark, small_stmt_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1823 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1824 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1825 | } |
| 1826 | |
| 1827 | // compound_stmt: |
| 1828 | // | &('def' | '@' | ASYNC) function_def |
| 1829 | // | &'if' if_stmt |
| 1830 | // | &('class' | '@') class_def |
| 1831 | // | &('with' | ASYNC) with_stmt |
| 1832 | // | &('for' | ASYNC) for_stmt |
| 1833 | // | &'try' try_stmt |
| 1834 | // | &'while' while_stmt |
| 1835 | static stmt_ty |
| 1836 | compound_stmt_rule(Parser *p) |
| 1837 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1838 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1839 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1840 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1841 | return NULL; |
| 1842 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1843 | stmt_ty _res = NULL; |
| 1844 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1845 | { // &('def' | '@' | ASYNC) function_def |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1846 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1847 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1848 | return NULL; |
| 1849 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1850 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1851 | stmt_ty function_def_var; |
| 1852 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1853 | _PyPegen_lookahead(1, _tmp_15_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1854 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1855 | (function_def_var = function_def_rule(p)) // function_def |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1856 | ) |
| 1857 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1858 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1859 | _res = function_def_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1860 | goto done; |
| 1861 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1862 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1863 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1864 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1865 | } |
| 1866 | { // &'if' if_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1867 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1868 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1869 | return NULL; |
| 1870 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1871 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1872 | stmt_ty if_stmt_var; |
| 1873 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1874 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1875 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1876 | (if_stmt_var = if_stmt_rule(p)) // if_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1877 | ) |
| 1878 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1879 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1880 | _res = if_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1881 | goto done; |
| 1882 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1883 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1884 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1885 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1886 | } |
| 1887 | { // &('class' | '@') class_def |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1888 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1889 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1890 | return NULL; |
| 1891 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1892 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1893 | stmt_ty class_def_var; |
| 1894 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1895 | _PyPegen_lookahead(1, _tmp_16_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1896 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1897 | (class_def_var = class_def_rule(p)) // class_def |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1898 | ) |
| 1899 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1900 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1901 | _res = class_def_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1902 | goto done; |
| 1903 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1904 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1905 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1906 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1907 | } |
| 1908 | { // &('with' | ASYNC) with_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1909 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1910 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1911 | return NULL; |
| 1912 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1913 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1914 | stmt_ty with_stmt_var; |
| 1915 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1916 | _PyPegen_lookahead(1, _tmp_17_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1917 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1918 | (with_stmt_var = with_stmt_rule(p)) // with_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1919 | ) |
| 1920 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1921 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1922 | _res = with_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1923 | goto done; |
| 1924 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1925 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1926 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1927 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1928 | } |
| 1929 | { // &('for' | ASYNC) for_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1930 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1931 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1932 | return NULL; |
| 1933 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1934 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1935 | stmt_ty for_stmt_var; |
| 1936 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1937 | _PyPegen_lookahead(1, _tmp_18_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1938 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1939 | (for_stmt_var = for_stmt_rule(p)) // for_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1940 | ) |
| 1941 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1942 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1943 | _res = for_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1944 | goto done; |
| 1945 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1946 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1947 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1948 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1949 | } |
| 1950 | { // &'try' try_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1951 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1952 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1953 | return NULL; |
| 1954 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1955 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1956 | stmt_ty try_stmt_var; |
| 1957 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1958 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1959 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1960 | (try_stmt_var = try_stmt_rule(p)) // try_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1961 | ) |
| 1962 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1963 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1964 | _res = try_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1965 | goto done; |
| 1966 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1967 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1968 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1969 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1970 | } |
| 1971 | { // &'while' while_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1972 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1973 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1974 | return NULL; |
| 1975 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1976 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1977 | stmt_ty while_stmt_var; |
| 1978 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1979 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1980 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1981 | (while_stmt_var = while_stmt_rule(p)) // while_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1982 | ) |
| 1983 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1984 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1985 | _res = while_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1986 | goto done; |
| 1987 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1988 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1989 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1990 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1991 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1992 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1993 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1994 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1995 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1996 | } |
| 1997 | |
| 1998 | // assignment: |
| 1999 | // | NAME ':' expression ['=' annotated_rhs] |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2000 | // | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 2001 | // | ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT? |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2002 | // | single_target augassign (yield_expr | star_expressions) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2003 | // | invalid_assignment |
Lysandros Nikolaou | 999ec9a | 2020-05-06 21:11:04 +0300 | [diff] [blame] | 2004 | static stmt_ty |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2005 | assignment_rule(Parser *p) |
| 2006 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2007 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2008 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2009 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2010 | return NULL; |
| 2011 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2012 | stmt_ty _res = NULL; |
| 2013 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2014 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2015 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2016 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2017 | return NULL; |
| 2018 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2019 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2020 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2021 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2022 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2023 | { // NAME ':' expression ['=' annotated_rhs] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2024 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2025 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2026 | return NULL; |
| 2027 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2028 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2029 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2030 | expr_ty a; |
| 2031 | expr_ty b; |
| 2032 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2033 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2034 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2035 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2036 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2037 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2038 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2039 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2040 | (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2041 | ) |
| 2042 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2043 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2044 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2045 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2046 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2047 | return NULL; |
| 2048 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2049 | int _end_lineno = _token->end_lineno; |
| 2050 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2051 | int _end_col_offset = _token->end_col_offset; |
| 2052 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2053 | _res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) ); |
| 2054 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2055 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2056 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2057 | return NULL; |
| 2058 | } |
| 2059 | goto done; |
| 2060 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2061 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2062 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2063 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2064 | } |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2065 | { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2066 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2067 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2068 | return NULL; |
| 2069 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2070 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2071 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2072 | void *a; |
| 2073 | expr_ty b; |
| 2074 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2075 | if ( |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2076 | (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2077 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2078 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2079 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2080 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2081 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2082 | (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2083 | ) |
| 2084 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2085 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2086 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2087 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2088 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2089 | return NULL; |
| 2090 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2091 | int _end_lineno = _token->end_lineno; |
| 2092 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2093 | int _end_col_offset = _token->end_col_offset; |
| 2094 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2095 | _res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) ); |
| 2096 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2097 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2098 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2099 | return NULL; |
| 2100 | } |
| 2101 | goto done; |
| 2102 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2103 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2104 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2105 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2106 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 2107 | { // ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2108 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2109 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2110 | return NULL; |
| 2111 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2112 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2113 | asdl_seq * a; |
| 2114 | void *b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 2115 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2116 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2117 | (a = _loop1_22_rule(p)) // ((star_targets '='))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2118 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2119 | (b = _tmp_23_rule(p)) // yield_expr | star_expressions |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 2120 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2121 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2122 | ) |
| 2123 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2124 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2125 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2126 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2127 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2128 | return NULL; |
| 2129 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2130 | int _end_lineno = _token->end_lineno; |
| 2131 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2132 | int _end_col_offset = _token->end_col_offset; |
| 2133 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2134 | _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 2135 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2136 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2137 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2138 | return NULL; |
| 2139 | } |
| 2140 | goto done; |
| 2141 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2142 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2143 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2144 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2145 | } |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2146 | { // single_target augassign (yield_expr | star_expressions) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2147 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2148 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2149 | return NULL; |
| 2150 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2151 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign (yield_expr | star_expressions)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2152 | expr_ty a; |
| 2153 | AugOperator* b; |
| 2154 | void *c; |
| 2155 | if ( |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2156 | (a = single_target_rule(p)) // single_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2157 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2158 | (b = augassign_rule(p)) // augassign |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2159 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2160 | (c = _tmp_24_rule(p)) // yield_expr | star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2161 | ) |
| 2162 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2163 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign (yield_expr | star_expressions)")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2164 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2165 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2166 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2167 | return NULL; |
| 2168 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2169 | int _end_lineno = _token->end_lineno; |
| 2170 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2171 | int _end_col_offset = _token->end_col_offset; |
| 2172 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2173 | _res = _Py_AugAssign ( a , b -> kind , c , EXTRA ); |
| 2174 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2175 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2176 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2177 | return NULL; |
| 2178 | } |
| 2179 | goto done; |
| 2180 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2181 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2182 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2183 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign (yield_expr | star_expressions)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2184 | } |
| 2185 | { // invalid_assignment |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2186 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2187 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2188 | return NULL; |
| 2189 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2190 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2191 | void *invalid_assignment_var; |
| 2192 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2193 | (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2194 | ) |
| 2195 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2196 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2197 | _res = invalid_assignment_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2198 | goto done; |
| 2199 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2200 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2201 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2202 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2203 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2204 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2205 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2206 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2207 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2208 | } |
| 2209 | |
| 2210 | // augassign: |
| 2211 | // | '+=' |
| 2212 | // | '-=' |
| 2213 | // | '*=' |
| 2214 | // | '@=' |
| 2215 | // | '/=' |
| 2216 | // | '%=' |
| 2217 | // | '&=' |
| 2218 | // | '|=' |
| 2219 | // | '^=' |
| 2220 | // | '<<=' |
| 2221 | // | '>>=' |
| 2222 | // | '**=' |
| 2223 | // | '//=' |
| 2224 | static AugOperator* |
| 2225 | augassign_rule(Parser *p) |
| 2226 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2227 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2228 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2229 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2230 | return NULL; |
| 2231 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2232 | AugOperator* _res = NULL; |
| 2233 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2234 | { // '+=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2235 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2236 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2237 | return NULL; |
| 2238 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2239 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2240 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2241 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2242 | (_literal = _PyPegen_expect_token(p, 36)) // token='+=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2243 | ) |
| 2244 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2245 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2246 | _res = _PyPegen_augoperator ( p , Add ); |
| 2247 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2248 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2249 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2250 | return NULL; |
| 2251 | } |
| 2252 | goto done; |
| 2253 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2254 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2255 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2256 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2257 | } |
| 2258 | { // '-=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2259 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2260 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2261 | return NULL; |
| 2262 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2263 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2264 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2265 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2266 | (_literal = _PyPegen_expect_token(p, 37)) // token='-=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2267 | ) |
| 2268 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2269 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2270 | _res = _PyPegen_augoperator ( p , Sub ); |
| 2271 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2272 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2273 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2274 | return NULL; |
| 2275 | } |
| 2276 | goto done; |
| 2277 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2278 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2279 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2280 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2281 | } |
| 2282 | { // '*=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2283 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2284 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2285 | return NULL; |
| 2286 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2287 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2288 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2289 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2290 | (_literal = _PyPegen_expect_token(p, 38)) // token='*=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2291 | ) |
| 2292 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2293 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2294 | _res = _PyPegen_augoperator ( p , Mult ); |
| 2295 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2296 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2297 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2298 | return NULL; |
| 2299 | } |
| 2300 | goto done; |
| 2301 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2302 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2303 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2304 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2305 | } |
| 2306 | { // '@=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2307 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2308 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2309 | return NULL; |
| 2310 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2311 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2312 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2313 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2314 | (_literal = _PyPegen_expect_token(p, 50)) // token='@=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2315 | ) |
| 2316 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2317 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2318 | _res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) ); |
| 2319 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2320 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2321 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2322 | return NULL; |
| 2323 | } |
| 2324 | goto done; |
| 2325 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2326 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2327 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2328 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2329 | } |
| 2330 | { // '/=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2331 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2332 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2333 | return NULL; |
| 2334 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2335 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2336 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2337 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2338 | (_literal = _PyPegen_expect_token(p, 39)) // token='/=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2339 | ) |
| 2340 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2341 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2342 | _res = _PyPegen_augoperator ( p , Div ); |
| 2343 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2344 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2345 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2346 | return NULL; |
| 2347 | } |
| 2348 | goto done; |
| 2349 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2350 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2351 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2352 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2353 | } |
| 2354 | { // '%=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2355 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2356 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2357 | return NULL; |
| 2358 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2359 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2360 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2361 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2362 | (_literal = _PyPegen_expect_token(p, 40)) // token='%=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2363 | ) |
| 2364 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2365 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2366 | _res = _PyPegen_augoperator ( p , Mod ); |
| 2367 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2368 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2369 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2370 | return NULL; |
| 2371 | } |
| 2372 | goto done; |
| 2373 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2374 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2375 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2376 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2377 | } |
| 2378 | { // '&=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2379 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2380 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2381 | return NULL; |
| 2382 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2383 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2384 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2385 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2386 | (_literal = _PyPegen_expect_token(p, 41)) // token='&=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2387 | ) |
| 2388 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2389 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2390 | _res = _PyPegen_augoperator ( p , BitAnd ); |
| 2391 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2392 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2393 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2394 | return NULL; |
| 2395 | } |
| 2396 | goto done; |
| 2397 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2398 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2399 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2400 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2401 | } |
| 2402 | { // '|=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2403 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2404 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2405 | return NULL; |
| 2406 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2407 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2408 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2409 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2410 | (_literal = _PyPegen_expect_token(p, 42)) // token='|=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2411 | ) |
| 2412 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2413 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2414 | _res = _PyPegen_augoperator ( p , BitOr ); |
| 2415 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2416 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2417 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2418 | return NULL; |
| 2419 | } |
| 2420 | goto done; |
| 2421 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2422 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2423 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2424 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2425 | } |
| 2426 | { // '^=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2427 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2428 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2429 | return NULL; |
| 2430 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2431 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2432 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2433 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2434 | (_literal = _PyPegen_expect_token(p, 43)) // token='^=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2435 | ) |
| 2436 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2437 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2438 | _res = _PyPegen_augoperator ( p , BitXor ); |
| 2439 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2440 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2441 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2442 | return NULL; |
| 2443 | } |
| 2444 | goto done; |
| 2445 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2446 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2447 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2448 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2449 | } |
| 2450 | { // '<<=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2451 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2452 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2453 | return NULL; |
| 2454 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2455 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2456 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2457 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2458 | (_literal = _PyPegen_expect_token(p, 44)) // token='<<=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2459 | ) |
| 2460 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2461 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2462 | _res = _PyPegen_augoperator ( p , LShift ); |
| 2463 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2464 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2465 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2466 | return NULL; |
| 2467 | } |
| 2468 | goto done; |
| 2469 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2470 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2471 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2472 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2473 | } |
| 2474 | { // '>>=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2475 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2476 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2477 | return NULL; |
| 2478 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2479 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2480 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2481 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2482 | (_literal = _PyPegen_expect_token(p, 45)) // token='>>=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2483 | ) |
| 2484 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2485 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2486 | _res = _PyPegen_augoperator ( p , RShift ); |
| 2487 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2488 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2489 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2490 | return NULL; |
| 2491 | } |
| 2492 | goto done; |
| 2493 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2494 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2495 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2496 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2497 | } |
| 2498 | { // '**=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2499 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2500 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2501 | return NULL; |
| 2502 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2503 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2504 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2505 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2506 | (_literal = _PyPegen_expect_token(p, 46)) // token='**=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2507 | ) |
| 2508 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2509 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2510 | _res = _PyPegen_augoperator ( p , Pow ); |
| 2511 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2512 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2513 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2514 | return NULL; |
| 2515 | } |
| 2516 | goto done; |
| 2517 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2518 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2519 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2520 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2521 | } |
| 2522 | { // '//=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2523 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2524 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2525 | return NULL; |
| 2526 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2527 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2528 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2529 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2530 | (_literal = _PyPegen_expect_token(p, 48)) // token='//=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2531 | ) |
| 2532 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2533 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2534 | _res = _PyPegen_augoperator ( p , FloorDiv ); |
| 2535 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2536 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2537 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2538 | return NULL; |
| 2539 | } |
| 2540 | goto done; |
| 2541 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2542 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2543 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2544 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2545 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2546 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2547 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2548 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2549 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2550 | } |
| 2551 | |
| 2552 | // global_stmt: 'global' ','.NAME+ |
| 2553 | static stmt_ty |
| 2554 | global_stmt_rule(Parser *p) |
| 2555 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2556 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2557 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2558 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2559 | return NULL; |
| 2560 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2561 | stmt_ty _res = NULL; |
| 2562 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2563 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2564 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2565 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2566 | return NULL; |
| 2567 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2568 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2569 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2570 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2571 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2572 | { // 'global' ','.NAME+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2573 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2574 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2575 | return NULL; |
| 2576 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2577 | D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2578 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2579 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2580 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2581 | (_keyword = _PyPegen_expect_token(p, 508)) // token='global' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2582 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2583 | (a = _gather_25_rule(p)) // ','.NAME+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2584 | ) |
| 2585 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2586 | D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2587 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2588 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2589 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2590 | return NULL; |
| 2591 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2592 | int _end_lineno = _token->end_lineno; |
| 2593 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2594 | int _end_col_offset = _token->end_col_offset; |
| 2595 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2596 | _res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
| 2597 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2598 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2599 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2600 | return NULL; |
| 2601 | } |
| 2602 | goto done; |
| 2603 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2604 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2605 | D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2606 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2607 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2608 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2609 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2610 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2611 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2612 | } |
| 2613 | |
| 2614 | // nonlocal_stmt: 'nonlocal' ','.NAME+ |
| 2615 | static stmt_ty |
| 2616 | nonlocal_stmt_rule(Parser *p) |
| 2617 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2618 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2619 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2620 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2621 | return NULL; |
| 2622 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2623 | stmt_ty _res = NULL; |
| 2624 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2625 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2626 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2627 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2628 | return NULL; |
| 2629 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2630 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2631 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2632 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2633 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2634 | { // 'nonlocal' ','.NAME+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2635 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2636 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2637 | return NULL; |
| 2638 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2639 | D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2640 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2641 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2642 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2643 | (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2644 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2645 | (a = _gather_27_rule(p)) // ','.NAME+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2646 | ) |
| 2647 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2648 | D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2649 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2650 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2651 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2652 | return NULL; |
| 2653 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2654 | int _end_lineno = _token->end_lineno; |
| 2655 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2656 | int _end_col_offset = _token->end_col_offset; |
| 2657 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2658 | _res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
| 2659 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2660 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2661 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2662 | return NULL; |
| 2663 | } |
| 2664 | goto done; |
| 2665 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2666 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2667 | D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2668 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2669 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2670 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2671 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2672 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2673 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2674 | } |
| 2675 | |
| 2676 | // yield_stmt: yield_expr |
| 2677 | static stmt_ty |
| 2678 | yield_stmt_rule(Parser *p) |
| 2679 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2680 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2681 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2682 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2683 | return NULL; |
| 2684 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2685 | stmt_ty _res = NULL; |
| 2686 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2687 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2688 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2689 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2690 | return NULL; |
| 2691 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2692 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2693 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2694 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2695 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2696 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2697 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2698 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2699 | return NULL; |
| 2700 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2701 | D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2702 | expr_ty y; |
| 2703 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2704 | (y = yield_expr_rule(p)) // yield_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2705 | ) |
| 2706 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2707 | D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2708 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2709 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2710 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2711 | return NULL; |
| 2712 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2713 | int _end_lineno = _token->end_lineno; |
| 2714 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2715 | int _end_col_offset = _token->end_col_offset; |
| 2716 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2717 | _res = _Py_Expr ( y , EXTRA ); |
| 2718 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2719 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2720 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2721 | return NULL; |
| 2722 | } |
| 2723 | goto done; |
| 2724 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2725 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2726 | D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2727 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2728 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2729 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2730 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2731 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2732 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2733 | } |
| 2734 | |
| 2735 | // assert_stmt: 'assert' expression [',' expression] |
| 2736 | static stmt_ty |
| 2737 | assert_stmt_rule(Parser *p) |
| 2738 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2739 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2740 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2741 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2742 | return NULL; |
| 2743 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2744 | stmt_ty _res = NULL; |
| 2745 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2746 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2747 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2748 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2749 | return NULL; |
| 2750 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2751 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2752 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2753 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2754 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2755 | { // 'assert' expression [',' expression] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2756 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2757 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2758 | return NULL; |
| 2759 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2760 | D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2761 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2762 | expr_ty a; |
| 2763 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2764 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2765 | (_keyword = _PyPegen_expect_token(p, 505)) // token='assert' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2766 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2767 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2768 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2769 | (b = _tmp_29_rule(p), 1) // [',' expression] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2770 | ) |
| 2771 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2772 | D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2773 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2774 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2775 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2776 | return NULL; |
| 2777 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2778 | int _end_lineno = _token->end_lineno; |
| 2779 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2780 | int _end_col_offset = _token->end_col_offset; |
| 2781 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2782 | _res = _Py_Assert ( a , b , EXTRA ); |
| 2783 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2784 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2785 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2786 | return NULL; |
| 2787 | } |
| 2788 | goto done; |
| 2789 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2790 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2791 | D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2792 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2793 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2794 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2795 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2796 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2797 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2798 | } |
| 2799 | |
| 2800 | // del_stmt: 'del' del_targets |
| 2801 | static stmt_ty |
| 2802 | del_stmt_rule(Parser *p) |
| 2803 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2804 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2805 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2806 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2807 | return NULL; |
| 2808 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2809 | stmt_ty _res = NULL; |
| 2810 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2811 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2812 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2813 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2814 | return NULL; |
| 2815 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2816 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2817 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2818 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2819 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2820 | { // 'del' del_targets |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2821 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2822 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2823 | return NULL; |
| 2824 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2825 | D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2826 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2827 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2828 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2829 | (_keyword = _PyPegen_expect_token(p, 503)) // token='del' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2830 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2831 | (a = del_targets_rule(p)) // del_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2832 | ) |
| 2833 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2834 | D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2835 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2836 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2837 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2838 | return NULL; |
| 2839 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2840 | int _end_lineno = _token->end_lineno; |
| 2841 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2842 | int _end_col_offset = _token->end_col_offset; |
| 2843 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2844 | _res = _Py_Delete ( a , EXTRA ); |
| 2845 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2846 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2847 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2848 | return NULL; |
| 2849 | } |
| 2850 | goto done; |
| 2851 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2852 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2853 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2854 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2855 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2856 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2857 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2858 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2859 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2860 | } |
| 2861 | |
| 2862 | // import_stmt: import_name | import_from |
| 2863 | static stmt_ty |
| 2864 | import_stmt_rule(Parser *p) |
| 2865 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2866 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2867 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2868 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2869 | return NULL; |
| 2870 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2871 | stmt_ty _res = NULL; |
| 2872 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2873 | { // import_name |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2874 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2875 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2876 | return NULL; |
| 2877 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2878 | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2879 | stmt_ty import_name_var; |
| 2880 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2881 | (import_name_var = import_name_rule(p)) // import_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2882 | ) |
| 2883 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2884 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2885 | _res = import_name_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2886 | goto done; |
| 2887 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2888 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2889 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2890 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2891 | } |
| 2892 | { // import_from |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2893 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2894 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2895 | return NULL; |
| 2896 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2897 | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2898 | stmt_ty import_from_var; |
| 2899 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2900 | (import_from_var = import_from_rule(p)) // import_from |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2901 | ) |
| 2902 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2903 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2904 | _res = import_from_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2905 | goto done; |
| 2906 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2907 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2908 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2909 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2910 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2911 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2912 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2913 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2914 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2915 | } |
| 2916 | |
| 2917 | // import_name: 'import' dotted_as_names |
| 2918 | static stmt_ty |
| 2919 | import_name_rule(Parser *p) |
| 2920 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2921 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2922 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2923 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2924 | return NULL; |
| 2925 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2926 | stmt_ty _res = NULL; |
| 2927 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2928 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2929 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2930 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2931 | return NULL; |
| 2932 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2933 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2934 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2935 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2936 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2937 | { // 'import' dotted_as_names |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2938 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2939 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2940 | return NULL; |
| 2941 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2942 | D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2943 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2944 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2945 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2946 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2947 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2948 | (a = dotted_as_names_rule(p)) // dotted_as_names |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2949 | ) |
| 2950 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2951 | D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2952 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2953 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2954 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2955 | return NULL; |
| 2956 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2957 | int _end_lineno = _token->end_lineno; |
| 2958 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2959 | int _end_col_offset = _token->end_col_offset; |
| 2960 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2961 | _res = _Py_Import ( a , EXTRA ); |
| 2962 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2963 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2964 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2965 | return NULL; |
| 2966 | } |
| 2967 | goto done; |
| 2968 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2969 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2970 | D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 2971 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2972 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2973 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2974 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2975 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2976 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2977 | } |
| 2978 | |
| 2979 | // import_from: |
| 2980 | // | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
| 2981 | // | 'from' (('.' | '...'))+ 'import' import_from_targets |
| 2982 | static stmt_ty |
| 2983 | import_from_rule(Parser *p) |
| 2984 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2985 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2986 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2987 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2988 | return NULL; |
| 2989 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2990 | stmt_ty _res = NULL; |
| 2991 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2992 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2993 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2994 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2995 | return NULL; |
| 2996 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2997 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2998 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2999 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3000 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3001 | { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3002 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3003 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3004 | return NULL; |
| 3005 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3006 | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3007 | Token * _keyword; |
| 3008 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3009 | asdl_seq * a; |
| 3010 | expr_ty b; |
| 3011 | asdl_seq* c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3012 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3013 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3014 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3015 | (a = _loop0_30_rule(p)) // (('.' | '...'))* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3016 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3017 | (b = dotted_name_rule(p)) // dotted_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3018 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3019 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3020 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3021 | (c = import_from_targets_rule(p)) // import_from_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3022 | ) |
| 3023 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3024 | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3025 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3026 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3027 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3028 | return NULL; |
| 3029 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3030 | int _end_lineno = _token->end_lineno; |
| 3031 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3032 | int _end_col_offset = _token->end_col_offset; |
| 3033 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3034 | _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
| 3035 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3036 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3037 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3038 | return NULL; |
| 3039 | } |
| 3040 | goto done; |
| 3041 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3042 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3043 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
| 3044 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3045 | } |
| 3046 | { // 'from' (('.' | '...'))+ 'import' import_from_targets |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3047 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3048 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3049 | return NULL; |
| 3050 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3051 | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3052 | Token * _keyword; |
| 3053 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3054 | asdl_seq * a; |
| 3055 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3056 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3057 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3058 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3059 | (a = _loop1_31_rule(p)) // (('.' | '...'))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3060 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3061 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3062 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3063 | (b = import_from_targets_rule(p)) // import_from_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3064 | ) |
| 3065 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3066 | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3067 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3068 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3069 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3070 | return NULL; |
| 3071 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3072 | int _end_lineno = _token->end_lineno; |
| 3073 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3074 | int _end_col_offset = _token->end_col_offset; |
| 3075 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3076 | _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
| 3077 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3078 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3079 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3080 | return NULL; |
| 3081 | } |
| 3082 | goto done; |
| 3083 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3084 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3085 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
| 3086 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3087 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3088 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3089 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3090 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3091 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3092 | } |
| 3093 | |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3094 | // import_from_targets: |
| 3095 | // | '(' import_from_as_names ','? ')' |
| 3096 | // | import_from_as_names !',' |
| 3097 | // | '*' |
| 3098 | // | invalid_import_from_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3099 | static asdl_seq* |
| 3100 | import_from_targets_rule(Parser *p) |
| 3101 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3102 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3103 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3104 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3105 | return NULL; |
| 3106 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3107 | asdl_seq* _res = NULL; |
| 3108 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3109 | { // '(' import_from_as_names ','? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3110 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3111 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3112 | return NULL; |
| 3113 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3114 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3115 | Token * _literal; |
| 3116 | Token * _literal_1; |
| 3117 | void *_opt_var; |
| 3118 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3119 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3120 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3121 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3122 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3123 | (a = import_from_as_names_rule(p)) // import_from_as_names |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3124 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3125 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3126 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3127 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3128 | ) |
| 3129 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3130 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3131 | _res = a; |
| 3132 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3133 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3134 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3135 | return NULL; |
| 3136 | } |
| 3137 | goto done; |
| 3138 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3139 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3140 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3141 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3142 | } |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3143 | { // import_from_as_names !',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3144 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3145 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3146 | return NULL; |
| 3147 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3148 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3149 | asdl_seq* import_from_as_names_var; |
| 3150 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3151 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3152 | && |
| 3153 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3154 | ) |
| 3155 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3156 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3157 | _res = import_from_as_names_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3158 | goto done; |
| 3159 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3160 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3161 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3162 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3163 | } |
| 3164 | { // '*' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3165 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3166 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3167 | return NULL; |
| 3168 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3169 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3170 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3171 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3172 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3173 | ) |
| 3174 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3175 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3176 | _res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) ); |
| 3177 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3178 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3179 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3180 | return NULL; |
| 3181 | } |
| 3182 | goto done; |
| 3183 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3184 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3185 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3186 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3187 | } |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3188 | { // invalid_import_from_targets |
| 3189 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3190 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3191 | return NULL; |
| 3192 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3193 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets")); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3194 | void *invalid_import_from_targets_var; |
| 3195 | if ( |
| 3196 | (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets |
| 3197 | ) |
| 3198 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3199 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets")); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3200 | _res = invalid_import_from_targets_var; |
| 3201 | goto done; |
| 3202 | } |
| 3203 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3204 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3205 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets")); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3206 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3207 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3208 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3209 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3210 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3211 | } |
| 3212 | |
| 3213 | // import_from_as_names: ','.import_from_as_name+ |
| 3214 | static asdl_seq* |
| 3215 | import_from_as_names_rule(Parser *p) |
| 3216 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3217 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3218 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3219 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3220 | return NULL; |
| 3221 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3222 | asdl_seq* _res = NULL; |
| 3223 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3224 | { // ','.import_from_as_name+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3225 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3226 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3227 | return NULL; |
| 3228 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3229 | D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3230 | asdl_seq * a; |
| 3231 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3232 | (a = _gather_32_rule(p)) // ','.import_from_as_name+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3233 | ) |
| 3234 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3235 | D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3236 | _res = a; |
| 3237 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3238 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3239 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3240 | return NULL; |
| 3241 | } |
| 3242 | goto done; |
| 3243 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3244 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3245 | D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
| 3246 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3248 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3249 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3250 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3251 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3252 | } |
| 3253 | |
| 3254 | // import_from_as_name: NAME ['as' NAME] |
| 3255 | static alias_ty |
| 3256 | import_from_as_name_rule(Parser *p) |
| 3257 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3258 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3259 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3260 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3261 | return NULL; |
| 3262 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3263 | alias_ty _res = NULL; |
| 3264 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3265 | { // NAME ['as' NAME] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3266 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3267 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3268 | return NULL; |
| 3269 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3270 | D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3271 | expr_ty a; |
| 3272 | void *b; |
| 3273 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3274 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3275 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3276 | (b = _tmp_34_rule(p), 1) // ['as' NAME] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3277 | ) |
| 3278 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3279 | D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3280 | _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena ); |
| 3281 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3282 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3283 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3284 | return NULL; |
| 3285 | } |
| 3286 | goto done; |
| 3287 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3288 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3289 | D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3290 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3291 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3292 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3293 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3294 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3295 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3296 | } |
| 3297 | |
| 3298 | // dotted_as_names: ','.dotted_as_name+ |
| 3299 | static asdl_seq* |
| 3300 | dotted_as_names_rule(Parser *p) |
| 3301 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3302 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3303 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3304 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3305 | return NULL; |
| 3306 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3307 | asdl_seq* _res = NULL; |
| 3308 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3309 | { // ','.dotted_as_name+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3310 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3311 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3312 | return NULL; |
| 3313 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3314 | D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3315 | asdl_seq * a; |
| 3316 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3317 | (a = _gather_35_rule(p)) // ','.dotted_as_name+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3318 | ) |
| 3319 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3320 | D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3321 | _res = a; |
| 3322 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3323 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3324 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3325 | return NULL; |
| 3326 | } |
| 3327 | goto done; |
| 3328 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3329 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3330 | D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
| 3331 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3332 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3333 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3334 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3335 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3336 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3337 | } |
| 3338 | |
| 3339 | // dotted_as_name: dotted_name ['as' NAME] |
| 3340 | static alias_ty |
| 3341 | dotted_as_name_rule(Parser *p) |
| 3342 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3343 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3344 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3345 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3346 | return NULL; |
| 3347 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3348 | alias_ty _res = NULL; |
| 3349 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3350 | { // dotted_name ['as' NAME] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3351 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3352 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3353 | return NULL; |
| 3354 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3355 | D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3356 | expr_ty a; |
| 3357 | void *b; |
| 3358 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3359 | (a = dotted_name_rule(p)) // dotted_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3360 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3361 | (b = _tmp_37_rule(p), 1) // ['as' NAME] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3362 | ) |
| 3363 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3364 | D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3365 | _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena ); |
| 3366 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3367 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3368 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3369 | return NULL; |
| 3370 | } |
| 3371 | goto done; |
| 3372 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3373 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3374 | D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3375 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3376 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3377 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3378 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3379 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3380 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3381 | } |
| 3382 | |
| 3383 | // Left-recursive |
| 3384 | // dotted_name: dotted_name '.' NAME | NAME |
| 3385 | static expr_ty dotted_name_raw(Parser *); |
| 3386 | static expr_ty |
| 3387 | dotted_name_rule(Parser *p) |
| 3388 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3389 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3390 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3391 | if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) { |
| 3392 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3393 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3394 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3395 | int _mark = p->mark; |
| 3396 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3397 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3398 | int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3399 | if (tmpvar_0) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3400 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3401 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3402 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3403 | p->mark = _mark; |
| 3404 | void *_raw = dotted_name_raw(p); |
| 3405 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3406 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3407 | _resmark = p->mark; |
| 3408 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3409 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3410 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3411 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3412 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3413 | } |
| 3414 | static expr_ty |
| 3415 | dotted_name_raw(Parser *p) |
| 3416 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3417 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3418 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3419 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3420 | return NULL; |
| 3421 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3422 | expr_ty _res = NULL; |
| 3423 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3424 | { // dotted_name '.' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3425 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3426 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3427 | return NULL; |
| 3428 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3429 | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3430 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3431 | expr_ty a; |
| 3432 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3433 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3434 | (a = dotted_name_rule(p)) // dotted_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3435 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3436 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3437 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3438 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3439 | ) |
| 3440 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3441 | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3442 | _res = _PyPegen_join_names_with_dot ( p , a , b ); |
| 3443 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3444 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3445 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3446 | return NULL; |
| 3447 | } |
| 3448 | goto done; |
| 3449 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3450 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3451 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3452 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3453 | } |
| 3454 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3455 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3456 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3457 | return NULL; |
| 3458 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3459 | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3460 | expr_ty name_var; |
| 3461 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3462 | (name_var = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3463 | ) |
| 3464 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3465 | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3466 | _res = name_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3467 | goto done; |
| 3468 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3469 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3470 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3471 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3472 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3473 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3474 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3475 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3476 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3477 | } |
| 3478 | |
| 3479 | // if_stmt: |
| 3480 | // | 'if' named_expression ':' block elif_stmt |
| 3481 | // | 'if' named_expression ':' block else_block? |
| 3482 | static stmt_ty |
| 3483 | if_stmt_rule(Parser *p) |
| 3484 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3485 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3486 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3487 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3488 | return NULL; |
| 3489 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3490 | stmt_ty _res = NULL; |
| 3491 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3492 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3493 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3494 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3495 | return NULL; |
| 3496 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3497 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3498 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3499 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3500 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3501 | { // 'if' named_expression ':' block elif_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3502 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3503 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3504 | return NULL; |
| 3505 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3506 | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3507 | Token * _keyword; |
| 3508 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3509 | expr_ty a; |
| 3510 | asdl_seq* b; |
| 3511 | stmt_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3512 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3513 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3514 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3515 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3516 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3517 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3518 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3519 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3520 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3521 | (c = elif_stmt_rule(p)) // elif_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3522 | ) |
| 3523 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3524 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3525 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3526 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3527 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3528 | return NULL; |
| 3529 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3530 | int _end_lineno = _token->end_lineno; |
| 3531 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3532 | int _end_col_offset = _token->end_col_offset; |
| 3533 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3534 | _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
| 3535 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3536 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3537 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3538 | return NULL; |
| 3539 | } |
| 3540 | goto done; |
| 3541 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3542 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3543 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3544 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3545 | } |
| 3546 | { // 'if' named_expression ':' block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3547 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3548 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3549 | return NULL; |
| 3550 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3551 | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3552 | Token * _keyword; |
| 3553 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3554 | expr_ty a; |
| 3555 | asdl_seq* b; |
| 3556 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3557 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3558 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3559 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3560 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3561 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3562 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3563 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3564 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3565 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3566 | (c = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3567 | ) |
| 3568 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3569 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3570 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3571 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3572 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3573 | return NULL; |
| 3574 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3575 | int _end_lineno = _token->end_lineno; |
| 3576 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3577 | int _end_col_offset = _token->end_col_offset; |
| 3578 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3579 | _res = _Py_If ( a , b , c , EXTRA ); |
| 3580 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3581 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3582 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3583 | return NULL; |
| 3584 | } |
| 3585 | goto done; |
| 3586 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3587 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3588 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3589 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3590 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3591 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3592 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3593 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3594 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3595 | } |
| 3596 | |
| 3597 | // elif_stmt: |
| 3598 | // | 'elif' named_expression ':' block elif_stmt |
| 3599 | // | 'elif' named_expression ':' block else_block? |
| 3600 | static stmt_ty |
| 3601 | elif_stmt_rule(Parser *p) |
| 3602 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3603 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3604 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3605 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3606 | return NULL; |
| 3607 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3608 | stmt_ty _res = NULL; |
| 3609 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3610 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3611 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3612 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3613 | return NULL; |
| 3614 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3615 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3616 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3617 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3618 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3619 | { // 'elif' named_expression ':' block elif_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3620 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3621 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3622 | return NULL; |
| 3623 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3624 | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3625 | Token * _keyword; |
| 3626 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3627 | expr_ty a; |
| 3628 | asdl_seq* b; |
| 3629 | stmt_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3630 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3631 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3632 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3633 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3634 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3635 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3636 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3637 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3638 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3639 | (c = elif_stmt_rule(p)) // elif_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3640 | ) |
| 3641 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3642 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3643 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3644 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3645 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3646 | return NULL; |
| 3647 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3648 | int _end_lineno = _token->end_lineno; |
| 3649 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3650 | int _end_col_offset = _token->end_col_offset; |
| 3651 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3652 | _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
| 3653 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3654 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3655 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3656 | return NULL; |
| 3657 | } |
| 3658 | goto done; |
| 3659 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3660 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3661 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3662 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3663 | } |
| 3664 | { // 'elif' named_expression ':' block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3665 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3666 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3667 | return NULL; |
| 3668 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3669 | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3670 | Token * _keyword; |
| 3671 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3672 | expr_ty a; |
| 3673 | asdl_seq* b; |
| 3674 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3675 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3676 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3677 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3678 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3679 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3680 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3681 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3682 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3683 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3684 | (c = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3685 | ) |
| 3686 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3687 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3688 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3689 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3690 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3691 | return NULL; |
| 3692 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3693 | int _end_lineno = _token->end_lineno; |
| 3694 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3695 | int _end_col_offset = _token->end_col_offset; |
| 3696 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3697 | _res = _Py_If ( a , b , c , EXTRA ); |
| 3698 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3699 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3700 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3701 | return NULL; |
| 3702 | } |
| 3703 | goto done; |
| 3704 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3705 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3706 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3707 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3708 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3709 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3710 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3711 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3712 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3713 | } |
| 3714 | |
| 3715 | // else_block: 'else' ':' block |
| 3716 | static asdl_seq* |
| 3717 | else_block_rule(Parser *p) |
| 3718 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3719 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3720 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3721 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3722 | return NULL; |
| 3723 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3724 | asdl_seq* _res = NULL; |
| 3725 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3726 | { // 'else' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3727 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3728 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3729 | return NULL; |
| 3730 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3731 | D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3732 | Token * _keyword; |
| 3733 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3734 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3735 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3736 | (_keyword = _PyPegen_expect_token(p, 516)) // token='else' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3737 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3738 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3739 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3740 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3741 | ) |
| 3742 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3743 | D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3744 | _res = b; |
| 3745 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3746 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3747 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3748 | return NULL; |
| 3749 | } |
| 3750 | goto done; |
| 3751 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3752 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3753 | D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 3754 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3755 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3756 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3757 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3758 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3759 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3760 | } |
| 3761 | |
| 3762 | // while_stmt: 'while' named_expression ':' block else_block? |
| 3763 | static stmt_ty |
| 3764 | while_stmt_rule(Parser *p) |
| 3765 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3766 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3767 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3768 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3769 | return NULL; |
| 3770 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3771 | stmt_ty _res = NULL; |
| 3772 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3773 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3774 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3775 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3776 | return NULL; |
| 3777 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3778 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3779 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3780 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3781 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3782 | { // 'while' named_expression ':' block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3783 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3784 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3785 | return NULL; |
| 3786 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3787 | D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3788 | Token * _keyword; |
| 3789 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3790 | expr_ty a; |
| 3791 | asdl_seq* b; |
| 3792 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3793 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3794 | (_keyword = _PyPegen_expect_token(p, 512)) // token='while' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3795 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3796 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3797 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3798 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3799 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3800 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3801 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3802 | (c = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3803 | ) |
| 3804 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3805 | D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3806 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3807 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3808 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3809 | return NULL; |
| 3810 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3811 | int _end_lineno = _token->end_lineno; |
| 3812 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3813 | int _end_col_offset = _token->end_col_offset; |
| 3814 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3815 | _res = _Py_While ( a , b , c , EXTRA ); |
| 3816 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3817 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3818 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3819 | return NULL; |
| 3820 | } |
| 3821 | goto done; |
| 3822 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3823 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3824 | D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3825 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3826 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3827 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3828 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3829 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3830 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3831 | } |
| 3832 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 3833 | // for_stmt: |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3834 | // | 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? |
| 3835 | // | ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3836 | static stmt_ty |
| 3837 | for_stmt_rule(Parser *p) |
| 3838 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3839 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3840 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3841 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3842 | return NULL; |
| 3843 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3844 | stmt_ty _res = NULL; |
| 3845 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3846 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3847 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3848 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3849 | return NULL; |
| 3850 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3851 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3852 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3853 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3854 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3855 | { // 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3856 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3857 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3858 | return NULL; |
| 3859 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3860 | 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?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3861 | Token * _keyword; |
| 3862 | Token * _keyword_1; |
| 3863 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3864 | asdl_seq* b; |
| 3865 | void *el; |
| 3866 | expr_ty ex; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3867 | expr_ty t; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 3868 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3869 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3870 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3871 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3872 | (t = star_targets_rule(p)) // star_targets |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3873 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3874 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3875 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3876 | (ex = star_expressions_rule(p)) // star_expressions |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3877 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3878 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3879 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3880 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3881 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3882 | (b = block_rule(p)) // block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3883 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3884 | (el = else_block_rule(p), 1) // else_block? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3885 | ) |
| 3886 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3887 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3888 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3889 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3890 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3891 | return NULL; |
| 3892 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3893 | int _end_lineno = _token->end_lineno; |
| 3894 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3895 | int _end_col_offset = _token->end_col_offset; |
| 3896 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3897 | _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 3898 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3899 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3900 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3901 | return NULL; |
| 3902 | } |
| 3903 | goto done; |
| 3904 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3905 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3906 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3907 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3908 | } |
| 3909 | { // ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3910 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3911 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3912 | return NULL; |
| 3913 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3914 | 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?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3915 | Token * _keyword; |
| 3916 | Token * _keyword_1; |
| 3917 | Token * _literal; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 3918 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3919 | asdl_seq* b; |
| 3920 | void *el; |
| 3921 | expr_ty ex; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3922 | expr_ty t; |
| 3923 | void *tc; |
| 3924 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3925 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3926 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3927 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3928 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3929 | (t = star_targets_rule(p)) // star_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3930 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3931 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3932 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3933 | (ex = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3934 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3935 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3936 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3937 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 3938 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3939 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3940 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3941 | (el = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3942 | ) |
| 3943 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3944 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3945 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3946 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3947 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3948 | return NULL; |
| 3949 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3950 | int _end_lineno = _token->end_lineno; |
| 3951 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3952 | int _end_col_offset = _token->end_col_offset; |
| 3953 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3954 | _res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
| 3955 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3956 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3957 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3958 | return NULL; |
| 3959 | } |
| 3960 | goto done; |
| 3961 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3962 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3963 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3964 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3965 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3966 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3967 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3968 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3969 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3970 | } |
| 3971 | |
| 3972 | // with_stmt: |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 3973 | // | 'with' '(' ','.with_item+ ','? ')' ':' block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3974 | // | 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 3975 | // | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3976 | // | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3977 | static stmt_ty |
| 3978 | with_stmt_rule(Parser *p) |
| 3979 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3980 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3981 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3982 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3983 | return NULL; |
| 3984 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3985 | stmt_ty _res = NULL; |
| 3986 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3987 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3988 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3989 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3990 | return NULL; |
| 3991 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3992 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3993 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3994 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3995 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 3996 | { // 'with' '(' ','.with_item+ ','? ')' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3997 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3998 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3999 | return NULL; |
| 4000 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4001 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4002 | Token * _keyword; |
| 4003 | Token * _literal; |
| 4004 | Token * _literal_1; |
| 4005 | Token * _literal_2; |
| 4006 | void *_opt_var; |
| 4007 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4008 | asdl_seq * a; |
| 4009 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4010 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4011 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4012 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4013 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4014 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4015 | (a = _gather_38_rule(p)) // ','.with_item+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4016 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4017 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 4018 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4019 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4020 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4021 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4022 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4023 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4024 | ) |
| 4025 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4026 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4027 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4028 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4029 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4030 | return NULL; |
| 4031 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4032 | int _end_lineno = _token->end_lineno; |
| 4033 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4034 | int _end_col_offset = _token->end_col_offset; |
| 4035 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4036 | _res = _Py_With ( a , b , NULL , EXTRA ); |
| 4037 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4038 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4039 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4040 | return NULL; |
| 4041 | } |
| 4042 | goto done; |
| 4043 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4044 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4045 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4046 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4047 | } |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4048 | { // 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4049 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4050 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4051 | return NULL; |
| 4052 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4053 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4054 | Token * _keyword; |
| 4055 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4056 | asdl_seq * a; |
| 4057 | asdl_seq* b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4058 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4059 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4060 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4061 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4062 | (a = _gather_40_rule(p)) // ','.with_item+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4063 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4064 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4065 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4066 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4067 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4068 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4069 | ) |
| 4070 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4071 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4072 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4073 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4074 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4075 | return NULL; |
| 4076 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4077 | int _end_lineno = _token->end_lineno; |
| 4078 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4079 | int _end_col_offset = _token->end_col_offset; |
| 4080 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4081 | _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 4082 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4083 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4084 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4085 | return NULL; |
| 4086 | } |
| 4087 | goto done; |
| 4088 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4089 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4090 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4091 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4092 | } |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 4093 | { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4094 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4095 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4096 | return NULL; |
| 4097 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4098 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4099 | Token * _keyword; |
| 4100 | Token * _literal; |
| 4101 | Token * _literal_1; |
| 4102 | Token * _literal_2; |
| 4103 | void *_opt_var; |
| 4104 | UNUSED(_opt_var); // Silence compiler warnings |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4105 | asdl_seq * a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 4106 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4107 | asdl_seq* b; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4108 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4109 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4110 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4111 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4112 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4113 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4114 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4115 | (a = _gather_42_rule(p)) // ','.with_item+ |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4116 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4117 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 4118 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4119 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4120 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4121 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4122 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4123 | (b = block_rule(p)) // block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4124 | ) |
| 4125 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4126 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4127 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4128 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4129 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4130 | return NULL; |
| 4131 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4132 | int _end_lineno = _token->end_lineno; |
| 4133 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4134 | int _end_col_offset = _token->end_col_offset; |
| 4135 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4136 | _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) ); |
| 4137 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4138 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4139 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4140 | return NULL; |
| 4141 | } |
| 4142 | goto done; |
| 4143 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4144 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4145 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4146 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4147 | } |
| 4148 | { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4149 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4150 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4151 | return NULL; |
| 4152 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4153 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4154 | Token * _keyword; |
| 4155 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4156 | asdl_seq * a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 4157 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4158 | asdl_seq* b; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4159 | void *tc; |
| 4160 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4161 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4162 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4163 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4164 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4165 | (a = _gather_44_rule(p)) // ','.with_item+ |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4166 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4167 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4168 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4169 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4170 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4171 | (b = block_rule(p)) // block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4172 | ) |
| 4173 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4174 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4175 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4176 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4177 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4178 | return NULL; |
| 4179 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4180 | int _end_lineno = _token->end_lineno; |
| 4181 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4182 | int _end_col_offset = _token->end_col_offset; |
| 4183 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4184 | _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
| 4185 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4186 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4187 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4188 | return NULL; |
| 4189 | } |
| 4190 | goto done; |
| 4191 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4192 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4193 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4194 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4195 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4196 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4197 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4198 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4199 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4200 | } |
| 4201 | |
| 4202 | // with_item: expression ['as' target] |
| 4203 | static withitem_ty |
| 4204 | with_item_rule(Parser *p) |
| 4205 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4206 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4207 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4208 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4209 | return NULL; |
| 4210 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4211 | withitem_ty _res = NULL; |
| 4212 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4213 | { // expression ['as' target] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4214 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4215 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4216 | return NULL; |
| 4217 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4218 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' target]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4219 | expr_ty e; |
| 4220 | void *o; |
| 4221 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4222 | (e = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4223 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4224 | (o = _tmp_46_rule(p), 1) // ['as' target] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4225 | ) |
| 4226 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4227 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' target]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4228 | _res = _Py_withitem ( e , o , p -> arena ); |
| 4229 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4230 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4231 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4232 | return NULL; |
| 4233 | } |
| 4234 | goto done; |
| 4235 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4236 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4237 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
| 4238 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' target]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4239 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4240 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4241 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4242 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4243 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4244 | } |
| 4245 | |
| 4246 | // try_stmt: |
| 4247 | // | 'try' ':' block finally_block |
| 4248 | // | 'try' ':' block except_block+ else_block? finally_block? |
| 4249 | static stmt_ty |
| 4250 | try_stmt_rule(Parser *p) |
| 4251 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4252 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4253 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4254 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4255 | return NULL; |
| 4256 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4257 | stmt_ty _res = NULL; |
| 4258 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4259 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4260 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4261 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4262 | return NULL; |
| 4263 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4264 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4265 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4266 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4267 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4268 | { // 'try' ':' block finally_block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4269 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4270 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4271 | return NULL; |
| 4272 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4273 | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4274 | Token * _keyword; |
| 4275 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4276 | asdl_seq* b; |
| 4277 | asdl_seq* f; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4278 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4279 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4280 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4281 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4282 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4283 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4284 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4285 | (f = finally_block_rule(p)) // finally_block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4286 | ) |
| 4287 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4288 | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4289 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4290 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4291 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4292 | return NULL; |
| 4293 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4294 | int _end_lineno = _token->end_lineno; |
| 4295 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4296 | int _end_col_offset = _token->end_col_offset; |
| 4297 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4298 | _res = _Py_Try ( b , NULL , NULL , f , EXTRA ); |
| 4299 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4300 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4301 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4302 | return NULL; |
| 4303 | } |
| 4304 | goto done; |
| 4305 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4306 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4307 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4308 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4309 | } |
| 4310 | { // 'try' ':' block except_block+ else_block? finally_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4311 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4312 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4313 | return NULL; |
| 4314 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4315 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4316 | Token * _keyword; |
| 4317 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4318 | asdl_seq* b; |
| 4319 | void *el; |
| 4320 | asdl_seq * ex; |
| 4321 | void *f; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4322 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4323 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4324 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4325 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4326 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4327 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4328 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4329 | (ex = _loop1_47_rule(p)) // except_block+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4330 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4331 | (el = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4332 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4333 | (f = finally_block_rule(p), 1) // finally_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4334 | ) |
| 4335 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4336 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4337 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4338 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4339 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4340 | return NULL; |
| 4341 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4342 | int _end_lineno = _token->end_lineno; |
| 4343 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4344 | int _end_col_offset = _token->end_col_offset; |
| 4345 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4346 | _res = _Py_Try ( b , ex , el , f , EXTRA ); |
| 4347 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4348 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4349 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4350 | return NULL; |
| 4351 | } |
| 4352 | goto done; |
| 4353 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4354 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4355 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4356 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4357 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4358 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4359 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4360 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4361 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4362 | } |
| 4363 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 4364 | // except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4365 | static excepthandler_ty |
| 4366 | except_block_rule(Parser *p) |
| 4367 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4368 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4369 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4370 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4371 | return NULL; |
| 4372 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4373 | excepthandler_ty _res = NULL; |
| 4374 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4375 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4376 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4377 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4378 | return NULL; |
| 4379 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4380 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4381 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4382 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4383 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 4384 | { // 'except' expression ['as' NAME] ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4385 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4386 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4387 | return NULL; |
| 4388 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4389 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4390 | Token * _keyword; |
| 4391 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4392 | asdl_seq* b; |
| 4393 | expr_ty e; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4394 | void *t; |
| 4395 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4396 | (_keyword = _PyPegen_expect_token(p, 520)) // token='except' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4397 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4398 | (e = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4399 | && |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 4400 | (t = _tmp_48_rule(p), 1) // ['as' NAME] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4401 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4402 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4403 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4404 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4405 | ) |
| 4406 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4407 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4408 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4409 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4410 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4411 | return NULL; |
| 4412 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4413 | int _end_lineno = _token->end_lineno; |
| 4414 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4415 | int _end_col_offset = _token->end_col_offset; |
| 4416 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4417 | _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA ); |
| 4418 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4419 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4420 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4421 | return NULL; |
| 4422 | } |
| 4423 | goto done; |
| 4424 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4425 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4426 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4427 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4428 | } |
| 4429 | { // 'except' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4430 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4431 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4432 | return NULL; |
| 4433 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4434 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4435 | Token * _keyword; |
| 4436 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4437 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4438 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4439 | (_keyword = _PyPegen_expect_token(p, 520)) // token='except' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4440 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4441 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4442 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4443 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4444 | ) |
| 4445 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4446 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4447 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4448 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4449 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4450 | return NULL; |
| 4451 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4452 | int _end_lineno = _token->end_lineno; |
| 4453 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4454 | int _end_col_offset = _token->end_col_offset; |
| 4455 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4456 | _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA ); |
| 4457 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4458 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4459 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4460 | return NULL; |
| 4461 | } |
| 4462 | goto done; |
| 4463 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4464 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4465 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4466 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4467 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4468 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4469 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4470 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4471 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4472 | } |
| 4473 | |
| 4474 | // finally_block: 'finally' ':' block |
| 4475 | static asdl_seq* |
| 4476 | finally_block_rule(Parser *p) |
| 4477 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4478 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4479 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4480 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4481 | return NULL; |
| 4482 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4483 | asdl_seq* _res = NULL; |
| 4484 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4485 | { // 'finally' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4486 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4487 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4488 | return NULL; |
| 4489 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4490 | D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4491 | Token * _keyword; |
| 4492 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4493 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4494 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4495 | (_keyword = _PyPegen_expect_token(p, 521)) // token='finally' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4496 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4497 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4498 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4499 | (a = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4500 | ) |
| 4501 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4502 | D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4503 | _res = a; |
| 4504 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4505 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4506 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4507 | return NULL; |
| 4508 | } |
| 4509 | goto done; |
| 4510 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4511 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4512 | D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4513 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4514 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4515 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4516 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4517 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4518 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4519 | } |
| 4520 | |
| 4521 | // return_stmt: 'return' star_expressions? |
| 4522 | static stmt_ty |
| 4523 | return_stmt_rule(Parser *p) |
| 4524 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4525 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4526 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4527 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4528 | return NULL; |
| 4529 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4530 | stmt_ty _res = NULL; |
| 4531 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4532 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4533 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4534 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4535 | return NULL; |
| 4536 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4537 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4538 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4539 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4540 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4541 | { // 'return' star_expressions? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4542 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4543 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4544 | return NULL; |
| 4545 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4546 | D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4547 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4548 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4549 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4550 | (_keyword = _PyPegen_expect_token(p, 500)) // token='return' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4551 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4552 | (a = star_expressions_rule(p), 1) // star_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4553 | ) |
| 4554 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4555 | D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4556 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4557 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4558 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4559 | return NULL; |
| 4560 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4561 | int _end_lineno = _token->end_lineno; |
| 4562 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4563 | int _end_col_offset = _token->end_col_offset; |
| 4564 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4565 | _res = _Py_Return ( a , EXTRA ); |
| 4566 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4567 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4568 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4569 | return NULL; |
| 4570 | } |
| 4571 | goto done; |
| 4572 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4573 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4574 | D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4575 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4576 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4577 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4578 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4579 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4580 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4581 | } |
| 4582 | |
| 4583 | // raise_stmt: 'raise' expression ['from' expression] | 'raise' |
| 4584 | static stmt_ty |
| 4585 | raise_stmt_rule(Parser *p) |
| 4586 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4587 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4588 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4589 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4590 | return NULL; |
| 4591 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4592 | stmt_ty _res = NULL; |
| 4593 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4594 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4595 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4596 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4597 | return NULL; |
| 4598 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4599 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4600 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4601 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4602 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4603 | { // 'raise' expression ['from' expression] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4604 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4605 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4606 | return NULL; |
| 4607 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4608 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4609 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4610 | expr_ty a; |
| 4611 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4612 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4613 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4614 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4615 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4616 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4617 | (b = _tmp_49_rule(p), 1) // ['from' expression] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4618 | ) |
| 4619 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4620 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4621 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4622 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4623 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4624 | return NULL; |
| 4625 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4626 | int _end_lineno = _token->end_lineno; |
| 4627 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4628 | int _end_col_offset = _token->end_col_offset; |
| 4629 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4630 | _res = _Py_Raise ( a , b , EXTRA ); |
| 4631 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4632 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4633 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4634 | return NULL; |
| 4635 | } |
| 4636 | goto done; |
| 4637 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4638 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4639 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4640 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4641 | } |
| 4642 | { // 'raise' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4643 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4644 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4645 | return NULL; |
| 4646 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4647 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4648 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4649 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4650 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4651 | ) |
| 4652 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4653 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4654 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4655 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4656 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4657 | return NULL; |
| 4658 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4659 | int _end_lineno = _token->end_lineno; |
| 4660 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4661 | int _end_col_offset = _token->end_col_offset; |
| 4662 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4663 | _res = _Py_Raise ( NULL , NULL , EXTRA ); |
| 4664 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4665 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4666 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4667 | return NULL; |
| 4668 | } |
| 4669 | goto done; |
| 4670 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4671 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4672 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4673 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4674 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4675 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4676 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4677 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4678 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4679 | } |
| 4680 | |
| 4681 | // function_def: decorators function_def_raw | function_def_raw |
| 4682 | static stmt_ty |
| 4683 | function_def_rule(Parser *p) |
| 4684 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4685 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4686 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4687 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4688 | return NULL; |
| 4689 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4690 | stmt_ty _res = NULL; |
| 4691 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4692 | { // decorators function_def_raw |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4693 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4694 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4695 | return NULL; |
| 4696 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4697 | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4698 | asdl_seq* d; |
| 4699 | stmt_ty f; |
| 4700 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4701 | (d = decorators_rule(p)) // decorators |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4702 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4703 | (f = function_def_raw_rule(p)) // function_def_raw |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4704 | ) |
| 4705 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4706 | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4707 | _res = _PyPegen_function_def_decorators ( p , d , f ); |
| 4708 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4709 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4710 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4711 | return NULL; |
| 4712 | } |
| 4713 | goto done; |
| 4714 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4715 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4716 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 4717 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4718 | } |
| 4719 | { // function_def_raw |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4720 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4721 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4722 | return NULL; |
| 4723 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4724 | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4725 | stmt_ty function_def_raw_var; |
| 4726 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4727 | (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4728 | ) |
| 4729 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4730 | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4731 | _res = function_def_raw_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4732 | goto done; |
| 4733 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4734 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4735 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 4736 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4737 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4738 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4739 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4740 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4741 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4742 | } |
| 4743 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4744 | // function_def_raw: |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4745 | // | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block |
| 4746 | // | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4747 | static stmt_ty |
| 4748 | function_def_raw_rule(Parser *p) |
| 4749 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4750 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4751 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4752 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4753 | return NULL; |
| 4754 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4755 | stmt_ty _res = NULL; |
| 4756 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4757 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4758 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4759 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4760 | return NULL; |
| 4761 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4762 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4763 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4764 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4765 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4766 | { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4767 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4768 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4769 | return NULL; |
| 4770 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4771 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4772 | Token * _keyword; |
| 4773 | Token * _literal; |
| 4774 | Token * _literal_1; |
| 4775 | Token * _literal_2; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4776 | void *a; |
| 4777 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4778 | expr_ty n; |
| 4779 | void *params; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4780 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4781 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4782 | (_keyword = _PyPegen_expect_token(p, 522)) // token='def' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4783 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4784 | (n = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4785 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4786 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4787 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4788 | (params = params_rule(p), 1) // params? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4789 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4790 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4791 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4792 | (a = _tmp_50_rule(p), 1) // ['->' expression] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4793 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4794 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4795 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4796 | (tc = func_type_comment_rule(p), 1) // func_type_comment? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4797 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4798 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4799 | ) |
| 4800 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4801 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4802 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4803 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4804 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4805 | return NULL; |
| 4806 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4807 | int _end_lineno = _token->end_lineno; |
| 4808 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4809 | int _end_col_offset = _token->end_col_offset; |
| 4810 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4811 | _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 4812 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4813 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4814 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4815 | return NULL; |
| 4816 | } |
| 4817 | goto done; |
| 4818 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4819 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4820 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
| 4821 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4822 | } |
| 4823 | { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4824 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4825 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4826 | return NULL; |
| 4827 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4828 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4829 | Token * _keyword; |
| 4830 | Token * _literal; |
| 4831 | Token * _literal_1; |
| 4832 | Token * _literal_2; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4833 | void *a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 4834 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4835 | asdl_seq* b; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4836 | expr_ty n; |
| 4837 | void *params; |
| 4838 | void *tc; |
| 4839 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4840 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4841 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4842 | (_keyword = _PyPegen_expect_token(p, 522)) // token='def' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4843 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4844 | (n = _PyPegen_name_token(p)) // NAME |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4845 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4846 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4847 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4848 | (params = params_rule(p), 1) // params? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4849 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4850 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4851 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4852 | (a = _tmp_51_rule(p), 1) // ['->' expression] |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4853 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4854 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4855 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4856 | (tc = func_type_comment_rule(p), 1) // func_type_comment? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4857 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4858 | (b = block_rule(p)) // block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4859 | ) |
| 4860 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4861 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4862 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4863 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4864 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4865 | return NULL; |
| 4866 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4867 | int _end_lineno = _token->end_lineno; |
| 4868 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4869 | int _end_col_offset = _token->end_col_offset; |
| 4870 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4871 | _res = CHECK_VERSION ( 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
| 4872 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4873 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4874 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4875 | return NULL; |
| 4876 | } |
| 4877 | goto done; |
| 4878 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4879 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4880 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
| 4881 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4882 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4883 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4884 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4885 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4886 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4887 | } |
| 4888 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4889 | // func_type_comment: |
| 4890 | // | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
| 4891 | // | invalid_double_type_comments |
| 4892 | // | TYPE_COMMENT |
Pablo Galindo | d955241 | 2020-05-01 16:32:09 +0100 | [diff] [blame] | 4893 | static Token* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4894 | func_type_comment_rule(Parser *p) |
| 4895 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4896 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4897 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4898 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4899 | return NULL; |
| 4900 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4901 | Token* _res = NULL; |
| 4902 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4903 | { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4904 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4905 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4906 | return NULL; |
| 4907 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4908 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 4909 | Token * newline_var; |
| 4910 | Token * t; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4911 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4912 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4913 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4914 | (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4915 | && |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4916 | _PyPegen_lookahead(1, _tmp_52_rule, p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4917 | ) |
| 4918 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4919 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4920 | _res = t; |
| 4921 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4922 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4923 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4924 | return NULL; |
| 4925 | } |
| 4926 | goto done; |
| 4927 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4928 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4929 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 4930 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4931 | } |
| 4932 | { // invalid_double_type_comments |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4933 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4934 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4935 | return NULL; |
| 4936 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4937 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4938 | void *invalid_double_type_comments_var; |
| 4939 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4940 | (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4941 | ) |
| 4942 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4943 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4944 | _res = invalid_double_type_comments_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4945 | goto done; |
| 4946 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4947 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4948 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 4949 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4950 | } |
| 4951 | { // TYPE_COMMENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4952 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4953 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4954 | return NULL; |
| 4955 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4956 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 4957 | Token * type_comment_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4958 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4959 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4960 | ) |
| 4961 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4962 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4963 | _res = type_comment_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4964 | goto done; |
| 4965 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4966 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4967 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 4968 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4969 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4970 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4971 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4972 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4973 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4974 | } |
| 4975 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4976 | // params: invalid_parameters | parameters |
| 4977 | static arguments_ty |
| 4978 | params_rule(Parser *p) |
| 4979 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4980 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4981 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4982 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4983 | return NULL; |
| 4984 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4985 | arguments_ty _res = NULL; |
| 4986 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4987 | { // invalid_parameters |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4988 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4989 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4990 | return NULL; |
| 4991 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4992 | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4993 | void *invalid_parameters_var; |
| 4994 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4995 | (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4996 | ) |
| 4997 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4998 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4999 | _res = invalid_parameters_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5000 | goto done; |
| 5001 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5002 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5003 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
| 5004 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5005 | } |
| 5006 | { // parameters |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5007 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5008 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5009 | return NULL; |
| 5010 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5011 | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5012 | arguments_ty parameters_var; |
| 5013 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5014 | (parameters_var = parameters_rule(p)) // parameters |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5015 | ) |
| 5016 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5017 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5018 | _res = parameters_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5019 | goto done; |
| 5020 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5021 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5022 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
| 5023 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5024 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5025 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5026 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5027 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5028 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5029 | } |
| 5030 | |
| 5031 | // parameters: |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5032 | // | slash_no_default param_no_default* param_with_default* star_etc? |
| 5033 | // | slash_with_default param_with_default* star_etc? |
| 5034 | // | param_no_default+ param_with_default* star_etc? |
| 5035 | // | param_with_default+ star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5036 | // | star_etc |
| 5037 | static arguments_ty |
| 5038 | parameters_rule(Parser *p) |
| 5039 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5040 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5041 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5042 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5043 | return NULL; |
| 5044 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5045 | arguments_ty _res = NULL; |
| 5046 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5047 | { // slash_no_default param_no_default* param_with_default* star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5048 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5049 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5050 | return NULL; |
| 5051 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5052 | 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 | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5053 | asdl_seq* a; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5054 | asdl_seq * b; |
| 5055 | asdl_seq * c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5056 | void *d; |
| 5057 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5058 | (a = slash_no_default_rule(p)) // slash_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5059 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5060 | (b = _loop0_53_rule(p)) // param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5061 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5062 | (c = _loop0_54_rule(p)) // param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5063 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5064 | (d = star_etc_rule(p), 1) // star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5065 | ) |
| 5066 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5067 | 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?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5068 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
| 5069 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5070 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5071 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5072 | return NULL; |
| 5073 | } |
| 5074 | goto done; |
| 5075 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5076 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5077 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5078 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5079 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5080 | { // slash_with_default param_with_default* star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5081 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5082 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5083 | return NULL; |
| 5084 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5085 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5086 | SlashWithDefault* a; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5087 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5088 | void *c; |
| 5089 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5090 | (a = slash_with_default_rule(p)) // slash_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5091 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5092 | (b = _loop0_55_rule(p)) // param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5093 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5094 | (c = star_etc_rule(p), 1) // star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5095 | ) |
| 5096 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5097 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5098 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
| 5099 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5100 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5101 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5102 | return NULL; |
| 5103 | } |
| 5104 | goto done; |
| 5105 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5106 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5107 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5108 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5109 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5110 | { // param_no_default+ param_with_default* star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5111 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5112 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5113 | return NULL; |
| 5114 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5115 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5116 | asdl_seq * a; |
| 5117 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5118 | void *c; |
| 5119 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5120 | (a = _loop1_56_rule(p)) // param_no_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5121 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5122 | (b = _loop0_57_rule(p)) // param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5123 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5124 | (c = star_etc_rule(p), 1) // star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5125 | ) |
| 5126 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5127 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5128 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
| 5129 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5130 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5131 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5132 | return NULL; |
| 5133 | } |
| 5134 | goto done; |
| 5135 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5136 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5137 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5138 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5139 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5140 | { // param_with_default+ star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5141 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5142 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5143 | return NULL; |
| 5144 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5145 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5146 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5147 | void *b; |
| 5148 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5149 | (a = _loop1_58_rule(p)) // param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5150 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5151 | (b = star_etc_rule(p), 1) // star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5152 | ) |
| 5153 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5154 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5155 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
| 5156 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5157 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5158 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5159 | return NULL; |
| 5160 | } |
| 5161 | goto done; |
| 5162 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5163 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5164 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5165 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5166 | } |
| 5167 | { // star_etc |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5168 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5169 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5170 | return NULL; |
| 5171 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5172 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5173 | StarEtc* a; |
| 5174 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5175 | (a = star_etc_rule(p)) // star_etc |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5176 | ) |
| 5177 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5178 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5179 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
| 5180 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5181 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5182 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5183 | return NULL; |
| 5184 | } |
| 5185 | goto done; |
| 5186 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5187 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5188 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5189 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5190 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5191 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5192 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5193 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5194 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5195 | } |
| 5196 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5197 | // slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5198 | static asdl_seq* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5199 | slash_no_default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5200 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5201 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5202 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5203 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5204 | return NULL; |
| 5205 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5206 | asdl_seq* _res = NULL; |
| 5207 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5208 | { // param_no_default+ '/' ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5209 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5210 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5211 | return NULL; |
| 5212 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5213 | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5214 | Token * _literal; |
| 5215 | Token * _literal_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5216 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5217 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5218 | (a = _loop1_59_rule(p)) // param_no_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5219 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5220 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5221 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5222 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5223 | ) |
| 5224 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5225 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5226 | _res = a; |
| 5227 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5228 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5229 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5230 | return NULL; |
| 5231 | } |
| 5232 | goto done; |
| 5233 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5234 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5235 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5236 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5237 | } |
| 5238 | { // param_no_default+ '/' &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5239 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5240 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5241 | return NULL; |
| 5242 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5243 | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5244 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5245 | asdl_seq * a; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5246 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5247 | (a = _loop1_60_rule(p)) // param_no_default+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5248 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5249 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5250 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5251 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5252 | ) |
| 5253 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5254 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5255 | _res = a; |
| 5256 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5257 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5258 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5259 | return NULL; |
| 5260 | } |
| 5261 | goto done; |
| 5262 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5263 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5264 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5265 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5266 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5267 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5268 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5269 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5270 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5271 | } |
| 5272 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5273 | // slash_with_default: |
| 5274 | // | param_no_default* param_with_default+ '/' ',' |
| 5275 | // | param_no_default* param_with_default+ '/' &')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5276 | static SlashWithDefault* |
| 5277 | slash_with_default_rule(Parser *p) |
| 5278 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5279 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5280 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5281 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5282 | return NULL; |
| 5283 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5284 | SlashWithDefault* _res = NULL; |
| 5285 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5286 | { // param_no_default* param_with_default+ '/' ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5287 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5288 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5289 | return NULL; |
| 5290 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5291 | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5292 | Token * _literal; |
| 5293 | Token * _literal_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5294 | asdl_seq * a; |
| 5295 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5296 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5297 | (a = _loop0_61_rule(p)) // param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5298 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5299 | (b = _loop1_62_rule(p)) // param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5300 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5301 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5302 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5303 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5304 | ) |
| 5305 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5306 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5307 | _res = _PyPegen_slash_with_default ( p , a , b ); |
| 5308 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5309 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5310 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5311 | return NULL; |
| 5312 | } |
| 5313 | goto done; |
| 5314 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5315 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5316 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5317 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5318 | } |
| 5319 | { // param_no_default* param_with_default+ '/' &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5320 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5321 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5322 | return NULL; |
| 5323 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5324 | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5325 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5326 | asdl_seq * a; |
| 5327 | asdl_seq * b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5328 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5329 | (a = _loop0_63_rule(p)) // param_no_default* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5330 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5331 | (b = _loop1_64_rule(p)) // param_with_default+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5332 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5333 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5334 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5335 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5336 | ) |
| 5337 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5338 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5339 | _res = _PyPegen_slash_with_default ( p , a , b ); |
| 5340 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5341 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5342 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5343 | return NULL; |
| 5344 | } |
| 5345 | goto done; |
| 5346 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5347 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5348 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5349 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5350 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5351 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5352 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5353 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5354 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5355 | } |
| 5356 | |
| 5357 | // star_etc: |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5358 | // | '*' param_no_default param_maybe_default* kwds? |
| 5359 | // | '*' ',' param_maybe_default+ kwds? |
| 5360 | // | kwds |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5361 | // | invalid_star_etc |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5362 | static StarEtc* |
| 5363 | star_etc_rule(Parser *p) |
| 5364 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5365 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5366 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5367 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5368 | return NULL; |
| 5369 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5370 | StarEtc* _res = NULL; |
| 5371 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5372 | { // '*' param_no_default param_maybe_default* kwds? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5373 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5374 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5375 | return NULL; |
| 5376 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5377 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5378 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5379 | arg_ty a; |
| 5380 | asdl_seq * b; |
| 5381 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5382 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5383 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5384 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5385 | (a = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5386 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5387 | (b = _loop0_65_rule(p)) // param_maybe_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5388 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5389 | (c = kwds_rule(p), 1) // kwds? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5390 | ) |
| 5391 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5392 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5393 | _res = _PyPegen_star_etc ( p , a , b , c ); |
| 5394 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5395 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5396 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5397 | return NULL; |
| 5398 | } |
| 5399 | goto done; |
| 5400 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5401 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5402 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 5403 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5404 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5405 | { // '*' ',' param_maybe_default+ kwds? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5406 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5407 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5408 | return NULL; |
| 5409 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5410 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5411 | Token * _literal; |
| 5412 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5413 | asdl_seq * b; |
| 5414 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5415 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5416 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5417 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5418 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5419 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5420 | (b = _loop1_66_rule(p)) // param_maybe_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5421 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5422 | (c = kwds_rule(p), 1) // kwds? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5423 | ) |
| 5424 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5425 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5426 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
| 5427 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5428 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5429 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5430 | return NULL; |
| 5431 | } |
| 5432 | goto done; |
| 5433 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5434 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5435 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 5436 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5437 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5438 | { // kwds |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5439 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5440 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5441 | return NULL; |
| 5442 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5443 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5444 | arg_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5445 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5446 | (a = kwds_rule(p)) // kwds |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5447 | ) |
| 5448 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5449 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5450 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
| 5451 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5452 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5453 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5454 | return NULL; |
| 5455 | } |
| 5456 | goto done; |
| 5457 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5458 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5459 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 5460 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5461 | } |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5462 | { // invalid_star_etc |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5463 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5464 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5465 | return NULL; |
| 5466 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5467 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5468 | void *invalid_star_etc_var; |
| 5469 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5470 | (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5471 | ) |
| 5472 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5473 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5474 | _res = invalid_star_etc_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5475 | goto done; |
| 5476 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5477 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5478 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 5479 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5480 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5481 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5482 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5483 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5484 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5485 | } |
| 5486 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5487 | // kwds: '**' param_no_default |
| 5488 | static arg_ty |
| 5489 | kwds_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5490 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5491 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5492 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5493 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5494 | return NULL; |
| 5495 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5496 | arg_ty _res = NULL; |
| 5497 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5498 | { // '**' param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5499 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5500 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5501 | return NULL; |
| 5502 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5503 | D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5504 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5505 | arg_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5506 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5507 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5508 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5509 | (a = param_no_default_rule(p)) // param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5510 | ) |
| 5511 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5512 | D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5513 | _res = a; |
| 5514 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5515 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5516 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5517 | return NULL; |
| 5518 | } |
| 5519 | goto done; |
| 5520 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5521 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5522 | D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ', |
| 5523 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5524 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5525 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5526 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5527 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5528 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5529 | } |
| 5530 | |
| 5531 | // param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')' |
| 5532 | static arg_ty |
| 5533 | param_no_default_rule(Parser *p) |
| 5534 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5535 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5536 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5537 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5538 | return NULL; |
| 5539 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5540 | arg_ty _res = NULL; |
| 5541 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5542 | { // param ',' TYPE_COMMENT? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5543 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5544 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5545 | return NULL; |
| 5546 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5547 | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5548 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5549 | arg_ty a; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5550 | void *tc; |
| 5551 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5552 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5553 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5554 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5555 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5556 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5557 | ) |
| 5558 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5559 | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5560 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
| 5561 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5562 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5563 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5564 | return NULL; |
| 5565 | } |
| 5566 | goto done; |
| 5567 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5568 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5569 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5570 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5571 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5572 | { // param TYPE_COMMENT? &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5573 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5574 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5575 | return NULL; |
| 5576 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5577 | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5578 | arg_ty a; |
| 5579 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5580 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5581 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5582 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5583 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5584 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5585 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5586 | ) |
| 5587 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5588 | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5589 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
| 5590 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5591 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5592 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5593 | return NULL; |
| 5594 | } |
| 5595 | goto done; |
| 5596 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5597 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5598 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5599 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5600 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5601 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5602 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5603 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5604 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5605 | } |
| 5606 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5607 | // param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5608 | static NameDefaultPair* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5609 | param_with_default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5610 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5611 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5612 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5613 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5614 | return NULL; |
| 5615 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5616 | NameDefaultPair* _res = NULL; |
| 5617 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5618 | { // param default ',' TYPE_COMMENT? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5619 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5620 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5621 | return NULL; |
| 5622 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5623 | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5624 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5625 | arg_ty a; |
| 5626 | expr_ty c; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5627 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5628 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5629 | (a = param_rule(p)) // param |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5630 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5631 | (c = default_rule(p)) // default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5632 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5633 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5634 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5635 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5636 | ) |
| 5637 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5638 | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5639 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 5640 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5641 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5642 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5643 | return NULL; |
| 5644 | } |
| 5645 | goto done; |
| 5646 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5647 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5648 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5649 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5650 | } |
| 5651 | { // param default TYPE_COMMENT? &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5652 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5653 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5654 | return NULL; |
| 5655 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5656 | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5657 | arg_ty a; |
| 5658 | expr_ty c; |
| 5659 | void *tc; |
| 5660 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5661 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5662 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5663 | (c = default_rule(p)) // default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5664 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5665 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5666 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5667 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5668 | ) |
| 5669 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5670 | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5671 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 5672 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5673 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5674 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5675 | return NULL; |
| 5676 | } |
| 5677 | goto done; |
| 5678 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5679 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5680 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5681 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5682 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5683 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5684 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5685 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5686 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5687 | } |
| 5688 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5689 | // param_maybe_default: |
| 5690 | // | param default? ',' TYPE_COMMENT? |
| 5691 | // | param default? TYPE_COMMENT? &')' |
| 5692 | static NameDefaultPair* |
| 5693 | param_maybe_default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5694 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5695 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5696 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5697 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5698 | return NULL; |
| 5699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5700 | NameDefaultPair* _res = NULL; |
| 5701 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5702 | { // param default? ',' TYPE_COMMENT? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5703 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5704 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5705 | return NULL; |
| 5706 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5707 | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5708 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5709 | arg_ty a; |
| 5710 | void *c; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5711 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5712 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5713 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5714 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5715 | (c = default_rule(p), 1) // default? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5716 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5717 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5718 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5719 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5720 | ) |
| 5721 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5722 | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5723 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 5724 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5725 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5726 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5727 | return NULL; |
| 5728 | } |
| 5729 | goto done; |
| 5730 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5731 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5732 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5733 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5734 | } |
| 5735 | { // param default? TYPE_COMMENT? &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5736 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5737 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5738 | return NULL; |
| 5739 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5740 | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5741 | arg_ty a; |
| 5742 | void *c; |
| 5743 | void *tc; |
| 5744 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5745 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5746 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5747 | (c = default_rule(p), 1) // default? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5748 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5749 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5750 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5751 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5752 | ) |
| 5753 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5754 | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5755 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 5756 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5757 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5758 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5759 | return NULL; |
| 5760 | } |
| 5761 | goto done; |
| 5762 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5763 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5764 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5765 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5766 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5767 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5768 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5769 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5770 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5771 | } |
| 5772 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5773 | // param: NAME annotation? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5774 | static arg_ty |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5775 | param_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5776 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5777 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5778 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5779 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5780 | return NULL; |
| 5781 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5782 | arg_ty _res = NULL; |
| 5783 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5784 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5785 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5786 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5787 | return NULL; |
| 5788 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5789 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5790 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5791 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5792 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5793 | { // NAME annotation? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5794 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5795 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5796 | return NULL; |
| 5797 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5798 | D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5799 | expr_ty a; |
| 5800 | void *b; |
| 5801 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5802 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5803 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5804 | (b = annotation_rule(p), 1) // annotation? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5805 | ) |
| 5806 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5807 | D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5808 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5809 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5810 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5811 | return NULL; |
| 5812 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5813 | int _end_lineno = _token->end_lineno; |
| 5814 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5815 | int _end_col_offset = _token->end_col_offset; |
| 5816 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5817 | _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA ); |
| 5818 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5819 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5820 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5821 | return NULL; |
| 5822 | } |
| 5823 | goto done; |
| 5824 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5825 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5826 | D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ', |
| 5827 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5828 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5829 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5830 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5831 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5832 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5833 | } |
| 5834 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5835 | // annotation: ':' expression |
| 5836 | static expr_ty |
| 5837 | annotation_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5838 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5839 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5840 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5841 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5842 | return NULL; |
| 5843 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5844 | expr_ty _res = NULL; |
| 5845 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5846 | { // ':' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5847 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5848 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5849 | return NULL; |
| 5850 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5851 | D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5852 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5853 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5854 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5855 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5856 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5857 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5858 | ) |
| 5859 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5860 | D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5861 | _res = a; |
| 5862 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5863 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5864 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5865 | return NULL; |
| 5866 | } |
| 5867 | goto done; |
| 5868 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5869 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5870 | D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ', |
| 5871 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5872 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5873 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5874 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5875 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5876 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5877 | } |
| 5878 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5879 | // default: '=' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5880 | static expr_ty |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5881 | default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5882 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5883 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5884 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5885 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5886 | return NULL; |
| 5887 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5888 | expr_ty _res = NULL; |
| 5889 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5890 | { // '=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5891 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5892 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5893 | return NULL; |
| 5894 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5895 | D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5896 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5897 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5898 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5899 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5900 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5901 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5902 | ) |
| 5903 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5904 | D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5905 | _res = a; |
| 5906 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5907 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5908 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5909 | return NULL; |
| 5910 | } |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5911 | goto done; |
| 5912 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5913 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5914 | D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5915 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5916 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5917 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5918 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5919 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5920 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5921 | } |
| 5922 | |
| 5923 | // decorators: (('@' named_expression NEWLINE))+ |
| 5924 | static asdl_seq* |
| 5925 | decorators_rule(Parser *p) |
| 5926 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5927 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5928 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5929 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5930 | return NULL; |
| 5931 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5932 | asdl_seq* _res = NULL; |
| 5933 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5934 | { // (('@' named_expression NEWLINE))+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5935 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5936 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5937 | return NULL; |
| 5938 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5939 | D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5940 | asdl_seq * a; |
| 5941 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5942 | (a = _loop1_67_rule(p)) // (('@' named_expression NEWLINE))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5943 | ) |
| 5944 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5945 | D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5946 | _res = a; |
| 5947 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5948 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5949 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5950 | return NULL; |
| 5951 | } |
| 5952 | goto done; |
| 5953 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5954 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5955 | D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ', |
| 5956 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5957 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5958 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5959 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5960 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5961 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5962 | } |
| 5963 | |
| 5964 | // class_def: decorators class_def_raw | class_def_raw |
| 5965 | static stmt_ty |
| 5966 | class_def_rule(Parser *p) |
| 5967 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5968 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5969 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5970 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5971 | return NULL; |
| 5972 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5973 | stmt_ty _res = NULL; |
| 5974 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5975 | { // decorators class_def_raw |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5976 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5977 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5978 | return NULL; |
| 5979 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5980 | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5981 | asdl_seq* a; |
| 5982 | stmt_ty b; |
| 5983 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5984 | (a = decorators_rule(p)) // decorators |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5985 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5986 | (b = class_def_raw_rule(p)) // class_def_raw |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5987 | ) |
| 5988 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5989 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5990 | _res = _PyPegen_class_def_decorators ( p , a , b ); |
| 5991 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5992 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5993 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5994 | return NULL; |
| 5995 | } |
| 5996 | goto done; |
| 5997 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5998 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5999 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 6000 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6001 | } |
| 6002 | { // class_def_raw |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6003 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6004 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6005 | return NULL; |
| 6006 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6007 | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6008 | stmt_ty class_def_raw_var; |
| 6009 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6010 | (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6011 | ) |
| 6012 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6013 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6014 | _res = class_def_raw_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6015 | goto done; |
| 6016 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6017 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6018 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 6019 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6020 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6021 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6022 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6023 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6024 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6025 | } |
| 6026 | |
| 6027 | // class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block |
| 6028 | static stmt_ty |
| 6029 | class_def_raw_rule(Parser *p) |
| 6030 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6031 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6032 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6033 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6034 | return NULL; |
| 6035 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6036 | stmt_ty _res = NULL; |
| 6037 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6038 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6039 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6040 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6041 | return NULL; |
| 6042 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6043 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6044 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6045 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6046 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6047 | { // 'class' NAME ['(' arguments? ')'] ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6048 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6049 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6050 | return NULL; |
| 6051 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6052 | D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6053 | Token * _keyword; |
| 6054 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6055 | expr_ty a; |
| 6056 | void *b; |
| 6057 | asdl_seq* c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6058 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6059 | (_keyword = _PyPegen_expect_token(p, 523)) // token='class' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6060 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6061 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6062 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6063 | (b = _tmp_68_rule(p), 1) // ['(' arguments? ')'] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6064 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6065 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6066 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6067 | (c = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6068 | ) |
| 6069 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6070 | D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6071 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6072 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6073 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6074 | return NULL; |
| 6075 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6076 | int _end_lineno = _token->end_lineno; |
| 6077 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6078 | int _end_col_offset = _token->end_col_offset; |
| 6079 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6080 | _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 ); |
| 6081 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6082 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6083 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6084 | return NULL; |
| 6085 | } |
| 6086 | goto done; |
| 6087 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6088 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6089 | D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
| 6090 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6091 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6092 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6093 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6094 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6095 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6096 | } |
| 6097 | |
| 6098 | // block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block |
| 6099 | static asdl_seq* |
| 6100 | block_rule(Parser *p) |
| 6101 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6102 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6103 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6104 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6105 | return NULL; |
| 6106 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6107 | asdl_seq* _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6108 | if (_PyPegen_is_memoized(p, block_type, &_res)) { |
| 6109 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6110 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6111 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6112 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6113 | { // NEWLINE INDENT statements DEDENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6114 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6115 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6116 | return NULL; |
| 6117 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6118 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6119 | asdl_seq* a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 6120 | Token * dedent_var; |
| 6121 | Token * indent_var; |
| 6122 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6123 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6124 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6125 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6126 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6127 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6128 | (a = statements_rule(p)) // statements |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6129 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6130 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6131 | ) |
| 6132 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6133 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6134 | _res = a; |
| 6135 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6136 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6137 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6138 | return NULL; |
| 6139 | } |
| 6140 | goto done; |
| 6141 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6142 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6143 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 6144 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6145 | } |
| 6146 | { // simple_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6147 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6148 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6149 | return NULL; |
| 6150 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6151 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6152 | asdl_seq* simple_stmt_var; |
| 6153 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6154 | (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6155 | ) |
| 6156 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6157 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6158 | _res = simple_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6159 | goto done; |
| 6160 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6161 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6162 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 6163 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6164 | } |
| 6165 | { // invalid_block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6166 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6167 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6168 | return NULL; |
| 6169 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6170 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6171 | void *invalid_block_var; |
| 6172 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6173 | (invalid_block_var = invalid_block_rule(p)) // invalid_block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6174 | ) |
| 6175 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6176 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6177 | _res = invalid_block_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6178 | goto done; |
| 6179 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6180 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6181 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 6182 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6183 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6184 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6185 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6186 | _PyPegen_insert_memo(p, _mark, block_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6187 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6188 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6189 | } |
| 6190 | |
| 6191 | // expressions_list: ','.star_expression+ ','? |
| 6192 | static asdl_seq* |
| 6193 | expressions_list_rule(Parser *p) |
| 6194 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6195 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6196 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6197 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6198 | return NULL; |
| 6199 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6200 | asdl_seq* _res = NULL; |
| 6201 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6202 | { // ','.star_expression+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6203 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6204 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6205 | return NULL; |
| 6206 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6207 | D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6208 | void *_opt_var; |
| 6209 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6210 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6211 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6212 | (a = _gather_69_rule(p)) // ','.star_expression+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6213 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6214 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6215 | ) |
| 6216 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6217 | D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6218 | _res = a; |
| 6219 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6220 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6221 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6222 | return NULL; |
| 6223 | } |
| 6224 | goto done; |
| 6225 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6226 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6227 | D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ', |
| 6228 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6229 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6230 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6231 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6232 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6233 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6234 | } |
| 6235 | |
| 6236 | // star_expressions: |
| 6237 | // | star_expression ((',' star_expression))+ ','? |
| 6238 | // | star_expression ',' |
| 6239 | // | star_expression |
| 6240 | static expr_ty |
| 6241 | star_expressions_rule(Parser *p) |
| 6242 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6243 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6244 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6245 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6246 | return NULL; |
| 6247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6248 | expr_ty _res = NULL; |
| 6249 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6250 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6251 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6252 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6253 | return NULL; |
| 6254 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6255 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6256 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6257 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6258 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6259 | { // star_expression ((',' star_expression))+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6260 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6261 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6262 | return NULL; |
| 6263 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6264 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6265 | void *_opt_var; |
| 6266 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6267 | expr_ty a; |
| 6268 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6269 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6270 | (a = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6271 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6272 | (b = _loop1_71_rule(p)) // ((',' star_expression))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6273 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6274 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6275 | ) |
| 6276 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6277 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6278 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6279 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6280 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6281 | return NULL; |
| 6282 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6283 | int _end_lineno = _token->end_lineno; |
| 6284 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6285 | int _end_col_offset = _token->end_col_offset; |
| 6286 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6287 | _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
| 6288 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6289 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6290 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6291 | return NULL; |
| 6292 | } |
| 6293 | goto done; |
| 6294 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6295 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6296 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6297 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6298 | } |
| 6299 | { // star_expression ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6300 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6301 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6302 | return NULL; |
| 6303 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6304 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6305 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6306 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6307 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6308 | (a = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6309 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6310 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6311 | ) |
| 6312 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6313 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6314 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6315 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6316 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6317 | return NULL; |
| 6318 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6319 | int _end_lineno = _token->end_lineno; |
| 6320 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6321 | int _end_col_offset = _token->end_col_offset; |
| 6322 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6323 | _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
| 6324 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6325 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6326 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6327 | return NULL; |
| 6328 | } |
| 6329 | goto done; |
| 6330 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6331 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6332 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6333 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6334 | } |
| 6335 | { // star_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6336 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6337 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6338 | return NULL; |
| 6339 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6340 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6341 | expr_ty star_expression_var; |
| 6342 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6343 | (star_expression_var = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6344 | ) |
| 6345 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6346 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6347 | _res = star_expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6348 | goto done; |
| 6349 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6350 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6351 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6352 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6353 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6354 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6355 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6356 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6357 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6358 | } |
| 6359 | |
| 6360 | // star_expression: '*' bitwise_or | expression |
| 6361 | static expr_ty |
| 6362 | star_expression_rule(Parser *p) |
| 6363 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6364 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6365 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6366 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6367 | return NULL; |
| 6368 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6369 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6370 | if (_PyPegen_is_memoized(p, star_expression_type, &_res)) { |
| 6371 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6372 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6373 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6374 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6375 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6376 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6377 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6378 | return NULL; |
| 6379 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6380 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6381 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6382 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6383 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6384 | { // '*' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6385 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6386 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6387 | return NULL; |
| 6388 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6389 | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6390 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6391 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6392 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6393 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6394 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6395 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6396 | ) |
| 6397 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6398 | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6399 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6400 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6401 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6402 | return NULL; |
| 6403 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6404 | int _end_lineno = _token->end_lineno; |
| 6405 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6406 | int _end_col_offset = _token->end_col_offset; |
| 6407 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6408 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 6409 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6410 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6411 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6412 | return NULL; |
| 6413 | } |
| 6414 | goto done; |
| 6415 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6416 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6417 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6418 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6419 | } |
| 6420 | { // expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6421 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6422 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6423 | return NULL; |
| 6424 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6425 | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6426 | expr_ty expression_var; |
| 6427 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6428 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6429 | ) |
| 6430 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6431 | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6432 | _res = expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6433 | goto done; |
| 6434 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6435 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6436 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6437 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6438 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6439 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6440 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6441 | _PyPegen_insert_memo(p, _mark, star_expression_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6442 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6443 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6444 | } |
| 6445 | |
| 6446 | // star_named_expressions: ','.star_named_expression+ ','? |
| 6447 | static asdl_seq* |
| 6448 | star_named_expressions_rule(Parser *p) |
| 6449 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6450 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6451 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6452 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6453 | return NULL; |
| 6454 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6455 | asdl_seq* _res = NULL; |
| 6456 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6457 | { // ','.star_named_expression+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6458 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6459 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6460 | return NULL; |
| 6461 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6462 | D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6463 | void *_opt_var; |
| 6464 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6465 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6466 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6467 | (a = _gather_72_rule(p)) // ','.star_named_expression+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6468 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6469 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6470 | ) |
| 6471 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6472 | D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6473 | _res = a; |
| 6474 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6475 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6476 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6477 | return NULL; |
| 6478 | } |
| 6479 | goto done; |
| 6480 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6481 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6482 | D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6483 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6484 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6485 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6486 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6487 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6488 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6489 | } |
| 6490 | |
| 6491 | // star_named_expression: '*' bitwise_or | named_expression |
| 6492 | static expr_ty |
| 6493 | star_named_expression_rule(Parser *p) |
| 6494 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6495 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6496 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6497 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6498 | return NULL; |
| 6499 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6500 | expr_ty _res = NULL; |
| 6501 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6502 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6503 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6504 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6505 | return NULL; |
| 6506 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6507 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6508 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6509 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6510 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6511 | { // '*' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6512 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6513 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6514 | return NULL; |
| 6515 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6516 | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6517 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6518 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6519 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6520 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6521 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6522 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6523 | ) |
| 6524 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6525 | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6526 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6527 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6528 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6529 | return NULL; |
| 6530 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6531 | int _end_lineno = _token->end_lineno; |
| 6532 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6533 | int _end_col_offset = _token->end_col_offset; |
| 6534 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6535 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 6536 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6537 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6538 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6539 | return NULL; |
| 6540 | } |
| 6541 | goto done; |
| 6542 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6543 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6544 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6545 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6546 | } |
| 6547 | { // named_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6548 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6549 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6550 | return NULL; |
| 6551 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6552 | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6553 | expr_ty named_expression_var; |
| 6554 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6555 | (named_expression_var = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6556 | ) |
| 6557 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6558 | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6559 | _res = named_expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6560 | goto done; |
| 6561 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6562 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6563 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6564 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6565 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6566 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6567 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6568 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6569 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6570 | } |
| 6571 | |
| 6572 | // named_expression: NAME ':=' expression | expression !':=' | invalid_named_expression |
| 6573 | static expr_ty |
| 6574 | named_expression_rule(Parser *p) |
| 6575 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6576 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6577 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6578 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6579 | return NULL; |
| 6580 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6581 | expr_ty _res = NULL; |
| 6582 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6583 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6584 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6585 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6586 | return NULL; |
| 6587 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6588 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6589 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6590 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6591 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6592 | { // NAME ':=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6593 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6594 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6595 | return NULL; |
| 6596 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6597 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6598 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6599 | expr_ty a; |
| 6600 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6601 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6602 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6603 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6604 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6605 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6606 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6607 | ) |
| 6608 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6609 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6610 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6611 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6612 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6613 | return NULL; |
| 6614 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6615 | int _end_lineno = _token->end_lineno; |
| 6616 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6617 | int _end_col_offset = _token->end_col_offset; |
| 6618 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6619 | _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ); |
| 6620 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6621 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6622 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6623 | return NULL; |
| 6624 | } |
| 6625 | goto done; |
| 6626 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6627 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6628 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6629 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6630 | } |
| 6631 | { // expression !':=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6632 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6633 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6634 | return NULL; |
| 6635 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6636 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6637 | expr_ty expression_var; |
| 6638 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6639 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6640 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6641 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6642 | ) |
| 6643 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6644 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6645 | _res = expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6646 | goto done; |
| 6647 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6648 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6649 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6650 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6651 | } |
| 6652 | { // invalid_named_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6653 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6654 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6655 | return NULL; |
| 6656 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6657 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6658 | void *invalid_named_expression_var; |
| 6659 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6660 | (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6661 | ) |
| 6662 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6663 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6664 | _res = invalid_named_expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6665 | goto done; |
| 6666 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6667 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6668 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6669 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6670 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6671 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6672 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6673 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6674 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6675 | } |
| 6676 | |
| 6677 | // annotated_rhs: yield_expr | star_expressions |
| 6678 | static expr_ty |
| 6679 | annotated_rhs_rule(Parser *p) |
| 6680 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6681 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6682 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6683 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6684 | return NULL; |
| 6685 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6686 | expr_ty _res = NULL; |
| 6687 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6688 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6689 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6690 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6691 | return NULL; |
| 6692 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6693 | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6694 | expr_ty yield_expr_var; |
| 6695 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6696 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6697 | ) |
| 6698 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6699 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6700 | _res = yield_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6701 | goto done; |
| 6702 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6703 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6704 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
| 6705 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6706 | } |
| 6707 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6708 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6709 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6710 | return NULL; |
| 6711 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6712 | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6713 | expr_ty star_expressions_var; |
| 6714 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6715 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6716 | ) |
| 6717 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6718 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6719 | _res = star_expressions_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6720 | goto done; |
| 6721 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6722 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6723 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
| 6724 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6725 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6726 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6727 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6728 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6729 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6730 | } |
| 6731 | |
| 6732 | // expressions: expression ((',' expression))+ ','? | expression ',' | expression |
| 6733 | static expr_ty |
| 6734 | expressions_rule(Parser *p) |
| 6735 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6736 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6737 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6738 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6739 | return NULL; |
| 6740 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6741 | expr_ty _res = NULL; |
| 6742 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6743 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6744 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6745 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6746 | return NULL; |
| 6747 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6748 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6749 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6750 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6751 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6752 | { // expression ((',' expression))+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6753 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6754 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6755 | return NULL; |
| 6756 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6757 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6758 | void *_opt_var; |
| 6759 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6760 | expr_ty a; |
| 6761 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6762 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6763 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6764 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6765 | (b = _loop1_74_rule(p)) // ((',' expression))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6766 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6767 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6768 | ) |
| 6769 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6770 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6771 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6772 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6773 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6774 | return NULL; |
| 6775 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6776 | int _end_lineno = _token->end_lineno; |
| 6777 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6778 | int _end_col_offset = _token->end_col_offset; |
| 6779 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6780 | _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
| 6781 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6782 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6783 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6784 | return NULL; |
| 6785 | } |
| 6786 | goto done; |
| 6787 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6788 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6789 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6790 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6791 | } |
| 6792 | { // expression ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6793 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6794 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6795 | return NULL; |
| 6796 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6797 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6798 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6799 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6800 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6801 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6802 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6803 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6804 | ) |
| 6805 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6806 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6807 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6808 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6809 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6810 | return NULL; |
| 6811 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6812 | int _end_lineno = _token->end_lineno; |
| 6813 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6814 | int _end_col_offset = _token->end_col_offset; |
| 6815 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6816 | _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
| 6817 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6818 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6819 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6820 | return NULL; |
| 6821 | } |
| 6822 | goto done; |
| 6823 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6824 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6825 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6826 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6827 | } |
| 6828 | { // expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6829 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6830 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6831 | return NULL; |
| 6832 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6833 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6834 | expr_ty expression_var; |
| 6835 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6836 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6837 | ) |
| 6838 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6839 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6840 | _res = expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6841 | goto done; |
| 6842 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6843 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6844 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6845 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6846 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6847 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6848 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6849 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6850 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6851 | } |
| 6852 | |
| 6853 | // expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef |
| 6854 | static expr_ty |
| 6855 | expression_rule(Parser *p) |
| 6856 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6857 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6858 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6859 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6860 | return NULL; |
| 6861 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6862 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6863 | if (_PyPegen_is_memoized(p, expression_type, &_res)) { |
| 6864 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6865 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6866 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6867 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6868 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6869 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6870 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6871 | return NULL; |
| 6872 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6873 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6874 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6875 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6876 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6877 | { // disjunction 'if' disjunction 'else' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6878 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6879 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6880 | return NULL; |
| 6881 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6882 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6883 | Token * _keyword; |
| 6884 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6885 | expr_ty a; |
| 6886 | expr_ty b; |
| 6887 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6888 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6889 | (a = disjunction_rule(p)) // disjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6890 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6891 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6892 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6893 | (b = disjunction_rule(p)) // disjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6894 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6895 | (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6896 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6897 | (c = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6898 | ) |
| 6899 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6900 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6901 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6902 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6903 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6904 | return NULL; |
| 6905 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6906 | int _end_lineno = _token->end_lineno; |
| 6907 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6908 | int _end_col_offset = _token->end_col_offset; |
| 6909 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6910 | _res = _Py_IfExp ( b , a , c , EXTRA ); |
| 6911 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6912 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6913 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6914 | return NULL; |
| 6915 | } |
| 6916 | goto done; |
| 6917 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6918 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6919 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6920 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6921 | } |
| 6922 | { // disjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6923 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6924 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6925 | return NULL; |
| 6926 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6927 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6928 | expr_ty disjunction_var; |
| 6929 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6930 | (disjunction_var = disjunction_rule(p)) // disjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6931 | ) |
| 6932 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6933 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6934 | _res = disjunction_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6935 | goto done; |
| 6936 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6937 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6938 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6939 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6940 | } |
| 6941 | { // lambdef |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6942 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6943 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6944 | return NULL; |
| 6945 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6946 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6947 | expr_ty lambdef_var; |
| 6948 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6949 | (lambdef_var = lambdef_rule(p)) // lambdef |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6950 | ) |
| 6951 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6952 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6953 | _res = lambdef_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6954 | goto done; |
| 6955 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6956 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6957 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6958 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6959 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6960 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6961 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6962 | _PyPegen_insert_memo(p, _mark, expression_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6963 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6964 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6965 | } |
| 6966 | |
| 6967 | // lambdef: 'lambda' lambda_parameters? ':' expression |
| 6968 | static expr_ty |
| 6969 | lambdef_rule(Parser *p) |
| 6970 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6971 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6972 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6973 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6974 | return NULL; |
| 6975 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6976 | expr_ty _res = NULL; |
| 6977 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6978 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6979 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6980 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6981 | return NULL; |
| 6982 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6983 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6984 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6985 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6986 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6987 | { // 'lambda' lambda_parameters? ':' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6988 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6989 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6990 | return NULL; |
| 6991 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6992 | D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6993 | Token * _keyword; |
| 6994 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6995 | void *a; |
| 6996 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6997 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6998 | (_keyword = _PyPegen_expect_token(p, 524)) // token='lambda' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6999 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7000 | (a = lambda_parameters_rule(p), 1) // lambda_parameters? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7001 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7002 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7003 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7004 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7005 | ) |
| 7006 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7007 | D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7008 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7009 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7010 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7011 | return NULL; |
| 7012 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7013 | int _end_lineno = _token->end_lineno; |
| 7014 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7015 | int _end_col_offset = _token->end_col_offset; |
| 7016 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7017 | _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA ); |
| 7018 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7019 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7020 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7021 | return NULL; |
| 7022 | } |
| 7023 | goto done; |
| 7024 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7025 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7026 | D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ', |
| 7027 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7028 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7029 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7030 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7031 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7032 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7033 | } |
| 7034 | |
| 7035 | // lambda_parameters: |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7036 | // | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
| 7037 | // | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
| 7038 | // | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
| 7039 | // | lambda_param_with_default+ lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7040 | // | lambda_star_etc |
| 7041 | static arguments_ty |
| 7042 | lambda_parameters_rule(Parser *p) |
| 7043 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7044 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7045 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7046 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7047 | return NULL; |
| 7048 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7049 | arguments_ty _res = NULL; |
| 7050 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7051 | { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7052 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7053 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7054 | return NULL; |
| 7055 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7056 | 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 | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7057 | asdl_seq* a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7058 | asdl_seq * b; |
| 7059 | asdl_seq * c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7060 | void *d; |
| 7061 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7062 | (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7063 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7064 | (b = _loop0_75_rule(p)) // lambda_param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7065 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7066 | (c = _loop0_76_rule(p)) // lambda_param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7067 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7068 | (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7069 | ) |
| 7070 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7071 | 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?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7072 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
| 7073 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7074 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7075 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7076 | return NULL; |
| 7077 | } |
| 7078 | goto done; |
| 7079 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7080 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7081 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7082 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7083 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7084 | { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7085 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7086 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7087 | return NULL; |
| 7088 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7089 | 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?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7090 | SlashWithDefault* a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7091 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7092 | void *c; |
| 7093 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7094 | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7095 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7096 | (b = _loop0_77_rule(p)) // lambda_param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7097 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7098 | (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7099 | ) |
| 7100 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7101 | 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?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7102 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
| 7103 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7104 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7105 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7106 | return NULL; |
| 7107 | } |
| 7108 | goto done; |
| 7109 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7110 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7111 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7112 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7113 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7114 | { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7115 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7116 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7117 | return NULL; |
| 7118 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7119 | 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?")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7120 | asdl_seq * a; |
| 7121 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7122 | void *c; |
| 7123 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7124 | (a = _loop1_78_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7125 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7126 | (b = _loop0_79_rule(p)) // lambda_param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7127 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7128 | (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7129 | ) |
| 7130 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7131 | 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?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7132 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
| 7133 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7134 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7135 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7136 | return NULL; |
| 7137 | } |
| 7138 | goto done; |
| 7139 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7140 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7141 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7142 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7143 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7144 | { // lambda_param_with_default+ lambda_star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7145 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7146 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7147 | return NULL; |
| 7148 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7149 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7150 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7151 | void *b; |
| 7152 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7153 | (a = _loop1_80_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7154 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7155 | (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7156 | ) |
| 7157 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7158 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7159 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
| 7160 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7161 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7162 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7163 | return NULL; |
| 7164 | } |
| 7165 | goto done; |
| 7166 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7167 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7168 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7169 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7170 | } |
| 7171 | { // lambda_star_etc |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7172 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7173 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7174 | return NULL; |
| 7175 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7176 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7177 | StarEtc* a; |
| 7178 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7179 | (a = lambda_star_etc_rule(p)) // lambda_star_etc |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7180 | ) |
| 7181 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7182 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7183 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
| 7184 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7185 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7186 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7187 | return NULL; |
| 7188 | } |
| 7189 | goto done; |
| 7190 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7191 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7192 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7193 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7194 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7195 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7196 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7197 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7198 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7199 | } |
| 7200 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7201 | // lambda_slash_no_default: |
| 7202 | // | lambda_param_no_default+ '/' ',' |
| 7203 | // | lambda_param_no_default+ '/' &':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7204 | static asdl_seq* |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7205 | lambda_slash_no_default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7206 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7207 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7208 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7209 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7210 | return NULL; |
| 7211 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7212 | asdl_seq* _res = NULL; |
| 7213 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7214 | { // lambda_param_no_default+ '/' ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7215 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7216 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7217 | return NULL; |
| 7218 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7219 | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7220 | Token * _literal; |
| 7221 | Token * _literal_1; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7222 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7223 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7224 | (a = _loop1_81_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7225 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7226 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7227 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7228 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7229 | ) |
| 7230 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7231 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7232 | _res = a; |
| 7233 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7234 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7235 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7236 | return NULL; |
| 7237 | } |
| 7238 | goto done; |
| 7239 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7240 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7241 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7242 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7243 | } |
| 7244 | { // lambda_param_no_default+ '/' &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7245 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7246 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7247 | return NULL; |
| 7248 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7249 | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7250 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7251 | asdl_seq * a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7252 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7253 | (a = _loop1_82_rule(p)) // lambda_param_no_default+ |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7254 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7255 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7256 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7257 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7258 | ) |
| 7259 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7260 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7261 | _res = a; |
| 7262 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7263 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7264 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7265 | return NULL; |
| 7266 | } |
| 7267 | goto done; |
| 7268 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7269 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7270 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7271 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7272 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7273 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7274 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7275 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7276 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7277 | } |
| 7278 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7279 | // lambda_slash_with_default: |
| 7280 | // | lambda_param_no_default* lambda_param_with_default+ '/' ',' |
| 7281 | // | lambda_param_no_default* lambda_param_with_default+ '/' &':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7282 | static SlashWithDefault* |
| 7283 | lambda_slash_with_default_rule(Parser *p) |
| 7284 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7285 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7286 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7287 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7288 | return NULL; |
| 7289 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7290 | SlashWithDefault* _res = NULL; |
| 7291 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7292 | { // lambda_param_no_default* lambda_param_with_default+ '/' ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7293 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7294 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7295 | return NULL; |
| 7296 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7297 | 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+ '/' ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7298 | Token * _literal; |
| 7299 | Token * _literal_1; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7300 | asdl_seq * a; |
| 7301 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7302 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7303 | (a = _loop0_83_rule(p)) // lambda_param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7304 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7305 | (b = _loop1_84_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7306 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7307 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7308 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7309 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7310 | ) |
| 7311 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7312 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7313 | _res = _PyPegen_slash_with_default ( p , a , b ); |
| 7314 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7315 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7316 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7317 | return NULL; |
| 7318 | } |
| 7319 | goto done; |
| 7320 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7321 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7322 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7323 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7324 | } |
| 7325 | { // lambda_param_no_default* lambda_param_with_default+ '/' &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7326 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7327 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7328 | return NULL; |
| 7329 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7330 | 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+ '/' &':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7331 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7332 | asdl_seq * a; |
| 7333 | asdl_seq * b; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7334 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7335 | (a = _loop0_85_rule(p)) // lambda_param_no_default* |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7336 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7337 | (b = _loop1_86_rule(p)) // lambda_param_with_default+ |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7338 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7339 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7340 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7341 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7342 | ) |
| 7343 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7344 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7345 | _res = _PyPegen_slash_with_default ( p , a , b ); |
| 7346 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7347 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7348 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7349 | return NULL; |
| 7350 | } |
| 7351 | goto done; |
| 7352 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7353 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7354 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7355 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7356 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7357 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7358 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7359 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7360 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7361 | } |
| 7362 | |
| 7363 | // lambda_star_etc: |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7364 | // | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
| 7365 | // | '*' ',' lambda_param_maybe_default+ lambda_kwds? |
| 7366 | // | lambda_kwds |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7367 | // | invalid_lambda_star_etc |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7368 | static StarEtc* |
| 7369 | lambda_star_etc_rule(Parser *p) |
| 7370 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7371 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7372 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7373 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7374 | return NULL; |
| 7375 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7376 | StarEtc* _res = NULL; |
| 7377 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7378 | { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7379 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7380 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7381 | return NULL; |
| 7382 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7383 | 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?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7384 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7385 | arg_ty a; |
| 7386 | asdl_seq * b; |
| 7387 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7388 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7389 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7390 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7391 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7392 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7393 | (b = _loop0_87_rule(p)) // lambda_param_maybe_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7394 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7395 | (c = lambda_kwds_rule(p), 1) // lambda_kwds? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7396 | ) |
| 7397 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7398 | 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?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7399 | _res = _PyPegen_star_etc ( p , a , b , c ); |
| 7400 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7401 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7402 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7403 | return NULL; |
| 7404 | } |
| 7405 | goto done; |
| 7406 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7407 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7408 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 7409 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7410 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7411 | { // '*' ',' lambda_param_maybe_default+ lambda_kwds? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7412 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7413 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7414 | return NULL; |
| 7415 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7416 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7417 | Token * _literal; |
| 7418 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7419 | asdl_seq * b; |
| 7420 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7421 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7422 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7423 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7424 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7425 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7426 | (b = _loop1_88_rule(p)) // lambda_param_maybe_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7427 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7428 | (c = lambda_kwds_rule(p), 1) // lambda_kwds? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7429 | ) |
| 7430 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7431 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7432 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
| 7433 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7434 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7435 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7436 | return NULL; |
| 7437 | } |
| 7438 | goto done; |
| 7439 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7440 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7441 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 7442 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7443 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7444 | { // lambda_kwds |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7445 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7446 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7447 | return NULL; |
| 7448 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7449 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7450 | arg_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7451 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7452 | (a = lambda_kwds_rule(p)) // lambda_kwds |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7453 | ) |
| 7454 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7455 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7456 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
| 7457 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7458 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7459 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7460 | return NULL; |
| 7461 | } |
| 7462 | goto done; |
| 7463 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7464 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7465 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 7466 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7467 | } |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7468 | { // invalid_lambda_star_etc |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7469 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7470 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7471 | return NULL; |
| 7472 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7473 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7474 | void *invalid_lambda_star_etc_var; |
| 7475 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7476 | (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7477 | ) |
| 7478 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7479 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7480 | _res = invalid_lambda_star_etc_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7481 | goto done; |
| 7482 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7483 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7484 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 7485 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7486 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7487 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7488 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7489 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7490 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7491 | } |
| 7492 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7493 | // lambda_kwds: '**' lambda_param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7494 | static arg_ty |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7495 | lambda_kwds_rule(Parser *p) |
| 7496 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7497 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7498 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7499 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7500 | return NULL; |
| 7501 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7502 | arg_ty _res = NULL; |
| 7503 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7504 | { // '**' lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7505 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7506 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7507 | return NULL; |
| 7508 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7509 | D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7510 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7511 | arg_ty a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7512 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7513 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7514 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7515 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7516 | ) |
| 7517 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7518 | D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7519 | _res = a; |
| 7520 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7521 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7522 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7523 | return NULL; |
| 7524 | } |
| 7525 | goto done; |
| 7526 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7527 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7528 | D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
| 7529 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7530 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7531 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7532 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7533 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7534 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7535 | } |
| 7536 | |
| 7537 | // lambda_param_no_default: lambda_param ',' | lambda_param &':' |
| 7538 | static arg_ty |
| 7539 | lambda_param_no_default_rule(Parser *p) |
| 7540 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7541 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7542 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7543 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7544 | return NULL; |
| 7545 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7546 | arg_ty _res = NULL; |
| 7547 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7548 | { // lambda_param ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7549 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7550 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7551 | return NULL; |
| 7552 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7553 | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7554 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7555 | arg_ty a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7556 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7557 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7558 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7559 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7560 | ) |
| 7561 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7562 | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7563 | _res = a; |
| 7564 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7565 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7566 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7567 | return NULL; |
| 7568 | } |
| 7569 | goto done; |
| 7570 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7571 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7572 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7573 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7574 | } |
| 7575 | { // lambda_param &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7576 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7577 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7578 | return NULL; |
| 7579 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7580 | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7581 | arg_ty a; |
| 7582 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7583 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7584 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7585 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7586 | ) |
| 7587 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7588 | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7589 | _res = a; |
| 7590 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7591 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7592 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7593 | return NULL; |
| 7594 | } |
| 7595 | goto done; |
| 7596 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7597 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7598 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7599 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7600 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7601 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7602 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7603 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7604 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7605 | } |
| 7606 | |
| 7607 | // lambda_param_with_default: lambda_param default ',' | lambda_param default &':' |
| 7608 | static NameDefaultPair* |
| 7609 | lambda_param_with_default_rule(Parser *p) |
| 7610 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7611 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7612 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7613 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7614 | return NULL; |
| 7615 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7616 | NameDefaultPair* _res = NULL; |
| 7617 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7618 | { // lambda_param default ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7619 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7620 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7621 | return NULL; |
| 7622 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7623 | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7624 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7625 | arg_ty a; |
| 7626 | expr_ty c; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7627 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7628 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7629 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7630 | (c = default_rule(p)) // default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7631 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7632 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7633 | ) |
| 7634 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7635 | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7636 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 7637 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7638 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7639 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7640 | return NULL; |
| 7641 | } |
| 7642 | goto done; |
| 7643 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7644 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7645 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7646 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7647 | } |
| 7648 | { // lambda_param default &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7649 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7650 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7651 | return NULL; |
| 7652 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7653 | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7654 | arg_ty a; |
| 7655 | expr_ty c; |
| 7656 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7657 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7658 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7659 | (c = default_rule(p)) // default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7660 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7661 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7662 | ) |
| 7663 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7664 | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7665 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 7666 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7667 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7668 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7669 | return NULL; |
| 7670 | } |
| 7671 | goto done; |
| 7672 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7673 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7674 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7675 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7676 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7677 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7678 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7679 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7680 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7681 | } |
| 7682 | |
| 7683 | // lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' |
| 7684 | static NameDefaultPair* |
| 7685 | lambda_param_maybe_default_rule(Parser *p) |
| 7686 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7687 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7688 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7689 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7690 | return NULL; |
| 7691 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7692 | NameDefaultPair* _res = NULL; |
| 7693 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7694 | { // lambda_param default? ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7695 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7696 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7697 | return NULL; |
| 7698 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7699 | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7700 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7701 | arg_ty a; |
| 7702 | void *c; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7703 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7704 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7705 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7706 | (c = default_rule(p), 1) // default? |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7707 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7708 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7709 | ) |
| 7710 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7711 | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7712 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 7713 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7714 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7715 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7716 | return NULL; |
| 7717 | } |
| 7718 | goto done; |
| 7719 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7720 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7721 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7722 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7723 | } |
| 7724 | { // lambda_param default? &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7725 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7726 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7727 | return NULL; |
| 7728 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7729 | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7730 | arg_ty a; |
| 7731 | void *c; |
| 7732 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7733 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7734 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7735 | (c = default_rule(p), 1) // default? |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7736 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7737 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7738 | ) |
| 7739 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7740 | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7741 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 7742 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7743 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7744 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7745 | return NULL; |
| 7746 | } |
| 7747 | goto done; |
| 7748 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7749 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7750 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7751 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7752 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7753 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7754 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7755 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7756 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7757 | } |
| 7758 | |
| 7759 | // lambda_param: NAME |
| 7760 | static arg_ty |
| 7761 | lambda_param_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7762 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7763 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7764 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7765 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7766 | return NULL; |
| 7767 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7768 | arg_ty _res = NULL; |
| 7769 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7770 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7771 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7772 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7773 | return NULL; |
| 7774 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7775 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7776 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7777 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7778 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7779 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7780 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7781 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7782 | return NULL; |
| 7783 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7784 | D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7785 | expr_ty a; |
| 7786 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7787 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7788 | ) |
| 7789 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7790 | D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7791 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7792 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7793 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7794 | return NULL; |
| 7795 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7796 | int _end_lineno = _token->end_lineno; |
| 7797 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7798 | int _end_col_offset = _token->end_col_offset; |
| 7799 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7800 | _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA ); |
| 7801 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7802 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7803 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7804 | return NULL; |
| 7805 | } |
| 7806 | goto done; |
| 7807 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7808 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7809 | D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ', |
| 7810 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7811 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7812 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7813 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7814 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7815 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7816 | } |
| 7817 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7818 | // disjunction: conjunction (('or' conjunction))+ | conjunction |
| 7819 | static expr_ty |
| 7820 | disjunction_rule(Parser *p) |
| 7821 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7822 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7823 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7824 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7825 | return NULL; |
| 7826 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7827 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7828 | if (_PyPegen_is_memoized(p, disjunction_type, &_res)) { |
| 7829 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7830 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7831 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7832 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7833 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7834 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7835 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7836 | return NULL; |
| 7837 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7838 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7839 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7840 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7841 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7842 | { // conjunction (('or' conjunction))+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7843 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7844 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7845 | return NULL; |
| 7846 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7847 | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7848 | expr_ty a; |
| 7849 | asdl_seq * b; |
| 7850 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7851 | (a = conjunction_rule(p)) // conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7852 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7853 | (b = _loop1_89_rule(p)) // (('or' conjunction))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7854 | ) |
| 7855 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7856 | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7857 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7858 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7859 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7860 | return NULL; |
| 7861 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7862 | int _end_lineno = _token->end_lineno; |
| 7863 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7864 | int _end_col_offset = _token->end_col_offset; |
| 7865 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7866 | _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
| 7867 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7868 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7869 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7870 | return NULL; |
| 7871 | } |
| 7872 | goto done; |
| 7873 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7874 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7875 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 7876 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7877 | } |
| 7878 | { // conjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7879 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7880 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7881 | return NULL; |
| 7882 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7883 | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7884 | expr_ty conjunction_var; |
| 7885 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7886 | (conjunction_var = conjunction_rule(p)) // conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7887 | ) |
| 7888 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7889 | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7890 | _res = conjunction_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7891 | goto done; |
| 7892 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7893 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7894 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 7895 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7896 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7897 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7898 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7899 | _PyPegen_insert_memo(p, _mark, disjunction_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7900 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7901 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7902 | } |
| 7903 | |
| 7904 | // conjunction: inversion (('and' inversion))+ | inversion |
| 7905 | static expr_ty |
| 7906 | conjunction_rule(Parser *p) |
| 7907 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7908 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7909 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7910 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7911 | return NULL; |
| 7912 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7913 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7914 | if (_PyPegen_is_memoized(p, conjunction_type, &_res)) { |
| 7915 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7916 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7917 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7918 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7919 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7920 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7921 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7922 | return NULL; |
| 7923 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7924 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7925 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7926 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7927 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7928 | { // inversion (('and' inversion))+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7929 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7930 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7931 | return NULL; |
| 7932 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7933 | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7934 | expr_ty a; |
| 7935 | asdl_seq * b; |
| 7936 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7937 | (a = inversion_rule(p)) // inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7938 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7939 | (b = _loop1_90_rule(p)) // (('and' inversion))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7940 | ) |
| 7941 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7942 | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7943 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7944 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7945 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7946 | return NULL; |
| 7947 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7948 | int _end_lineno = _token->end_lineno; |
| 7949 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7950 | int _end_col_offset = _token->end_col_offset; |
| 7951 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7952 | _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
| 7953 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7954 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7955 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7956 | return NULL; |
| 7957 | } |
| 7958 | goto done; |
| 7959 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7960 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7961 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 7962 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7963 | } |
| 7964 | { // inversion |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7965 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7966 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7967 | return NULL; |
| 7968 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7969 | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7970 | expr_ty inversion_var; |
| 7971 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7972 | (inversion_var = inversion_rule(p)) // inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7973 | ) |
| 7974 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7975 | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7976 | _res = inversion_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7977 | goto done; |
| 7978 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7979 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7980 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 7981 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7982 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7983 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7984 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7985 | _PyPegen_insert_memo(p, _mark, conjunction_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7986 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7987 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7988 | } |
| 7989 | |
| 7990 | // inversion: 'not' inversion | comparison |
| 7991 | static expr_ty |
| 7992 | inversion_rule(Parser *p) |
| 7993 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7994 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7995 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7996 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7997 | return NULL; |
| 7998 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7999 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8000 | if (_PyPegen_is_memoized(p, inversion_type, &_res)) { |
| 8001 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8002 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8003 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8004 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8005 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8006 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8007 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8008 | return NULL; |
| 8009 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8010 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8011 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8012 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8013 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8014 | { // 'not' inversion |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8015 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8016 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8017 | return NULL; |
| 8018 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8019 | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8020 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8021 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8022 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8023 | (_keyword = _PyPegen_expect_token(p, 525)) // token='not' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8024 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8025 | (a = inversion_rule(p)) // inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8026 | ) |
| 8027 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8028 | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8029 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8030 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8031 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8032 | return NULL; |
| 8033 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8034 | int _end_lineno = _token->end_lineno; |
| 8035 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8036 | int _end_col_offset = _token->end_col_offset; |
| 8037 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8038 | _res = _Py_UnaryOp ( Not , a , EXTRA ); |
| 8039 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8040 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8041 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8042 | return NULL; |
| 8043 | } |
| 8044 | goto done; |
| 8045 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8046 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8047 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
| 8048 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8049 | } |
| 8050 | { // comparison |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8051 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8052 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8053 | return NULL; |
| 8054 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8055 | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8056 | expr_ty comparison_var; |
| 8057 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8058 | (comparison_var = comparison_rule(p)) // comparison |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8059 | ) |
| 8060 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8061 | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8062 | _res = comparison_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8063 | goto done; |
| 8064 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8065 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8066 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
| 8067 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8068 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8069 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8070 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8071 | _PyPegen_insert_memo(p, _mark, inversion_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8072 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8073 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8074 | } |
| 8075 | |
| 8076 | // comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or |
| 8077 | static expr_ty |
| 8078 | comparison_rule(Parser *p) |
| 8079 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8080 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8081 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8082 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8083 | return NULL; |
| 8084 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8085 | expr_ty _res = NULL; |
| 8086 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8087 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8088 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8089 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8090 | return NULL; |
| 8091 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8092 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8093 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8094 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8095 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8096 | { // bitwise_or compare_op_bitwise_or_pair+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8097 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8098 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8099 | return NULL; |
| 8100 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8101 | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8102 | expr_ty a; |
| 8103 | asdl_seq * b; |
| 8104 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8105 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8106 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8107 | (b = _loop1_91_rule(p)) // compare_op_bitwise_or_pair+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8108 | ) |
| 8109 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8110 | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8111 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8112 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8113 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8114 | return NULL; |
| 8115 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8116 | int _end_lineno = _token->end_lineno; |
| 8117 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8118 | int _end_col_offset = _token->end_col_offset; |
| 8119 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8120 | _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA ); |
| 8121 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8122 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8123 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8124 | return NULL; |
| 8125 | } |
| 8126 | goto done; |
| 8127 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8128 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8129 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
| 8130 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8131 | } |
| 8132 | { // bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8133 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8134 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8135 | return NULL; |
| 8136 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8137 | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8138 | expr_ty bitwise_or_var; |
| 8139 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8140 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8141 | ) |
| 8142 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8143 | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8144 | _res = bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8145 | goto done; |
| 8146 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8147 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8148 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
| 8149 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8150 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8151 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8152 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8153 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8154 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8155 | } |
| 8156 | |
| 8157 | // compare_op_bitwise_or_pair: |
| 8158 | // | eq_bitwise_or |
| 8159 | // | noteq_bitwise_or |
| 8160 | // | lte_bitwise_or |
| 8161 | // | lt_bitwise_or |
| 8162 | // | gte_bitwise_or |
| 8163 | // | gt_bitwise_or |
| 8164 | // | notin_bitwise_or |
| 8165 | // | in_bitwise_or |
| 8166 | // | isnot_bitwise_or |
| 8167 | // | is_bitwise_or |
| 8168 | static CmpopExprPair* |
| 8169 | compare_op_bitwise_or_pair_rule(Parser *p) |
| 8170 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8171 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8172 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8173 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8174 | return NULL; |
| 8175 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8176 | CmpopExprPair* _res = NULL; |
| 8177 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8178 | { // eq_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8179 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8180 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8181 | return NULL; |
| 8182 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8183 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8184 | CmpopExprPair* eq_bitwise_or_var; |
| 8185 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8186 | (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8187 | ) |
| 8188 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8189 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8190 | _res = eq_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8191 | goto done; |
| 8192 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8193 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8194 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8195 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8196 | } |
| 8197 | { // noteq_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8198 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8199 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8200 | return NULL; |
| 8201 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8202 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8203 | CmpopExprPair* noteq_bitwise_or_var; |
| 8204 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8205 | (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8206 | ) |
| 8207 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8208 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8209 | _res = noteq_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8210 | goto done; |
| 8211 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8212 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8213 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8214 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8215 | } |
| 8216 | { // lte_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8217 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8218 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8219 | return NULL; |
| 8220 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8221 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8222 | CmpopExprPair* lte_bitwise_or_var; |
| 8223 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8224 | (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8225 | ) |
| 8226 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8227 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8228 | _res = lte_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8229 | goto done; |
| 8230 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8231 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8232 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8233 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8234 | } |
| 8235 | { // lt_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8236 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8237 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8238 | return NULL; |
| 8239 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8240 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8241 | CmpopExprPair* lt_bitwise_or_var; |
| 8242 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8243 | (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8244 | ) |
| 8245 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8246 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8247 | _res = lt_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8248 | goto done; |
| 8249 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8250 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8251 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8252 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8253 | } |
| 8254 | { // gte_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8255 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8256 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8257 | return NULL; |
| 8258 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8259 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8260 | CmpopExprPair* gte_bitwise_or_var; |
| 8261 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8262 | (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8263 | ) |
| 8264 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8265 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8266 | _res = gte_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8267 | goto done; |
| 8268 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8269 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8270 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8271 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8272 | } |
| 8273 | { // gt_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8274 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8275 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8276 | return NULL; |
| 8277 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8278 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8279 | CmpopExprPair* gt_bitwise_or_var; |
| 8280 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8281 | (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8282 | ) |
| 8283 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8284 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8285 | _res = gt_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8286 | goto done; |
| 8287 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8288 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8289 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8290 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8291 | } |
| 8292 | { // notin_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8293 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8294 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8295 | return NULL; |
| 8296 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8297 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8298 | CmpopExprPair* notin_bitwise_or_var; |
| 8299 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8300 | (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8301 | ) |
| 8302 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8303 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8304 | _res = notin_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8305 | goto done; |
| 8306 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8307 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8308 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8309 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8310 | } |
| 8311 | { // in_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8312 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8313 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8314 | return NULL; |
| 8315 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8316 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8317 | CmpopExprPair* in_bitwise_or_var; |
| 8318 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8319 | (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8320 | ) |
| 8321 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8322 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8323 | _res = in_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8324 | goto done; |
| 8325 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8326 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8327 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8328 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8329 | } |
| 8330 | { // isnot_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8331 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8332 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8333 | return NULL; |
| 8334 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8335 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8336 | CmpopExprPair* isnot_bitwise_or_var; |
| 8337 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8338 | (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8339 | ) |
| 8340 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8341 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8342 | _res = isnot_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8343 | goto done; |
| 8344 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8345 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8346 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8347 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8348 | } |
| 8349 | { // is_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8350 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8351 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8352 | return NULL; |
| 8353 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8354 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8355 | CmpopExprPair* is_bitwise_or_var; |
| 8356 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8357 | (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8358 | ) |
| 8359 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8360 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8361 | _res = is_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8362 | goto done; |
| 8363 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8364 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8365 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8366 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8367 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8368 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8369 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8370 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8371 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8372 | } |
| 8373 | |
| 8374 | // eq_bitwise_or: '==' bitwise_or |
| 8375 | static CmpopExprPair* |
| 8376 | eq_bitwise_or_rule(Parser *p) |
| 8377 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8378 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8379 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8380 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8381 | return NULL; |
| 8382 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8383 | CmpopExprPair* _res = NULL; |
| 8384 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8385 | { // '==' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8386 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8387 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8388 | return NULL; |
| 8389 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8390 | D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8391 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8392 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8393 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8394 | (_literal = _PyPegen_expect_token(p, 27)) // token='==' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8395 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8396 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8397 | ) |
| 8398 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8399 | D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8400 | _res = _PyPegen_cmpop_expr_pair ( p , Eq , a ); |
| 8401 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8402 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8403 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8404 | return NULL; |
| 8405 | } |
| 8406 | goto done; |
| 8407 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8408 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8409 | D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8410 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8411 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8412 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8413 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8414 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8415 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8416 | } |
| 8417 | |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 8418 | // noteq_bitwise_or: ('!=') bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8419 | static CmpopExprPair* |
| 8420 | noteq_bitwise_or_rule(Parser *p) |
| 8421 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8422 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8423 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8424 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8425 | return NULL; |
| 8426 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8427 | CmpopExprPair* _res = NULL; |
| 8428 | int _mark = p->mark; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 8429 | { // ('!=') bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8430 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8431 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8432 | return NULL; |
| 8433 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8434 | D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 8435 | void *_tmp_92_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8436 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8437 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8438 | (_tmp_92_var = _tmp_92_rule(p)) // '!=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8439 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8440 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8441 | ) |
| 8442 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8443 | D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8444 | _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a ); |
| 8445 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8446 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8447 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8448 | return NULL; |
| 8449 | } |
| 8450 | goto done; |
| 8451 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8452 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8453 | D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8454 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8455 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8456 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8457 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8458 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8459 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8460 | } |
| 8461 | |
| 8462 | // lte_bitwise_or: '<=' bitwise_or |
| 8463 | static CmpopExprPair* |
| 8464 | lte_bitwise_or_rule(Parser *p) |
| 8465 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8466 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8467 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8468 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8469 | return NULL; |
| 8470 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8471 | CmpopExprPair* _res = NULL; |
| 8472 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8473 | { // '<=' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8474 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8475 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8476 | return NULL; |
| 8477 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8478 | D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8479 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8480 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8481 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8482 | (_literal = _PyPegen_expect_token(p, 29)) // token='<=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8483 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8484 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8485 | ) |
| 8486 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8487 | D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8488 | _res = _PyPegen_cmpop_expr_pair ( p , LtE , a ); |
| 8489 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8490 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8491 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8492 | return NULL; |
| 8493 | } |
| 8494 | goto done; |
| 8495 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8496 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8497 | D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8498 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8499 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8500 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8501 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8502 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8503 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8504 | } |
| 8505 | |
| 8506 | // lt_bitwise_or: '<' bitwise_or |
| 8507 | static CmpopExprPair* |
| 8508 | lt_bitwise_or_rule(Parser *p) |
| 8509 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8510 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8511 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8512 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8513 | return NULL; |
| 8514 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8515 | CmpopExprPair* _res = NULL; |
| 8516 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8517 | { // '<' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8518 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8519 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8520 | return NULL; |
| 8521 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8522 | D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8523 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8524 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8525 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8526 | (_literal = _PyPegen_expect_token(p, 20)) // token='<' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8527 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8528 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8529 | ) |
| 8530 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8531 | D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8532 | _res = _PyPegen_cmpop_expr_pair ( p , Lt , a ); |
| 8533 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8534 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8535 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8536 | return NULL; |
| 8537 | } |
| 8538 | goto done; |
| 8539 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8540 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8541 | D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8542 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8543 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8544 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8545 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8546 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8547 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8548 | } |
| 8549 | |
| 8550 | // gte_bitwise_or: '>=' bitwise_or |
| 8551 | static CmpopExprPair* |
| 8552 | gte_bitwise_or_rule(Parser *p) |
| 8553 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8554 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8555 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8556 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8557 | return NULL; |
| 8558 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8559 | CmpopExprPair* _res = NULL; |
| 8560 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8561 | { // '>=' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8562 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8563 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8564 | return NULL; |
| 8565 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8566 | D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8567 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8568 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8569 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8570 | (_literal = _PyPegen_expect_token(p, 30)) // token='>=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8571 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8572 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8573 | ) |
| 8574 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8575 | D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8576 | _res = _PyPegen_cmpop_expr_pair ( p , GtE , a ); |
| 8577 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8578 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8579 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8580 | return NULL; |
| 8581 | } |
| 8582 | goto done; |
| 8583 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8584 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8585 | D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8586 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8587 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8588 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8589 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8590 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8591 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8592 | } |
| 8593 | |
| 8594 | // gt_bitwise_or: '>' bitwise_or |
| 8595 | static CmpopExprPair* |
| 8596 | gt_bitwise_or_rule(Parser *p) |
| 8597 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8598 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8599 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8600 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8601 | return NULL; |
| 8602 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8603 | CmpopExprPair* _res = NULL; |
| 8604 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8605 | { // '>' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8606 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8607 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8608 | return NULL; |
| 8609 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8610 | D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8611 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8612 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8613 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8614 | (_literal = _PyPegen_expect_token(p, 21)) // token='>' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8615 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8616 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8617 | ) |
| 8618 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8619 | D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8620 | _res = _PyPegen_cmpop_expr_pair ( p , Gt , a ); |
| 8621 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8622 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8623 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8624 | return NULL; |
| 8625 | } |
| 8626 | goto done; |
| 8627 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8628 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8629 | D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8630 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8631 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8632 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8633 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8634 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8635 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8636 | } |
| 8637 | |
| 8638 | // notin_bitwise_or: 'not' 'in' bitwise_or |
| 8639 | static CmpopExprPair* |
| 8640 | notin_bitwise_or_rule(Parser *p) |
| 8641 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8642 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8643 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8644 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8645 | return NULL; |
| 8646 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8647 | CmpopExprPair* _res = NULL; |
| 8648 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8649 | { // 'not' 'in' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8650 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8651 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8652 | return NULL; |
| 8653 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8654 | D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8655 | Token * _keyword; |
| 8656 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8657 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8658 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8659 | (_keyword = _PyPegen_expect_token(p, 525)) // token='not' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8660 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8661 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8662 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8663 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8664 | ) |
| 8665 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8666 | D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8667 | _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a ); |
| 8668 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8669 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8670 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8671 | return NULL; |
| 8672 | } |
| 8673 | goto done; |
| 8674 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8675 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8676 | D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8677 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8678 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8679 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8680 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8681 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8682 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8683 | } |
| 8684 | |
| 8685 | // in_bitwise_or: 'in' bitwise_or |
| 8686 | static CmpopExprPair* |
| 8687 | in_bitwise_or_rule(Parser *p) |
| 8688 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8689 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8690 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8691 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8692 | return NULL; |
| 8693 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8694 | CmpopExprPair* _res = NULL; |
| 8695 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8696 | { // 'in' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8697 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8698 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8699 | return NULL; |
| 8700 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8701 | D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8702 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8703 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8704 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8705 | (_keyword = _PyPegen_expect_token(p, 518)) // token='in' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8706 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8707 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8708 | ) |
| 8709 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8710 | D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8711 | _res = _PyPegen_cmpop_expr_pair ( p , In , a ); |
| 8712 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8713 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8714 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8715 | return NULL; |
| 8716 | } |
| 8717 | goto done; |
| 8718 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8719 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8720 | D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8721 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8722 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8723 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8724 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8725 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8726 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8727 | } |
| 8728 | |
| 8729 | // isnot_bitwise_or: 'is' 'not' bitwise_or |
| 8730 | static CmpopExprPair* |
| 8731 | isnot_bitwise_or_rule(Parser *p) |
| 8732 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8733 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8734 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8735 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8736 | return NULL; |
| 8737 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8738 | CmpopExprPair* _res = NULL; |
| 8739 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8740 | { // 'is' 'not' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8741 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8742 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8743 | return NULL; |
| 8744 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8745 | D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8746 | Token * _keyword; |
| 8747 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8748 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8749 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8750 | (_keyword = _PyPegen_expect_token(p, 526)) // token='is' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8751 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8752 | (_keyword_1 = _PyPegen_expect_token(p, 525)) // token='not' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8753 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8754 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8755 | ) |
| 8756 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8757 | D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8758 | _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a ); |
| 8759 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8760 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8761 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8762 | return NULL; |
| 8763 | } |
| 8764 | goto done; |
| 8765 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8766 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8767 | D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8768 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8769 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8770 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8771 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8772 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8773 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8774 | } |
| 8775 | |
| 8776 | // is_bitwise_or: 'is' bitwise_or |
| 8777 | static CmpopExprPair* |
| 8778 | is_bitwise_or_rule(Parser *p) |
| 8779 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8780 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8781 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8782 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8783 | return NULL; |
| 8784 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8785 | CmpopExprPair* _res = NULL; |
| 8786 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8787 | { // 'is' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8788 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8789 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8790 | return NULL; |
| 8791 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8792 | D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8793 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8794 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8795 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8796 | (_keyword = _PyPegen_expect_token(p, 526)) // token='is' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8797 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8798 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8799 | ) |
| 8800 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8801 | D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8802 | _res = _PyPegen_cmpop_expr_pair ( p , Is , a ); |
| 8803 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8804 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8805 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8806 | return NULL; |
| 8807 | } |
| 8808 | goto done; |
| 8809 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8810 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8811 | D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8812 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8813 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8814 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8815 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8816 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8817 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8818 | } |
| 8819 | |
| 8820 | // Left-recursive |
| 8821 | // bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor |
| 8822 | static expr_ty bitwise_or_raw(Parser *); |
| 8823 | static expr_ty |
| 8824 | bitwise_or_rule(Parser *p) |
| 8825 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8826 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8827 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8828 | if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) { |
| 8829 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8830 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8831 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8832 | int _mark = p->mark; |
| 8833 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8834 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8835 | int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8836 | if (tmpvar_1) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8837 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8838 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8839 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8840 | p->mark = _mark; |
| 8841 | void *_raw = bitwise_or_raw(p); |
| 8842 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8843 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8844 | _resmark = p->mark; |
| 8845 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8846 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8847 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8848 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8849 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8850 | } |
| 8851 | static expr_ty |
| 8852 | bitwise_or_raw(Parser *p) |
| 8853 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8854 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8855 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8856 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8857 | return NULL; |
| 8858 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8859 | expr_ty _res = NULL; |
| 8860 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8861 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8862 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8863 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8864 | return NULL; |
| 8865 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8866 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8867 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8868 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8869 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8870 | { // bitwise_or '|' bitwise_xor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8871 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8872 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8873 | return NULL; |
| 8874 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8875 | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8876 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8877 | expr_ty a; |
| 8878 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8879 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8880 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8881 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8882 | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8883 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8884 | (b = bitwise_xor_rule(p)) // bitwise_xor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8885 | ) |
| 8886 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8887 | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8888 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8889 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8890 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8891 | return NULL; |
| 8892 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8893 | int _end_lineno = _token->end_lineno; |
| 8894 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8895 | int _end_col_offset = _token->end_col_offset; |
| 8896 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8897 | _res = _Py_BinOp ( a , BitOr , b , EXTRA ); |
| 8898 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8899 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8900 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8901 | return NULL; |
| 8902 | } |
| 8903 | goto done; |
| 8904 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8905 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8906 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8907 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8908 | } |
| 8909 | { // bitwise_xor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8910 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8911 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8912 | return NULL; |
| 8913 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8914 | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8915 | expr_ty bitwise_xor_var; |
| 8916 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8917 | (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8918 | ) |
| 8919 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8920 | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8921 | _res = bitwise_xor_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8922 | goto done; |
| 8923 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8924 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8925 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8926 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8927 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8928 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8929 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8930 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8931 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8932 | } |
| 8933 | |
| 8934 | // Left-recursive |
| 8935 | // bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and |
| 8936 | static expr_ty bitwise_xor_raw(Parser *); |
| 8937 | static expr_ty |
| 8938 | bitwise_xor_rule(Parser *p) |
| 8939 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8940 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8941 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8942 | if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) { |
| 8943 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8944 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8945 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8946 | int _mark = p->mark; |
| 8947 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8948 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8949 | int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8950 | if (tmpvar_2) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8951 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8952 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8953 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8954 | p->mark = _mark; |
| 8955 | void *_raw = bitwise_xor_raw(p); |
| 8956 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8957 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8958 | _resmark = p->mark; |
| 8959 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8960 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8961 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8962 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8963 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8964 | } |
| 8965 | static expr_ty |
| 8966 | bitwise_xor_raw(Parser *p) |
| 8967 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8968 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8969 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8970 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8971 | return NULL; |
| 8972 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8973 | expr_ty _res = NULL; |
| 8974 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8975 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8976 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8977 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8978 | return NULL; |
| 8979 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8980 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8981 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8982 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8983 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8984 | { // bitwise_xor '^' bitwise_and |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8985 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8986 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8987 | return NULL; |
| 8988 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8989 | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8990 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8991 | expr_ty a; |
| 8992 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8993 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8994 | (a = bitwise_xor_rule(p)) // bitwise_xor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8995 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8996 | (_literal = _PyPegen_expect_token(p, 32)) // token='^' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8997 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8998 | (b = bitwise_and_rule(p)) // bitwise_and |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8999 | ) |
| 9000 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9001 | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9002 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9003 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9004 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9005 | return NULL; |
| 9006 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9007 | int _end_lineno = _token->end_lineno; |
| 9008 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9009 | int _end_col_offset = _token->end_col_offset; |
| 9010 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9011 | _res = _Py_BinOp ( a , BitXor , b , EXTRA ); |
| 9012 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9013 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9014 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9015 | return NULL; |
| 9016 | } |
| 9017 | goto done; |
| 9018 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9019 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9020 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9021 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9022 | } |
| 9023 | { // bitwise_and |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9024 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9025 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9026 | return NULL; |
| 9027 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9028 | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9029 | expr_ty bitwise_and_var; |
| 9030 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9031 | (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9032 | ) |
| 9033 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9034 | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9035 | _res = bitwise_and_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9036 | goto done; |
| 9037 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9038 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9039 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9040 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9041 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9042 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9043 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9044 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9045 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9046 | } |
| 9047 | |
| 9048 | // Left-recursive |
| 9049 | // bitwise_and: bitwise_and '&' shift_expr | shift_expr |
| 9050 | static expr_ty bitwise_and_raw(Parser *); |
| 9051 | static expr_ty |
| 9052 | bitwise_and_rule(Parser *p) |
| 9053 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9054 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9055 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9056 | if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) { |
| 9057 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9058 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9059 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9060 | int _mark = p->mark; |
| 9061 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9062 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9063 | int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9064 | if (tmpvar_3) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9065 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9066 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9067 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9068 | p->mark = _mark; |
| 9069 | void *_raw = bitwise_and_raw(p); |
| 9070 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9071 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9072 | _resmark = p->mark; |
| 9073 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9074 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9075 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9076 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9077 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9078 | } |
| 9079 | static expr_ty |
| 9080 | bitwise_and_raw(Parser *p) |
| 9081 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9082 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9083 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9084 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9085 | return NULL; |
| 9086 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9087 | expr_ty _res = NULL; |
| 9088 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9089 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9090 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9091 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9092 | return NULL; |
| 9093 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9094 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9095 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9096 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9097 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9098 | { // bitwise_and '&' shift_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9099 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9100 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9101 | return NULL; |
| 9102 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9103 | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9104 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9105 | expr_ty a; |
| 9106 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9107 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9108 | (a = bitwise_and_rule(p)) // bitwise_and |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9109 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9110 | (_literal = _PyPegen_expect_token(p, 19)) // token='&' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9111 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9112 | (b = shift_expr_rule(p)) // shift_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9113 | ) |
| 9114 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9115 | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9116 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9117 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9118 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9119 | return NULL; |
| 9120 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9121 | int _end_lineno = _token->end_lineno; |
| 9122 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9123 | int _end_col_offset = _token->end_col_offset; |
| 9124 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9125 | _res = _Py_BinOp ( a , BitAnd , b , EXTRA ); |
| 9126 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9127 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9128 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9129 | return NULL; |
| 9130 | } |
| 9131 | goto done; |
| 9132 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9133 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9134 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
| 9135 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9136 | } |
| 9137 | { // shift_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9138 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9139 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9140 | return NULL; |
| 9141 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9142 | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9143 | expr_ty shift_expr_var; |
| 9144 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9145 | (shift_expr_var = shift_expr_rule(p)) // shift_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9146 | ) |
| 9147 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9148 | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9149 | _res = shift_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9150 | goto done; |
| 9151 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9152 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9153 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
| 9154 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9155 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9156 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9157 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9158 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9159 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9160 | } |
| 9161 | |
| 9162 | // Left-recursive |
| 9163 | // shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum |
| 9164 | static expr_ty shift_expr_raw(Parser *); |
| 9165 | static expr_ty |
| 9166 | shift_expr_rule(Parser *p) |
| 9167 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9168 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9169 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9170 | if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) { |
| 9171 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9172 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9173 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9174 | int _mark = p->mark; |
| 9175 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9176 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9177 | int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9178 | if (tmpvar_4) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9179 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9180 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9181 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9182 | p->mark = _mark; |
| 9183 | void *_raw = shift_expr_raw(p); |
| 9184 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9185 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9186 | _resmark = p->mark; |
| 9187 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9188 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9189 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9190 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9191 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9192 | } |
| 9193 | static expr_ty |
| 9194 | shift_expr_raw(Parser *p) |
| 9195 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9196 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9197 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9198 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9199 | return NULL; |
| 9200 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9201 | expr_ty _res = NULL; |
| 9202 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9203 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9204 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9205 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9206 | return NULL; |
| 9207 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9208 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9209 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9210 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9211 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9212 | { // shift_expr '<<' sum |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9213 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9214 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9215 | return NULL; |
| 9216 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9217 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9218 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9219 | expr_ty a; |
| 9220 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9221 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9222 | (a = shift_expr_rule(p)) // shift_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9223 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9224 | (_literal = _PyPegen_expect_token(p, 33)) // token='<<' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9225 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9226 | (b = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9227 | ) |
| 9228 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9229 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9230 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9231 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9232 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9233 | return NULL; |
| 9234 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9235 | int _end_lineno = _token->end_lineno; |
| 9236 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9237 | int _end_col_offset = _token->end_col_offset; |
| 9238 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9239 | _res = _Py_BinOp ( a , LShift , b , EXTRA ); |
| 9240 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9241 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9242 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9243 | return NULL; |
| 9244 | } |
| 9245 | goto done; |
| 9246 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9247 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9248 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 9249 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9250 | } |
| 9251 | { // shift_expr '>>' sum |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9252 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9253 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9254 | return NULL; |
| 9255 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9256 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9257 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9258 | expr_ty a; |
| 9259 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9260 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9261 | (a = shift_expr_rule(p)) // shift_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9262 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9263 | (_literal = _PyPegen_expect_token(p, 34)) // token='>>' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9264 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9265 | (b = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9266 | ) |
| 9267 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9268 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9269 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9270 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9271 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9272 | return NULL; |
| 9273 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9274 | int _end_lineno = _token->end_lineno; |
| 9275 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9276 | int _end_col_offset = _token->end_col_offset; |
| 9277 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9278 | _res = _Py_BinOp ( a , RShift , b , EXTRA ); |
| 9279 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9280 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9281 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9282 | return NULL; |
| 9283 | } |
| 9284 | goto done; |
| 9285 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9286 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9287 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 9288 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9289 | } |
| 9290 | { // sum |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9291 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9292 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9293 | return NULL; |
| 9294 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9295 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9296 | expr_ty sum_var; |
| 9297 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9298 | (sum_var = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9299 | ) |
| 9300 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9301 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9302 | _res = sum_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9303 | goto done; |
| 9304 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9305 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9306 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 9307 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9308 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9309 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9310 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9311 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9312 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9313 | } |
| 9314 | |
| 9315 | // Left-recursive |
| 9316 | // sum: sum '+' term | sum '-' term | term |
| 9317 | static expr_ty sum_raw(Parser *); |
| 9318 | static expr_ty |
| 9319 | sum_rule(Parser *p) |
| 9320 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9321 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9322 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9323 | if (_PyPegen_is_memoized(p, sum_type, &_res)) { |
| 9324 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9325 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9326 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9327 | int _mark = p->mark; |
| 9328 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9329 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9330 | int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9331 | if (tmpvar_5) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9332 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9333 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9334 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9335 | p->mark = _mark; |
| 9336 | void *_raw = sum_raw(p); |
| 9337 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9338 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9339 | _resmark = p->mark; |
| 9340 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9341 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9342 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9343 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9344 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9345 | } |
| 9346 | static expr_ty |
| 9347 | sum_raw(Parser *p) |
| 9348 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9349 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9350 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9351 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9352 | return NULL; |
| 9353 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9354 | expr_ty _res = NULL; |
| 9355 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9356 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9357 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9358 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9359 | return NULL; |
| 9360 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9361 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9362 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9363 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9364 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9365 | { // sum '+' term |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9366 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9367 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9368 | return NULL; |
| 9369 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9370 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9371 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9372 | expr_ty a; |
| 9373 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9374 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9375 | (a = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9376 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9377 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9378 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9379 | (b = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9380 | ) |
| 9381 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9382 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9383 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9384 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9385 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9386 | return NULL; |
| 9387 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9388 | int _end_lineno = _token->end_lineno; |
| 9389 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9390 | int _end_col_offset = _token->end_col_offset; |
| 9391 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9392 | _res = _Py_BinOp ( a , Add , b , EXTRA ); |
| 9393 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9394 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9395 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9396 | return NULL; |
| 9397 | } |
| 9398 | goto done; |
| 9399 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9400 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9401 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 9402 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9403 | } |
| 9404 | { // sum '-' term |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9405 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9406 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9407 | return NULL; |
| 9408 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9409 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9410 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9411 | expr_ty a; |
| 9412 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9413 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9414 | (a = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9415 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9416 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9417 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9418 | (b = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9419 | ) |
| 9420 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9421 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9422 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9423 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9424 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9425 | return NULL; |
| 9426 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9427 | int _end_lineno = _token->end_lineno; |
| 9428 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9429 | int _end_col_offset = _token->end_col_offset; |
| 9430 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9431 | _res = _Py_BinOp ( a , Sub , b , EXTRA ); |
| 9432 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9433 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9434 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9435 | return NULL; |
| 9436 | } |
| 9437 | goto done; |
| 9438 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9439 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9440 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 9441 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9442 | } |
| 9443 | { // term |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9444 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9445 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9446 | return NULL; |
| 9447 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9448 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9449 | expr_ty term_var; |
| 9450 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9451 | (term_var = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9452 | ) |
| 9453 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9454 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9455 | _res = term_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9456 | goto done; |
| 9457 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9458 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9459 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 9460 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9461 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9462 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9463 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9464 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9465 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9466 | } |
| 9467 | |
| 9468 | // Left-recursive |
| 9469 | // term: |
| 9470 | // | term '*' factor |
| 9471 | // | term '/' factor |
| 9472 | // | term '//' factor |
| 9473 | // | term '%' factor |
| 9474 | // | term '@' factor |
| 9475 | // | factor |
| 9476 | static expr_ty term_raw(Parser *); |
| 9477 | static expr_ty |
| 9478 | term_rule(Parser *p) |
| 9479 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9480 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9481 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9482 | if (_PyPegen_is_memoized(p, term_type, &_res)) { |
| 9483 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9484 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9485 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9486 | int _mark = p->mark; |
| 9487 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9488 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9489 | int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9490 | if (tmpvar_6) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9491 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9492 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9493 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9494 | p->mark = _mark; |
| 9495 | void *_raw = term_raw(p); |
| 9496 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9497 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9498 | _resmark = p->mark; |
| 9499 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9500 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9501 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9502 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9503 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9504 | } |
| 9505 | static expr_ty |
| 9506 | term_raw(Parser *p) |
| 9507 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9508 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9509 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9510 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9511 | return NULL; |
| 9512 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9513 | expr_ty _res = NULL; |
| 9514 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9515 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9516 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9517 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9518 | return NULL; |
| 9519 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9520 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9521 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9522 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9523 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9524 | { // term '*' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9525 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9526 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9527 | return NULL; |
| 9528 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9529 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9530 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9531 | expr_ty a; |
| 9532 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9533 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9534 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9535 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9536 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9537 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9538 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9539 | ) |
| 9540 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9541 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9542 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9543 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9544 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9545 | return NULL; |
| 9546 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9547 | int _end_lineno = _token->end_lineno; |
| 9548 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9549 | int _end_col_offset = _token->end_col_offset; |
| 9550 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9551 | _res = _Py_BinOp ( a , Mult , b , EXTRA ); |
| 9552 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9553 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9554 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9555 | return NULL; |
| 9556 | } |
| 9557 | goto done; |
| 9558 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9559 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9560 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9561 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9562 | } |
| 9563 | { // term '/' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9564 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9565 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9566 | return NULL; |
| 9567 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9568 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9569 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9570 | expr_ty a; |
| 9571 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9572 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9573 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9574 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9575 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9576 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9577 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9578 | ) |
| 9579 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9580 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9581 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9582 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9583 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9584 | return NULL; |
| 9585 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9586 | int _end_lineno = _token->end_lineno; |
| 9587 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9588 | int _end_col_offset = _token->end_col_offset; |
| 9589 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9590 | _res = _Py_BinOp ( a , Div , b , EXTRA ); |
| 9591 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9592 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9593 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9594 | return NULL; |
| 9595 | } |
| 9596 | goto done; |
| 9597 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9598 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9599 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9600 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9601 | } |
| 9602 | { // term '//' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9603 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9604 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9605 | return NULL; |
| 9606 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9607 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9608 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9609 | expr_ty a; |
| 9610 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9611 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9612 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9613 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9614 | (_literal = _PyPegen_expect_token(p, 47)) // token='//' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9615 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9616 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9617 | ) |
| 9618 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9619 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9620 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9621 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9622 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9623 | return NULL; |
| 9624 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9625 | int _end_lineno = _token->end_lineno; |
| 9626 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9627 | int _end_col_offset = _token->end_col_offset; |
| 9628 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9629 | _res = _Py_BinOp ( a , FloorDiv , b , EXTRA ); |
| 9630 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9631 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9632 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9633 | return NULL; |
| 9634 | } |
| 9635 | goto done; |
| 9636 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9637 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9638 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9639 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9640 | } |
| 9641 | { // term '%' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9642 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9643 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9644 | return NULL; |
| 9645 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9646 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9647 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9648 | expr_ty a; |
| 9649 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9650 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9651 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9652 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9653 | (_literal = _PyPegen_expect_token(p, 24)) // token='%' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9654 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9655 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9656 | ) |
| 9657 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9658 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9659 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9660 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9661 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9662 | return NULL; |
| 9663 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9664 | int _end_lineno = _token->end_lineno; |
| 9665 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9666 | int _end_col_offset = _token->end_col_offset; |
| 9667 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9668 | _res = _Py_BinOp ( a , Mod , b , EXTRA ); |
| 9669 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9670 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9671 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9672 | return NULL; |
| 9673 | } |
| 9674 | goto done; |
| 9675 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9676 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9677 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9678 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9679 | } |
| 9680 | { // term '@' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9681 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9682 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9683 | return NULL; |
| 9684 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9685 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9686 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9687 | expr_ty a; |
| 9688 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9689 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9690 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9691 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9692 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9693 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9694 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9695 | ) |
| 9696 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9697 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9698 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9699 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9700 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9701 | return NULL; |
| 9702 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9703 | int _end_lineno = _token->end_lineno; |
| 9704 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9705 | int _end_col_offset = _token->end_col_offset; |
| 9706 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9707 | _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) ); |
| 9708 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9709 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9710 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9711 | return NULL; |
| 9712 | } |
| 9713 | goto done; |
| 9714 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9715 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9716 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9717 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9718 | } |
| 9719 | { // factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9720 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9721 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9722 | return NULL; |
| 9723 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9724 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9725 | expr_ty factor_var; |
| 9726 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9727 | (factor_var = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9728 | ) |
| 9729 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9730 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9731 | _res = factor_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9732 | goto done; |
| 9733 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9734 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9735 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9736 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9737 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9738 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9739 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9740 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9741 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9742 | } |
| 9743 | |
| 9744 | // factor: '+' factor | '-' factor | '~' factor | power |
| 9745 | static expr_ty |
| 9746 | factor_rule(Parser *p) |
| 9747 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9748 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9749 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9750 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9751 | return NULL; |
| 9752 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9753 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9754 | if (_PyPegen_is_memoized(p, factor_type, &_res)) { |
| 9755 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9756 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9757 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9758 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9759 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9760 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9761 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9762 | return NULL; |
| 9763 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9764 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9765 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9766 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9767 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9768 | { // '+' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9769 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9770 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9771 | return NULL; |
| 9772 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9773 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9774 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9775 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9776 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9777 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9778 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9779 | (a = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9780 | ) |
| 9781 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9782 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9783 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9784 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9785 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9786 | return NULL; |
| 9787 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9788 | int _end_lineno = _token->end_lineno; |
| 9789 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9790 | int _end_col_offset = _token->end_col_offset; |
| 9791 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9792 | _res = _Py_UnaryOp ( UAdd , a , EXTRA ); |
| 9793 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9794 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9795 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9796 | return NULL; |
| 9797 | } |
| 9798 | goto done; |
| 9799 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9800 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9801 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9802 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9803 | } |
| 9804 | { // '-' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9805 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9806 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9807 | return NULL; |
| 9808 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9809 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9810 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9811 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9812 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9813 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9814 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9815 | (a = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9816 | ) |
| 9817 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9818 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9819 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9820 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9821 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9822 | return NULL; |
| 9823 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9824 | int _end_lineno = _token->end_lineno; |
| 9825 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9826 | int _end_col_offset = _token->end_col_offset; |
| 9827 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9828 | _res = _Py_UnaryOp ( USub , a , EXTRA ); |
| 9829 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9830 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9831 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9832 | return NULL; |
| 9833 | } |
| 9834 | goto done; |
| 9835 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9836 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9837 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9838 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9839 | } |
| 9840 | { // '~' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9841 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9842 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9843 | return NULL; |
| 9844 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9845 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9846 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9847 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9848 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9849 | (_literal = _PyPegen_expect_token(p, 31)) // token='~' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9850 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9851 | (a = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9852 | ) |
| 9853 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9854 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9855 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9856 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9857 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9858 | return NULL; |
| 9859 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9860 | int _end_lineno = _token->end_lineno; |
| 9861 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9862 | int _end_col_offset = _token->end_col_offset; |
| 9863 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9864 | _res = _Py_UnaryOp ( Invert , a , EXTRA ); |
| 9865 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9866 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9867 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9868 | return NULL; |
| 9869 | } |
| 9870 | goto done; |
| 9871 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9872 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9873 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9874 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9875 | } |
| 9876 | { // power |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9877 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9878 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9879 | return NULL; |
| 9880 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9881 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9882 | expr_ty power_var; |
| 9883 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9884 | (power_var = power_rule(p)) // power |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9885 | ) |
| 9886 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9887 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9888 | _res = power_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9889 | goto done; |
| 9890 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9891 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9892 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9893 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9894 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9895 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9896 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9897 | _PyPegen_insert_memo(p, _mark, factor_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9898 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9899 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9900 | } |
| 9901 | |
| 9902 | // power: await_primary '**' factor | await_primary |
| 9903 | static expr_ty |
| 9904 | power_rule(Parser *p) |
| 9905 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9906 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9907 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9908 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9909 | return NULL; |
| 9910 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9911 | expr_ty _res = NULL; |
| 9912 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9913 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9914 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9915 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9916 | return NULL; |
| 9917 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9918 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9919 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9920 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9921 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9922 | { // await_primary '**' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9923 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9924 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9925 | return NULL; |
| 9926 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9927 | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9928 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9929 | expr_ty a; |
| 9930 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9931 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9932 | (a = await_primary_rule(p)) // await_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9933 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9934 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9935 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9936 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9937 | ) |
| 9938 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9939 | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9940 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9941 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9942 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9943 | return NULL; |
| 9944 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9945 | int _end_lineno = _token->end_lineno; |
| 9946 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9947 | int _end_col_offset = _token->end_col_offset; |
| 9948 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9949 | _res = _Py_BinOp ( a , Pow , b , EXTRA ); |
| 9950 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9951 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9952 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9953 | return NULL; |
| 9954 | } |
| 9955 | goto done; |
| 9956 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9957 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9958 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
| 9959 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9960 | } |
| 9961 | { // await_primary |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9962 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9963 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9964 | return NULL; |
| 9965 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9966 | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9967 | expr_ty await_primary_var; |
| 9968 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9969 | (await_primary_var = await_primary_rule(p)) // await_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9970 | ) |
| 9971 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9972 | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9973 | _res = await_primary_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9974 | goto done; |
| 9975 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9976 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9977 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
| 9978 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9979 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9980 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9981 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9982 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9983 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9984 | } |
| 9985 | |
| 9986 | // await_primary: AWAIT primary | primary |
| 9987 | static expr_ty |
| 9988 | await_primary_rule(Parser *p) |
| 9989 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9990 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9991 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9992 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9993 | return NULL; |
| 9994 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9995 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9996 | if (_PyPegen_is_memoized(p, await_primary_type, &_res)) { |
| 9997 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9998 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9999 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10000 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10001 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10002 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10003 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10004 | return NULL; |
| 10005 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10006 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10007 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10008 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10009 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10010 | { // AWAIT primary |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10011 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10012 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10013 | return NULL; |
| 10014 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10015 | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10016 | expr_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 10017 | Token * await_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10018 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10019 | (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10020 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10021 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10022 | ) |
| 10023 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10024 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10025 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10026 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10027 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10028 | return NULL; |
| 10029 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10030 | int _end_lineno = _token->end_lineno; |
| 10031 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10032 | int _end_col_offset = _token->end_col_offset; |
| 10033 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10034 | _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) ); |
| 10035 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10036 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10037 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10038 | return NULL; |
| 10039 | } |
| 10040 | goto done; |
| 10041 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10042 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10043 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10044 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10045 | } |
| 10046 | { // primary |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10047 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10048 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10049 | return NULL; |
| 10050 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10051 | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10052 | expr_ty primary_var; |
| 10053 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10054 | (primary_var = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10055 | ) |
| 10056 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10057 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10058 | _res = primary_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10059 | goto done; |
| 10060 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10061 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10062 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10063 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10064 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10065 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10066 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10067 | _PyPegen_insert_memo(p, _mark, await_primary_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10068 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10069 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10070 | } |
| 10071 | |
| 10072 | // Left-recursive |
| 10073 | // primary: |
| 10074 | // | primary '.' NAME |
| 10075 | // | primary genexp |
| 10076 | // | primary '(' arguments? ')' |
| 10077 | // | primary '[' slices ']' |
| 10078 | // | atom |
| 10079 | static expr_ty primary_raw(Parser *); |
| 10080 | static expr_ty |
| 10081 | primary_rule(Parser *p) |
| 10082 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10083 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10084 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10085 | if (_PyPegen_is_memoized(p, primary_type, &_res)) { |
| 10086 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10087 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10088 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10089 | int _mark = p->mark; |
| 10090 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10091 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10092 | int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10093 | if (tmpvar_7) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10094 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10095 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10096 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10097 | p->mark = _mark; |
| 10098 | void *_raw = primary_raw(p); |
| 10099 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10100 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10101 | _resmark = p->mark; |
| 10102 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10103 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10104 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10105 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10106 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10107 | } |
| 10108 | static expr_ty |
| 10109 | primary_raw(Parser *p) |
| 10110 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10111 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10112 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10113 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10114 | return NULL; |
| 10115 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10116 | expr_ty _res = NULL; |
| 10117 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10118 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10119 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10120 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10121 | return NULL; |
| 10122 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10123 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10124 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10125 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10126 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10127 | { // primary '.' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10128 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10129 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10130 | return NULL; |
| 10131 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10132 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10133 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10134 | expr_ty a; |
| 10135 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10136 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10137 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10138 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10139 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10140 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10141 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10142 | ) |
| 10143 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10144 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10145 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10146 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10147 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10148 | return NULL; |
| 10149 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10150 | int _end_lineno = _token->end_lineno; |
| 10151 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10152 | int _end_col_offset = _token->end_col_offset; |
| 10153 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10154 | _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
| 10155 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10156 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10157 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10158 | return NULL; |
| 10159 | } |
| 10160 | goto done; |
| 10161 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10162 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10163 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10164 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10165 | } |
| 10166 | { // primary genexp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10167 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10168 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10169 | return NULL; |
| 10170 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10171 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10172 | expr_ty a; |
| 10173 | expr_ty b; |
| 10174 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10175 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10176 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10177 | (b = genexp_rule(p)) // genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10178 | ) |
| 10179 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10180 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10181 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10182 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10183 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10184 | return NULL; |
| 10185 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10186 | int _end_lineno = _token->end_lineno; |
| 10187 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10188 | int _end_col_offset = _token->end_col_offset; |
| 10189 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10190 | _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
| 10191 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10192 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10193 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10194 | return NULL; |
| 10195 | } |
| 10196 | goto done; |
| 10197 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10198 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10199 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10200 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10201 | } |
| 10202 | { // primary '(' arguments? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10203 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10204 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10205 | return NULL; |
| 10206 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10207 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10208 | Token * _literal; |
| 10209 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10210 | expr_ty a; |
| 10211 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10212 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10213 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10214 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10215 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10216 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10217 | (b = arguments_rule(p), 1) // arguments? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10218 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10219 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10220 | ) |
| 10221 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10222 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10223 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10224 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10225 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10226 | return NULL; |
| 10227 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10228 | int _end_lineno = _token->end_lineno; |
| 10229 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10230 | int _end_col_offset = _token->end_col_offset; |
| 10231 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10232 | _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 10233 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10234 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10235 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10236 | return NULL; |
| 10237 | } |
| 10238 | goto done; |
| 10239 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10240 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10241 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10242 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10243 | } |
| 10244 | { // primary '[' slices ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10245 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10246 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10247 | return NULL; |
| 10248 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10249 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10250 | Token * _literal; |
| 10251 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10252 | expr_ty a; |
| 10253 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10254 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10255 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10256 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10257 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10258 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10259 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10260 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10261 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10262 | ) |
| 10263 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10264 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10265 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10266 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10267 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10268 | return NULL; |
| 10269 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10270 | int _end_lineno = _token->end_lineno; |
| 10271 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10272 | int _end_col_offset = _token->end_col_offset; |
| 10273 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10274 | _res = _Py_Subscript ( a , b , Load , EXTRA ); |
| 10275 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10276 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10277 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10278 | return NULL; |
| 10279 | } |
| 10280 | goto done; |
| 10281 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10282 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10283 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10284 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10285 | } |
| 10286 | { // atom |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10287 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10288 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10289 | return NULL; |
| 10290 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10291 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10292 | expr_ty atom_var; |
| 10293 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10294 | (atom_var = atom_rule(p)) // atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10295 | ) |
| 10296 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10297 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10298 | _res = atom_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10299 | goto done; |
| 10300 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10301 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10302 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10303 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10304 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10305 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10306 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10307 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10308 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10309 | } |
| 10310 | |
| 10311 | // slices: slice !',' | ','.slice+ ','? |
| 10312 | static expr_ty |
| 10313 | slices_rule(Parser *p) |
| 10314 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10315 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10316 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10317 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10318 | return NULL; |
| 10319 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10320 | expr_ty _res = NULL; |
| 10321 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10322 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10323 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10324 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10325 | return NULL; |
| 10326 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10327 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10328 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10329 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10330 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10331 | { // slice !',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10332 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10333 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10334 | return NULL; |
| 10335 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10336 | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10337 | expr_ty a; |
| 10338 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10339 | (a = slice_rule(p)) // slice |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10340 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10341 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10342 | ) |
| 10343 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10344 | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10345 | _res = a; |
| 10346 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10347 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10348 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10349 | return NULL; |
| 10350 | } |
| 10351 | goto done; |
| 10352 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10353 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10354 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
| 10355 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10356 | } |
| 10357 | { // ','.slice+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10358 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10359 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10360 | return NULL; |
| 10361 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10362 | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10363 | void *_opt_var; |
| 10364 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10365 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10366 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10367 | (a = _gather_93_rule(p)) // ','.slice+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10368 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10369 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10370 | ) |
| 10371 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10372 | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10373 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10374 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10375 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10376 | return NULL; |
| 10377 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10378 | int _end_lineno = _token->end_lineno; |
| 10379 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10380 | int _end_col_offset = _token->end_col_offset; |
| 10381 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10382 | _res = _Py_Tuple ( a , Load , EXTRA ); |
| 10383 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10384 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10385 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10386 | return NULL; |
| 10387 | } |
| 10388 | goto done; |
| 10389 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10390 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10391 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
| 10392 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10393 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10394 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10395 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10396 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10397 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10398 | } |
| 10399 | |
| 10400 | // slice: expression? ':' expression? [':' expression?] | expression |
| 10401 | static expr_ty |
| 10402 | slice_rule(Parser *p) |
| 10403 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10404 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10405 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10406 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10407 | return NULL; |
| 10408 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10409 | expr_ty _res = NULL; |
| 10410 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10411 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10412 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10413 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10414 | return NULL; |
| 10415 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10416 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10417 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10418 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10419 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10420 | { // expression? ':' expression? [':' expression?] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10421 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10422 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10423 | return NULL; |
| 10424 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10425 | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10426 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10427 | void *a; |
| 10428 | void *b; |
| 10429 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10430 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10431 | (a = expression_rule(p), 1) // expression? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10432 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10433 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10434 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10435 | (b = expression_rule(p), 1) // expression? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10436 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10437 | (c = _tmp_95_rule(p), 1) // [':' expression?] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10438 | ) |
| 10439 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10440 | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10441 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10442 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10443 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10444 | return NULL; |
| 10445 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10446 | int _end_lineno = _token->end_lineno; |
| 10447 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10448 | int _end_col_offset = _token->end_col_offset; |
| 10449 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10450 | _res = _Py_Slice ( a , b , c , EXTRA ); |
| 10451 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10452 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10453 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10454 | return NULL; |
| 10455 | } |
| 10456 | goto done; |
| 10457 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10458 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10459 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
| 10460 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10461 | } |
| 10462 | { // expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10463 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10464 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10465 | return NULL; |
| 10466 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10467 | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10468 | expr_ty a; |
| 10469 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10470 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10471 | ) |
| 10472 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10473 | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10474 | _res = a; |
| 10475 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10476 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10477 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10478 | return NULL; |
| 10479 | } |
| 10480 | goto done; |
| 10481 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10482 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10483 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
| 10484 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10485 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10486 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10487 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10488 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10489 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10490 | } |
| 10491 | |
| 10492 | // atom: |
| 10493 | // | NAME |
| 10494 | // | 'True' |
| 10495 | // | 'False' |
| 10496 | // | 'None' |
| 10497 | // | '__new_parser__' |
| 10498 | // | &STRING strings |
| 10499 | // | NUMBER |
| 10500 | // | &'(' (tuple | group | genexp) |
| 10501 | // | &'[' (list | listcomp) |
| 10502 | // | &'{' (dict | set | dictcomp | setcomp) |
| 10503 | // | '...' |
| 10504 | static expr_ty |
| 10505 | atom_rule(Parser *p) |
| 10506 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10507 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10508 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10509 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10510 | return NULL; |
| 10511 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10512 | expr_ty _res = NULL; |
| 10513 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10514 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10515 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10516 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10517 | return NULL; |
| 10518 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10519 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10520 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10521 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10522 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10523 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10524 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10525 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10526 | return NULL; |
| 10527 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10528 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10529 | expr_ty name_var; |
| 10530 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10531 | (name_var = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10532 | ) |
| 10533 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10534 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10535 | _res = name_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10536 | goto done; |
| 10537 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10538 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10539 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10540 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10541 | } |
| 10542 | { // 'True' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10543 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10544 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10545 | return NULL; |
| 10546 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10547 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10548 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10549 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10550 | (_keyword = _PyPegen_expect_token(p, 527)) // token='True' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10551 | ) |
| 10552 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10553 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10554 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10555 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10556 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10557 | return NULL; |
| 10558 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10559 | int _end_lineno = _token->end_lineno; |
| 10560 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10561 | int _end_col_offset = _token->end_col_offset; |
| 10562 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10563 | _res = _Py_Constant ( Py_True , NULL , EXTRA ); |
| 10564 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10565 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10566 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10567 | return NULL; |
| 10568 | } |
| 10569 | goto done; |
| 10570 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10571 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10572 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10573 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10574 | } |
| 10575 | { // 'False' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10576 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10577 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10578 | return NULL; |
| 10579 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10580 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10581 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10582 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10583 | (_keyword = _PyPegen_expect_token(p, 528)) // token='False' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10584 | ) |
| 10585 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10586 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10587 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10588 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10589 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10590 | return NULL; |
| 10591 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10592 | int _end_lineno = _token->end_lineno; |
| 10593 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10594 | int _end_col_offset = _token->end_col_offset; |
| 10595 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10596 | _res = _Py_Constant ( Py_False , NULL , EXTRA ); |
| 10597 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10598 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10599 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10600 | return NULL; |
| 10601 | } |
| 10602 | goto done; |
| 10603 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10604 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10605 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10606 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10607 | } |
| 10608 | { // 'None' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10609 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10610 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10611 | return NULL; |
| 10612 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10613 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10614 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10615 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10616 | (_keyword = _PyPegen_expect_token(p, 529)) // token='None' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10617 | ) |
| 10618 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10619 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10620 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10621 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10622 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10623 | return NULL; |
| 10624 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10625 | int _end_lineno = _token->end_lineno; |
| 10626 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10627 | int _end_col_offset = _token->end_col_offset; |
| 10628 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10629 | _res = _Py_Constant ( Py_None , NULL , EXTRA ); |
| 10630 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10631 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10632 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10633 | return NULL; |
| 10634 | } |
| 10635 | goto done; |
| 10636 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10637 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10638 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10639 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10640 | } |
| 10641 | { // '__new_parser__' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10642 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10643 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10644 | return NULL; |
| 10645 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10646 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'__new_parser__'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10647 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10648 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10649 | (_keyword = _PyPegen_expect_token(p, 530)) // token='__new_parser__' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10650 | ) |
| 10651 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10652 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'__new_parser__'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10653 | _res = RAISE_SYNTAX_ERROR ( "You found it!" ); |
| 10654 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10655 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10656 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10657 | return NULL; |
| 10658 | } |
| 10659 | goto done; |
| 10660 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10661 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10662 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10663 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'__new_parser__'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10664 | } |
| 10665 | { // &STRING strings |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10666 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10667 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10668 | return NULL; |
| 10669 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10670 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10671 | expr_ty strings_var; |
| 10672 | if ( |
| 10673 | _PyPegen_lookahead(1, _PyPegen_string_token, p) |
| 10674 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10675 | (strings_var = strings_rule(p)) // strings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10676 | ) |
| 10677 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10678 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10679 | _res = strings_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10680 | goto done; |
| 10681 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10682 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10683 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10684 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10685 | } |
| 10686 | { // NUMBER |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10687 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10688 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10689 | return NULL; |
| 10690 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10691 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10692 | expr_ty number_var; |
| 10693 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10694 | (number_var = _PyPegen_number_token(p)) // NUMBER |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10695 | ) |
| 10696 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10697 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10698 | _res = number_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10699 | goto done; |
| 10700 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10701 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10702 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10703 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10704 | } |
| 10705 | { // &'(' (tuple | group | genexp) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10706 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10707 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10708 | return NULL; |
| 10709 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10710 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 10711 | void *_tmp_96_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10712 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10713 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10714 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10715 | (_tmp_96_var = _tmp_96_rule(p)) // tuple | group | genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10716 | ) |
| 10717 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10718 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10719 | _res = _tmp_96_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10720 | goto done; |
| 10721 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10722 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10723 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10724 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10725 | } |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10726 | { // &'[' (list | listcomp) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10727 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10728 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10729 | return NULL; |
| 10730 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10731 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 10732 | void *_tmp_97_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10733 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10734 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10735 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10736 | (_tmp_97_var = _tmp_97_rule(p)) // list | listcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10737 | ) |
| 10738 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10739 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10740 | _res = _tmp_97_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10741 | goto done; |
| 10742 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10743 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10744 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10745 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10746 | } |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10747 | { // &'{' (dict | set | dictcomp | setcomp) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10748 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10749 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10750 | return NULL; |
| 10751 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10752 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 10753 | void *_tmp_98_var; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10754 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10755 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10756 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10757 | (_tmp_98_var = _tmp_98_rule(p)) // dict | set | dictcomp | setcomp |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10758 | ) |
| 10759 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10760 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10761 | _res = _tmp_98_var; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10762 | goto done; |
| 10763 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10764 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10765 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10766 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10767 | } |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10768 | { // '...' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10769 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10770 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10771 | return NULL; |
| 10772 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10773 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10774 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10775 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10776 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10777 | ) |
| 10778 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10779 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10780 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10781 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10782 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10783 | return NULL; |
| 10784 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10785 | int _end_lineno = _token->end_lineno; |
| 10786 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10787 | int _end_col_offset = _token->end_col_offset; |
| 10788 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10789 | _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA ); |
| 10790 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10791 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10792 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10793 | return NULL; |
| 10794 | } |
| 10795 | goto done; |
| 10796 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10797 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10798 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10799 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10800 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10801 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10802 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10803 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10804 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10805 | } |
| 10806 | |
| 10807 | // strings: STRING+ |
| 10808 | static expr_ty |
| 10809 | strings_rule(Parser *p) |
| 10810 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10811 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10812 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10813 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10814 | return NULL; |
| 10815 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10816 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10817 | if (_PyPegen_is_memoized(p, strings_type, &_res)) { |
| 10818 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10819 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10820 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10821 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10822 | { // STRING+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10823 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10824 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10825 | return NULL; |
| 10826 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10827 | D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10828 | asdl_seq * a; |
| 10829 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10830 | (a = _loop1_99_rule(p)) // STRING+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10831 | ) |
| 10832 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10833 | D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10834 | _res = _PyPegen_concatenate_strings ( p , a ); |
| 10835 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10836 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10837 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10838 | return NULL; |
| 10839 | } |
| 10840 | goto done; |
| 10841 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10842 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10843 | D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', |
| 10844 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10845 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10846 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10847 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10848 | _PyPegen_insert_memo(p, _mark, strings_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10849 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10850 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10851 | } |
| 10852 | |
| 10853 | // list: '[' star_named_expressions? ']' |
| 10854 | static expr_ty |
| 10855 | list_rule(Parser *p) |
| 10856 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10857 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10858 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10859 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10860 | return NULL; |
| 10861 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10862 | expr_ty _res = NULL; |
| 10863 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10864 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10865 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10866 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10867 | return NULL; |
| 10868 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10869 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10870 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10871 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10872 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10873 | { // '[' star_named_expressions? ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10874 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10875 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10876 | return NULL; |
| 10877 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10878 | D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10879 | Token * _literal; |
| 10880 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10881 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10882 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10883 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10884 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10885 | (a = star_named_expressions_rule(p), 1) // star_named_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10886 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10887 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10888 | ) |
| 10889 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10890 | D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10891 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10892 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10893 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10894 | return NULL; |
| 10895 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10896 | int _end_lineno = _token->end_lineno; |
| 10897 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10898 | int _end_col_offset = _token->end_col_offset; |
| 10899 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10900 | _res = _Py_List ( a , Load , EXTRA ); |
| 10901 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10902 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10903 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10904 | return NULL; |
| 10905 | } |
| 10906 | goto done; |
| 10907 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10908 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10909 | D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ', |
| 10910 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10911 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10912 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10913 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10914 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10915 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10916 | } |
| 10917 | |
| 10918 | // listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension |
| 10919 | static expr_ty |
| 10920 | listcomp_rule(Parser *p) |
| 10921 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10922 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10923 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10924 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10925 | return NULL; |
| 10926 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10927 | expr_ty _res = NULL; |
| 10928 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10929 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10930 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10931 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10932 | return NULL; |
| 10933 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10934 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10935 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10936 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10937 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10938 | { // '[' named_expression for_if_clauses ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10939 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10940 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10941 | return NULL; |
| 10942 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10943 | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10944 | Token * _literal; |
| 10945 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10946 | expr_ty a; |
| 10947 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10948 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10949 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10950 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10951 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10952 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10953 | (b = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10954 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10955 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10956 | ) |
| 10957 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10958 | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10959 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10960 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10961 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10962 | return NULL; |
| 10963 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10964 | int _end_lineno = _token->end_lineno; |
| 10965 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10966 | int _end_col_offset = _token->end_col_offset; |
| 10967 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10968 | _res = _Py_ListComp ( a , b , EXTRA ); |
| 10969 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10970 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10971 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10972 | return NULL; |
| 10973 | } |
| 10974 | goto done; |
| 10975 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10976 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10977 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 10978 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10979 | } |
| 10980 | { // invalid_comprehension |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10981 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10982 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10983 | return NULL; |
| 10984 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10985 | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10986 | void *invalid_comprehension_var; |
| 10987 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10988 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10989 | ) |
| 10990 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10991 | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10992 | _res = invalid_comprehension_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10993 | goto done; |
| 10994 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10995 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10996 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 10997 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10998 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10999 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11000 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11001 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11002 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11003 | } |
| 11004 | |
| 11005 | // tuple: '(' [star_named_expression ',' star_named_expressions?] ')' |
| 11006 | static expr_ty |
| 11007 | tuple_rule(Parser *p) |
| 11008 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11009 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11010 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11011 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11012 | return NULL; |
| 11013 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11014 | expr_ty _res = NULL; |
| 11015 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11016 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11017 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11018 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11019 | return NULL; |
| 11020 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11021 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11022 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11023 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11024 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11025 | { // '(' [star_named_expression ',' star_named_expressions?] ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11026 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11027 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11028 | return NULL; |
| 11029 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11030 | D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11031 | Token * _literal; |
| 11032 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11033 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11034 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11035 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11036 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11037 | (a = _tmp_100_rule(p), 1) // [star_named_expression ',' star_named_expressions?] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11038 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11039 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11040 | ) |
| 11041 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11042 | D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11043 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11044 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11045 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11046 | return NULL; |
| 11047 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11048 | int _end_lineno = _token->end_lineno; |
| 11049 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11050 | int _end_col_offset = _token->end_col_offset; |
| 11051 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11052 | _res = _Py_Tuple ( a , Load , EXTRA ); |
| 11053 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11054 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11055 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11056 | return NULL; |
| 11057 | } |
| 11058 | goto done; |
| 11059 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11060 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11061 | D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ', |
| 11062 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11063 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11064 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11065 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11066 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11067 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11068 | } |
| 11069 | |
| 11070 | // group: '(' (yield_expr | named_expression) ')' |
| 11071 | static expr_ty |
| 11072 | group_rule(Parser *p) |
| 11073 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11074 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11075 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11076 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11077 | return NULL; |
| 11078 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11079 | expr_ty _res = NULL; |
| 11080 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11081 | { // '(' (yield_expr | named_expression) ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11082 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11083 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11084 | return NULL; |
| 11085 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11086 | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11087 | Token * _literal; |
| 11088 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11089 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11090 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11091 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11092 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11093 | (a = _tmp_101_rule(p)) // yield_expr | named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11094 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11095 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11096 | ) |
| 11097 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11098 | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11099 | _res = a; |
| 11100 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11101 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11102 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11103 | return NULL; |
| 11104 | } |
| 11105 | goto done; |
| 11106 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11107 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11108 | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', |
| 11109 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11110 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11111 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11112 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11113 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11114 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11115 | } |
| 11116 | |
| 11117 | // genexp: '(' expression for_if_clauses ')' | invalid_comprehension |
| 11118 | static expr_ty |
| 11119 | genexp_rule(Parser *p) |
| 11120 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11121 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11122 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11123 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11124 | return NULL; |
| 11125 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11126 | expr_ty _res = NULL; |
| 11127 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11128 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11129 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11130 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11131 | return NULL; |
| 11132 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11133 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11134 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11135 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11136 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11137 | { // '(' expression for_if_clauses ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11138 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11139 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11140 | return NULL; |
| 11141 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11142 | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression for_if_clauses ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11143 | Token * _literal; |
| 11144 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11145 | expr_ty a; |
| 11146 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11147 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11148 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11149 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11150 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11151 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11152 | (b = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11153 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11154 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11155 | ) |
| 11156 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11157 | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' expression for_if_clauses ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11158 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11159 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11160 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11161 | return NULL; |
| 11162 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11163 | int _end_lineno = _token->end_lineno; |
| 11164 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11165 | int _end_col_offset = _token->end_col_offset; |
| 11166 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11167 | _res = _Py_GeneratorExp ( a , b , EXTRA ); |
| 11168 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11169 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11170 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11171 | return NULL; |
| 11172 | } |
| 11173 | goto done; |
| 11174 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11175 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11176 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11177 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression for_if_clauses ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11178 | } |
| 11179 | { // invalid_comprehension |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11180 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11181 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11182 | return NULL; |
| 11183 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11184 | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11185 | void *invalid_comprehension_var; |
| 11186 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11187 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11188 | ) |
| 11189 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11190 | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11191 | _res = invalid_comprehension_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11192 | goto done; |
| 11193 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11194 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11195 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11196 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11197 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11198 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11199 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11200 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11201 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11202 | } |
| 11203 | |
| 11204 | // set: '{' expressions_list '}' |
| 11205 | static expr_ty |
| 11206 | set_rule(Parser *p) |
| 11207 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11208 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11209 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11210 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11211 | return NULL; |
| 11212 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11213 | expr_ty _res = NULL; |
| 11214 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11215 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11216 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11217 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11218 | return NULL; |
| 11219 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11220 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11221 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11222 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11223 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11224 | { // '{' expressions_list '}' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11225 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11226 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11227 | return NULL; |
| 11228 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11229 | D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11230 | Token * _literal; |
| 11231 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11232 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11233 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11234 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11235 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11236 | (a = expressions_list_rule(p)) // expressions_list |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11237 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11238 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11239 | ) |
| 11240 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11241 | D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11242 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11243 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11244 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11245 | return NULL; |
| 11246 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11247 | int _end_lineno = _token->end_lineno; |
| 11248 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11249 | int _end_col_offset = _token->end_col_offset; |
| 11250 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11251 | _res = _Py_Set ( a , EXTRA ); |
| 11252 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11253 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11254 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11255 | return NULL; |
| 11256 | } |
| 11257 | goto done; |
| 11258 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11259 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11260 | D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ', |
| 11261 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11262 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11263 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11264 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11265 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11266 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11267 | } |
| 11268 | |
| 11269 | // setcomp: '{' expression for_if_clauses '}' | invalid_comprehension |
| 11270 | static expr_ty |
| 11271 | setcomp_rule(Parser *p) |
| 11272 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11273 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11274 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11275 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11276 | return NULL; |
| 11277 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11278 | expr_ty _res = NULL; |
| 11279 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11280 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11281 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11282 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11283 | return NULL; |
| 11284 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11285 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11286 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11287 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11288 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11289 | { // '{' expression for_if_clauses '}' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11290 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11291 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11292 | return NULL; |
| 11293 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11294 | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression for_if_clauses '}'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11295 | Token * _literal; |
| 11296 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11297 | expr_ty a; |
| 11298 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11299 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11300 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11301 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11302 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11303 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11304 | (b = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11305 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11306 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11307 | ) |
| 11308 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11309 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expression for_if_clauses '}'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11310 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11311 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11312 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11313 | return NULL; |
| 11314 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11315 | int _end_lineno = _token->end_lineno; |
| 11316 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11317 | int _end_col_offset = _token->end_col_offset; |
| 11318 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11319 | _res = _Py_SetComp ( a , b , EXTRA ); |
| 11320 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11321 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11322 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11323 | return NULL; |
| 11324 | } |
| 11325 | goto done; |
| 11326 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11327 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11328 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11329 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression for_if_clauses '}'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11330 | } |
| 11331 | { // invalid_comprehension |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11332 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11333 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11334 | return NULL; |
| 11335 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11336 | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11337 | void *invalid_comprehension_var; |
| 11338 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11339 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11340 | ) |
| 11341 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11342 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11343 | _res = invalid_comprehension_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11344 | goto done; |
| 11345 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11346 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11347 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11348 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11349 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11350 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11351 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11352 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11353 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11354 | } |
| 11355 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11356 | // dict: '{' double_starred_kvpairs? '}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11357 | static expr_ty |
| 11358 | dict_rule(Parser *p) |
| 11359 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11360 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11361 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11362 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11363 | return NULL; |
| 11364 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11365 | expr_ty _res = NULL; |
| 11366 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11367 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11368 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11369 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11370 | return NULL; |
| 11371 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11372 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11373 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11374 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11375 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11376 | { // '{' double_starred_kvpairs? '}' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11377 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11378 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11379 | return NULL; |
| 11380 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11381 | D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11382 | Token * _literal; |
| 11383 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11384 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11385 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11386 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11387 | && |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11388 | (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11389 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11390 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11391 | ) |
| 11392 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11393 | D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11394 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11395 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11396 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11397 | return NULL; |
| 11398 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11399 | int _end_lineno = _token->end_lineno; |
| 11400 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11401 | int _end_col_offset = _token->end_col_offset; |
| 11402 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11403 | _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA ); |
| 11404 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11405 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11406 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11407 | return NULL; |
| 11408 | } |
| 11409 | goto done; |
| 11410 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11411 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11412 | D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ', |
| 11413 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11414 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11415 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11416 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11417 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11418 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11419 | } |
| 11420 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11421 | // dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11422 | static expr_ty |
| 11423 | dictcomp_rule(Parser *p) |
| 11424 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11425 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11426 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11427 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11428 | return NULL; |
| 11429 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11430 | expr_ty _res = NULL; |
| 11431 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11432 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11433 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11434 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11435 | return NULL; |
| 11436 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11437 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11438 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11439 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11440 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11441 | { // '{' kvpair for_if_clauses '}' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11442 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11443 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11444 | return NULL; |
| 11445 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11446 | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11447 | Token * _literal; |
| 11448 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11449 | KeyValuePair* a; |
| 11450 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11451 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11452 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11453 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11454 | (a = kvpair_rule(p)) // kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11455 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11456 | (b = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11457 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11458 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11459 | ) |
| 11460 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11461 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11462 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11463 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11464 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11465 | return NULL; |
| 11466 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11467 | int _end_lineno = _token->end_lineno; |
| 11468 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11469 | int _end_col_offset = _token->end_col_offset; |
| 11470 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11471 | _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA ); |
| 11472 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11473 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11474 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11475 | return NULL; |
| 11476 | } |
| 11477 | goto done; |
| 11478 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11479 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11480 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11481 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11482 | } |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11483 | { // invalid_dict_comprehension |
| 11484 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11485 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11486 | return NULL; |
| 11487 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11488 | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11489 | void *invalid_dict_comprehension_var; |
| 11490 | if ( |
| 11491 | (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension |
| 11492 | ) |
| 11493 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11494 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11495 | _res = invalid_dict_comprehension_var; |
| 11496 | goto done; |
| 11497 | } |
| 11498 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11499 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11500 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11501 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11502 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11503 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11504 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11505 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11506 | } |
| 11507 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11508 | // double_starred_kvpairs: ','.double_starred_kvpair+ ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11509 | static asdl_seq* |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11510 | double_starred_kvpairs_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11511 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11512 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11513 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11514 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11515 | return NULL; |
| 11516 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11517 | asdl_seq* _res = NULL; |
| 11518 | int _mark = p->mark; |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11519 | { // ','.double_starred_kvpair+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11520 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11521 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11522 | return NULL; |
| 11523 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11524 | D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11525 | void *_opt_var; |
| 11526 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11527 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11528 | if ( |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11529 | (a = _gather_102_rule(p)) // ','.double_starred_kvpair+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11530 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11531 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11532 | ) |
| 11533 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11534 | D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11535 | _res = a; |
| 11536 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11537 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11538 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11539 | return NULL; |
| 11540 | } |
| 11541 | goto done; |
| 11542 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11543 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11544 | D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', |
| 11545 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11546 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11547 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11548 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11549 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11550 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11551 | } |
| 11552 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11553 | // double_starred_kvpair: '**' bitwise_or | kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11554 | static KeyValuePair* |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11555 | double_starred_kvpair_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11556 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11557 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11558 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11559 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11560 | return NULL; |
| 11561 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11562 | KeyValuePair* _res = NULL; |
| 11563 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11564 | { // '**' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11565 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11566 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11567 | return NULL; |
| 11568 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11569 | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11570 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11571 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11572 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11573 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11574 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11575 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11576 | ) |
| 11577 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11578 | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11579 | _res = _PyPegen_key_value_pair ( p , NULL , a ); |
| 11580 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11581 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11582 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11583 | return NULL; |
| 11584 | } |
| 11585 | goto done; |
| 11586 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11587 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11588 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11589 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11590 | } |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11591 | { // kvpair |
| 11592 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11593 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11594 | return NULL; |
| 11595 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11596 | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11597 | KeyValuePair* kvpair_var; |
| 11598 | if ( |
| 11599 | (kvpair_var = kvpair_rule(p)) // kvpair |
| 11600 | ) |
| 11601 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11602 | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11603 | _res = kvpair_var; |
| 11604 | goto done; |
| 11605 | } |
| 11606 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11607 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11608 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11609 | } |
| 11610 | _res = NULL; |
| 11611 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11612 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11613 | return _res; |
| 11614 | } |
| 11615 | |
| 11616 | // kvpair: expression ':' expression |
| 11617 | static KeyValuePair* |
| 11618 | kvpair_rule(Parser *p) |
| 11619 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11620 | D(p->level++); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11621 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11622 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11623 | return NULL; |
| 11624 | } |
| 11625 | KeyValuePair* _res = NULL; |
| 11626 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11627 | { // expression ':' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11628 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11629 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11630 | return NULL; |
| 11631 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11632 | D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11633 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11634 | expr_ty a; |
| 11635 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11636 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11637 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11638 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11639 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11640 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11641 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11642 | ) |
| 11643 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11644 | D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11645 | _res = _PyPegen_key_value_pair ( p , a , b ); |
| 11646 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11647 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11648 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11649 | return NULL; |
| 11650 | } |
| 11651 | goto done; |
| 11652 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11653 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11654 | D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11655 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11656 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11657 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11658 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11659 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11660 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11661 | } |
| 11662 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11663 | // for_if_clauses: for_if_clause+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11664 | static asdl_seq* |
| 11665 | for_if_clauses_rule(Parser *p) |
| 11666 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11667 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11668 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11669 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11670 | return NULL; |
| 11671 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11672 | asdl_seq* _res = NULL; |
| 11673 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11674 | { // for_if_clause+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11675 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11676 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11677 | return NULL; |
| 11678 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11679 | D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 11680 | asdl_seq * _loop1_104_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11681 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11682 | (_loop1_104_var = _loop1_104_rule(p)) // for_if_clause+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11683 | ) |
| 11684 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11685 | D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11686 | _res = _loop1_104_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11687 | goto done; |
| 11688 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11689 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11690 | D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ', |
| 11691 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11692 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11693 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11694 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11695 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11696 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11697 | } |
| 11698 | |
| 11699 | // for_if_clause: |
| 11700 | // | ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* |
| 11701 | // | 'for' star_targets 'in' disjunction (('if' disjunction))* |
| 11702 | static comprehension_ty |
| 11703 | for_if_clause_rule(Parser *p) |
| 11704 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11705 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11706 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11707 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11708 | return NULL; |
| 11709 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11710 | comprehension_ty _res = NULL; |
| 11711 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11712 | { // ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11713 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11714 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11715 | return NULL; |
| 11716 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11717 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11718 | Token * _keyword; |
| 11719 | Token * _keyword_1; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11720 | expr_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 11721 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11722 | expr_ty b; |
| 11723 | asdl_seq * c; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11724 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11725 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11726 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11727 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11728 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11729 | (a = star_targets_rule(p)) // star_targets |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11730 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11731 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11732 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11733 | (b = disjunction_rule(p)) // disjunction |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11734 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11735 | (c = _loop0_105_rule(p)) // (('if' disjunction))* |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11736 | ) |
| 11737 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11738 | 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))*")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11739 | _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) ); |
| 11740 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11741 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11742 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11743 | return NULL; |
| 11744 | } |
| 11745 | goto done; |
| 11746 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11747 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11748 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
| 11749 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11750 | } |
| 11751 | { // 'for' star_targets 'in' disjunction (('if' disjunction))* |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11752 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11753 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11754 | return NULL; |
| 11755 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11756 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11757 | Token * _keyword; |
| 11758 | Token * _keyword_1; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11759 | expr_ty a; |
| 11760 | expr_ty b; |
| 11761 | asdl_seq * c; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11762 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11763 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11764 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11765 | (a = star_targets_rule(p)) // star_targets |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11766 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11767 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11768 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11769 | (b = disjunction_rule(p)) // disjunction |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11770 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11771 | (c = _loop0_106_rule(p)) // (('if' disjunction))* |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11772 | ) |
| 11773 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11774 | 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 | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11775 | _res = _Py_comprehension ( a , b , c , 0 , p -> arena ); |
| 11776 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11777 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11778 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11779 | return NULL; |
| 11780 | } |
| 11781 | goto done; |
| 11782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11783 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11784 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
| 11785 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11786 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11787 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11788 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11789 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11790 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11791 | } |
| 11792 | |
| 11793 | // yield_expr: 'yield' 'from' expression | 'yield' star_expressions? |
| 11794 | static expr_ty |
| 11795 | yield_expr_rule(Parser *p) |
| 11796 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11797 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11798 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11799 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11800 | return NULL; |
| 11801 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11802 | expr_ty _res = NULL; |
| 11803 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11804 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11805 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11806 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11807 | return NULL; |
| 11808 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11809 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11810 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11811 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11812 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11813 | { // 'yield' 'from' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11814 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11815 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11816 | return NULL; |
| 11817 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11818 | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11819 | Token * _keyword; |
| 11820 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11821 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11822 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11823 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11824 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11825 | (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11826 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11827 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11828 | ) |
| 11829 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11830 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11831 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11832 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11833 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11834 | return NULL; |
| 11835 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11836 | int _end_lineno = _token->end_lineno; |
| 11837 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11838 | int _end_col_offset = _token->end_col_offset; |
| 11839 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11840 | _res = _Py_YieldFrom ( a , EXTRA ); |
| 11841 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11842 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11843 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11844 | return NULL; |
| 11845 | } |
| 11846 | goto done; |
| 11847 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11848 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11849 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11850 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11851 | } |
| 11852 | { // 'yield' star_expressions? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11853 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11854 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11855 | return NULL; |
| 11856 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11857 | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11858 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11859 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11860 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11861 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11862 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11863 | (a = star_expressions_rule(p), 1) // star_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11864 | ) |
| 11865 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11866 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11867 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11868 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11869 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11870 | return NULL; |
| 11871 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11872 | int _end_lineno = _token->end_lineno; |
| 11873 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11874 | int _end_col_offset = _token->end_col_offset; |
| 11875 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11876 | _res = _Py_Yield ( a , EXTRA ); |
| 11877 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11878 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11879 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11880 | return NULL; |
| 11881 | } |
| 11882 | goto done; |
| 11883 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11884 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11885 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11886 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11887 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11888 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11889 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11890 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11891 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11892 | } |
| 11893 | |
| 11894 | // arguments: args ','? &')' | incorrect_arguments |
| 11895 | static expr_ty |
| 11896 | arguments_rule(Parser *p) |
| 11897 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11898 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11899 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11900 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11901 | return NULL; |
| 11902 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11903 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11904 | if (_PyPegen_is_memoized(p, arguments_type, &_res)) { |
| 11905 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11906 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11907 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11908 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11909 | { // args ','? &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11910 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11911 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11912 | return NULL; |
| 11913 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11914 | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11915 | void *_opt_var; |
| 11916 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11917 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11918 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11919 | (a = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11920 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11921 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11922 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11923 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11924 | ) |
| 11925 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11926 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11927 | _res = a; |
| 11928 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11929 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11930 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11931 | return NULL; |
| 11932 | } |
| 11933 | goto done; |
| 11934 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11935 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11936 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 11937 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11938 | } |
| 11939 | { // incorrect_arguments |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11940 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11941 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11942 | return NULL; |
| 11943 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11944 | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "incorrect_arguments")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11945 | void *incorrect_arguments_var; |
| 11946 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11947 | (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11948 | ) |
| 11949 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11950 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "incorrect_arguments")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11951 | _res = incorrect_arguments_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11952 | goto done; |
| 11953 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11954 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11955 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 11956 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11957 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11958 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11959 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11960 | _PyPegen_insert_memo(p, _mark, arguments_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11961 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11962 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11963 | } |
| 11964 | |
| 11965 | // args: starred_expression [',' args] | kwargs | named_expression [',' args] |
| 11966 | static expr_ty |
| 11967 | args_rule(Parser *p) |
| 11968 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11969 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11970 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11971 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11972 | return NULL; |
| 11973 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11974 | expr_ty _res = NULL; |
| 11975 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11976 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11977 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11978 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11979 | return NULL; |
| 11980 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11981 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11982 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11983 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11984 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11985 | { // starred_expression [',' args] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11986 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11987 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11988 | return NULL; |
| 11989 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11990 | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11991 | expr_ty a; |
| 11992 | void *b; |
| 11993 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11994 | (a = starred_expression_rule(p)) // starred_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11995 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11996 | (b = _tmp_107_rule(p), 1) // [',' args] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11997 | ) |
| 11998 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11999 | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12000 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12001 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12002 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12003 | return NULL; |
| 12004 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12005 | int _end_lineno = _token->end_lineno; |
| 12006 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12007 | int _end_col_offset = _token->end_col_offset; |
| 12008 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12009 | _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 12010 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12011 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12012 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12013 | return NULL; |
| 12014 | } |
| 12015 | goto done; |
| 12016 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12017 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12018 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
| 12019 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression [',' args]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12020 | } |
| 12021 | { // kwargs |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12022 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12023 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12024 | return NULL; |
| 12025 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12026 | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12027 | asdl_seq* a; |
| 12028 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12029 | (a = kwargs_rule(p)) // kwargs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12030 | ) |
| 12031 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12032 | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12033 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12034 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12035 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12036 | return NULL; |
| 12037 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12038 | int _end_lineno = _token->end_lineno; |
| 12039 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12040 | int _end_col_offset = _token->end_col_offset; |
| 12041 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12042 | _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA ); |
| 12043 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12044 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12045 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12046 | return NULL; |
| 12047 | } |
| 12048 | goto done; |
| 12049 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12050 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12051 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
| 12052 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12053 | } |
| 12054 | { // named_expression [',' args] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12055 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12056 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12057 | return NULL; |
| 12058 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12059 | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12060 | expr_ty a; |
| 12061 | void *b; |
| 12062 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12063 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12064 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12065 | (b = _tmp_108_rule(p), 1) // [',' args] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12066 | ) |
| 12067 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12068 | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12069 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12070 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12071 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12072 | return NULL; |
| 12073 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12074 | int _end_lineno = _token->end_lineno; |
| 12075 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12076 | int _end_col_offset = _token->end_col_offset; |
| 12077 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12078 | _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 12079 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12080 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12081 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12082 | return NULL; |
| 12083 | } |
| 12084 | goto done; |
| 12085 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12086 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12087 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
| 12088 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression [',' args]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12089 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12090 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12091 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12092 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12093 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12094 | } |
| 12095 | |
| 12096 | // kwargs: |
| 12097 | // | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
| 12098 | // | ','.kwarg_or_starred+ |
| 12099 | // | ','.kwarg_or_double_starred+ |
| 12100 | static asdl_seq* |
| 12101 | kwargs_rule(Parser *p) |
| 12102 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12103 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12104 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12105 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12106 | return NULL; |
| 12107 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12108 | asdl_seq* _res = NULL; |
| 12109 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12110 | { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12111 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12112 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12113 | return NULL; |
| 12114 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12115 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12116 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12117 | asdl_seq * a; |
| 12118 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12119 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12120 | (a = _gather_109_rule(p)) // ','.kwarg_or_starred+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12121 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12122 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12123 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12124 | (b = _gather_111_rule(p)) // ','.kwarg_or_double_starred+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12125 | ) |
| 12126 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12127 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12128 | _res = _PyPegen_join_sequences ( p , a , b ); |
| 12129 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12130 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12131 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12132 | return NULL; |
| 12133 | } |
| 12134 | goto done; |
| 12135 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12136 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12137 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 12138 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12139 | } |
| 12140 | { // ','.kwarg_or_starred+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12141 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12142 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12143 | return NULL; |
| 12144 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12145 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 12146 | asdl_seq * _gather_113_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12147 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12148 | (_gather_113_var = _gather_113_rule(p)) // ','.kwarg_or_starred+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12149 | ) |
| 12150 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12151 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12152 | _res = _gather_113_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12153 | goto done; |
| 12154 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12155 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12156 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 12157 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12158 | } |
| 12159 | { // ','.kwarg_or_double_starred+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12160 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12161 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12162 | return NULL; |
| 12163 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12164 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 12165 | asdl_seq * _gather_115_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12166 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12167 | (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_double_starred+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12168 | ) |
| 12169 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12170 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12171 | _res = _gather_115_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12172 | goto done; |
| 12173 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12174 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12175 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 12176 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12177 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12178 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12179 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12180 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12181 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12182 | } |
| 12183 | |
| 12184 | // starred_expression: '*' expression |
| 12185 | static expr_ty |
| 12186 | starred_expression_rule(Parser *p) |
| 12187 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12188 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12189 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12190 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12191 | return NULL; |
| 12192 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12193 | expr_ty _res = NULL; |
| 12194 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12195 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12196 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12197 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12198 | return NULL; |
| 12199 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12200 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12201 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12202 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12203 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12204 | { // '*' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12205 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12206 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12207 | return NULL; |
| 12208 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12209 | D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12210 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12211 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12212 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12213 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12214 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12215 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12216 | ) |
| 12217 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12218 | D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12219 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12220 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12221 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12222 | return NULL; |
| 12223 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12224 | int _end_lineno = _token->end_lineno; |
| 12225 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12226 | int _end_col_offset = _token->end_col_offset; |
| 12227 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12228 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 12229 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12230 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12231 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12232 | return NULL; |
| 12233 | } |
| 12234 | goto done; |
| 12235 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12236 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12237 | D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 12238 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12239 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12240 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12241 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12242 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12243 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12244 | } |
| 12245 | |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12246 | // kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12247 | static KeywordOrStarred* |
| 12248 | kwarg_or_starred_rule(Parser *p) |
| 12249 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12250 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12251 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12252 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12253 | return NULL; |
| 12254 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12255 | KeywordOrStarred* _res = NULL; |
| 12256 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12257 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12258 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12259 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12260 | return NULL; |
| 12261 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12262 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12263 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12264 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12265 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12266 | { // NAME '=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12267 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12268 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12269 | return NULL; |
| 12270 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12271 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12272 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12273 | expr_ty a; |
| 12274 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12275 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12276 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12277 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12278 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12279 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12280 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12281 | ) |
| 12282 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12283 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12284 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12285 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12286 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12287 | return NULL; |
| 12288 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12289 | int _end_lineno = _token->end_lineno; |
| 12290 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12291 | int _end_col_offset = _token->end_col_offset; |
| 12292 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12293 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
| 12294 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12295 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12296 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12297 | return NULL; |
| 12298 | } |
| 12299 | goto done; |
| 12300 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12301 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12302 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12303 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12304 | } |
| 12305 | { // starred_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12306 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12307 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12308 | return NULL; |
| 12309 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12310 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12311 | expr_ty a; |
| 12312 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12313 | (a = starred_expression_rule(p)) // starred_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12314 | ) |
| 12315 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12316 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12317 | _res = _PyPegen_keyword_or_starred ( p , a , 0 ); |
| 12318 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12319 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12320 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12321 | return NULL; |
| 12322 | } |
| 12323 | goto done; |
| 12324 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12325 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12326 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12327 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12328 | } |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12329 | { // invalid_kwarg |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12330 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12331 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12332 | return NULL; |
| 12333 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12334 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12335 | void *invalid_kwarg_var; |
| 12336 | if ( |
| 12337 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
| 12338 | ) |
| 12339 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12340 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12341 | _res = invalid_kwarg_var; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12342 | goto done; |
| 12343 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12344 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12345 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12346 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12347 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12348 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12349 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12350 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12351 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12352 | } |
| 12353 | |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12354 | // kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12355 | static KeywordOrStarred* |
| 12356 | kwarg_or_double_starred_rule(Parser *p) |
| 12357 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12358 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12359 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12360 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12361 | return NULL; |
| 12362 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12363 | KeywordOrStarred* _res = NULL; |
| 12364 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12365 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12366 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12367 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12368 | return NULL; |
| 12369 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12370 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12371 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12372 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12373 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12374 | { // NAME '=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12375 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12376 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12377 | return NULL; |
| 12378 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12379 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12380 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12381 | expr_ty a; |
| 12382 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12383 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12384 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12385 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12386 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12387 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12388 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12389 | ) |
| 12390 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12391 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12392 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12393 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12394 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12395 | return NULL; |
| 12396 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12397 | int _end_lineno = _token->end_lineno; |
| 12398 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12399 | int _end_col_offset = _token->end_col_offset; |
| 12400 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12401 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
| 12402 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12403 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12404 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12405 | return NULL; |
| 12406 | } |
| 12407 | goto done; |
| 12408 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12409 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12410 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12411 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12412 | } |
| 12413 | { // '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12414 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12415 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12416 | return NULL; |
| 12417 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12418 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12419 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12420 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12421 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12422 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12423 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12424 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12425 | ) |
| 12426 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12427 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12428 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12429 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12430 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12431 | return NULL; |
| 12432 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12433 | int _end_lineno = _token->end_lineno; |
| 12434 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12435 | int _end_col_offset = _token->end_col_offset; |
| 12436 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12437 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 ); |
| 12438 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12439 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12440 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12441 | return NULL; |
| 12442 | } |
| 12443 | goto done; |
| 12444 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12445 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12446 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12447 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12448 | } |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12449 | { // invalid_kwarg |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12450 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12451 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12452 | return NULL; |
| 12453 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12454 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12455 | void *invalid_kwarg_var; |
| 12456 | if ( |
| 12457 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
| 12458 | ) |
| 12459 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12460 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12461 | _res = invalid_kwarg_var; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12462 | goto done; |
| 12463 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12464 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12465 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12466 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12467 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12468 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12469 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12470 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12471 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12472 | } |
| 12473 | |
| 12474 | // star_targets: star_target !',' | star_target ((',' star_target))* ','? |
| 12475 | static expr_ty |
| 12476 | star_targets_rule(Parser *p) |
| 12477 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12478 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12479 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12480 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12481 | return NULL; |
| 12482 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12483 | expr_ty _res = NULL; |
| 12484 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12485 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12486 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12487 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12488 | return NULL; |
| 12489 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12490 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12491 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12492 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12493 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12494 | { // star_target !',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12495 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12496 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12497 | return NULL; |
| 12498 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12499 | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12500 | expr_ty a; |
| 12501 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12502 | (a = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12503 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12504 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12505 | ) |
| 12506 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12507 | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12508 | _res = a; |
| 12509 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12510 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12511 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12512 | return NULL; |
| 12513 | } |
| 12514 | goto done; |
| 12515 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12516 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12517 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 12518 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12519 | } |
| 12520 | { // star_target ((',' star_target))* ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12521 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12522 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12523 | return NULL; |
| 12524 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12525 | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12526 | void *_opt_var; |
| 12527 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12528 | expr_ty a; |
| 12529 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12530 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12531 | (a = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12532 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12533 | (b = _loop0_117_rule(p)) // ((',' star_target))* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12534 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12535 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12536 | ) |
| 12537 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12538 | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12539 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12540 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12541 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12542 | return NULL; |
| 12543 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12544 | int _end_lineno = _token->end_lineno; |
| 12545 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12546 | int _end_col_offset = _token->end_col_offset; |
| 12547 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12548 | _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA ); |
| 12549 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12550 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12551 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12552 | return NULL; |
| 12553 | } |
| 12554 | goto done; |
| 12555 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12556 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12557 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 12558 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12559 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12560 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12561 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12562 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12563 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12564 | } |
| 12565 | |
| 12566 | // star_targets_seq: ','.star_target+ ','? |
| 12567 | static asdl_seq* |
| 12568 | star_targets_seq_rule(Parser *p) |
| 12569 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12570 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12571 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12572 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12573 | return NULL; |
| 12574 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12575 | asdl_seq* _res = NULL; |
| 12576 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12577 | { // ','.star_target+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12578 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12579 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12580 | return NULL; |
| 12581 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12582 | D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12583 | void *_opt_var; |
| 12584 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12585 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12586 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12587 | (a = _gather_118_rule(p)) // ','.star_target+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12588 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12589 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12590 | ) |
| 12591 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12592 | D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12593 | _res = a; |
| 12594 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12595 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12596 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12597 | return NULL; |
| 12598 | } |
| 12599 | goto done; |
| 12600 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12601 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12602 | D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ', |
| 12603 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12604 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12605 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12606 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12607 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12608 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12609 | } |
| 12610 | |
| 12611 | // star_target: |
| 12612 | // | '*' (!'*' star_target) |
| 12613 | // | t_primary '.' NAME !t_lookahead |
| 12614 | // | t_primary '[' slices ']' !t_lookahead |
| 12615 | // | star_atom |
| 12616 | static expr_ty |
| 12617 | star_target_rule(Parser *p) |
| 12618 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12619 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12620 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12621 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12622 | return NULL; |
| 12623 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12624 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12625 | if (_PyPegen_is_memoized(p, star_target_type, &_res)) { |
| 12626 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12627 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12628 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12629 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12630 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12631 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12632 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12633 | return NULL; |
| 12634 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12635 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12636 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12637 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12638 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12639 | { // '*' (!'*' star_target) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12640 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12641 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12642 | return NULL; |
| 12643 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12644 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12645 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12646 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12647 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12648 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12649 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12650 | (a = _tmp_120_rule(p)) // !'*' star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12651 | ) |
| 12652 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12653 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12654 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12655 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12656 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12657 | return NULL; |
| 12658 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12659 | int _end_lineno = _token->end_lineno; |
| 12660 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12661 | int _end_col_offset = _token->end_col_offset; |
| 12662 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12663 | _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA ); |
| 12664 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12665 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12666 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12667 | return NULL; |
| 12668 | } |
| 12669 | goto done; |
| 12670 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12671 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12672 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12673 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12674 | } |
| 12675 | { // t_primary '.' NAME !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12676 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12677 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12678 | return NULL; |
| 12679 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12680 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12681 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12682 | expr_ty a; |
| 12683 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12684 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12685 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12686 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12687 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12688 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12689 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12690 | && |
| 12691 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 12692 | ) |
| 12693 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12694 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12695 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12696 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12697 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12698 | return NULL; |
| 12699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12700 | int _end_lineno = _token->end_lineno; |
| 12701 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12702 | int _end_col_offset = _token->end_col_offset; |
| 12703 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12704 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 12705 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12706 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12707 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12708 | return NULL; |
| 12709 | } |
| 12710 | goto done; |
| 12711 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12712 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12713 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12714 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12715 | } |
| 12716 | { // t_primary '[' slices ']' !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12717 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12718 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12719 | return NULL; |
| 12720 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12721 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12722 | Token * _literal; |
| 12723 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12724 | expr_ty a; |
| 12725 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12726 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12727 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12728 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12729 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12730 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12731 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12732 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12733 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12734 | && |
| 12735 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 12736 | ) |
| 12737 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12738 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12739 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12740 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12741 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12742 | return NULL; |
| 12743 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12744 | int _end_lineno = _token->end_lineno; |
| 12745 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12746 | int _end_col_offset = _token->end_col_offset; |
| 12747 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12748 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 12749 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12750 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12751 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12752 | return NULL; |
| 12753 | } |
| 12754 | goto done; |
| 12755 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12756 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12757 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12758 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12759 | } |
| 12760 | { // star_atom |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12761 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12762 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12763 | return NULL; |
| 12764 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12765 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12766 | expr_ty star_atom_var; |
| 12767 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12768 | (star_atom_var = star_atom_rule(p)) // star_atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12769 | ) |
| 12770 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12771 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12772 | _res = star_atom_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12773 | goto done; |
| 12774 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12775 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12776 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12777 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12778 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12779 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12780 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12781 | _PyPegen_insert_memo(p, _mark, star_target_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12782 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12783 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12784 | } |
| 12785 | |
| 12786 | // star_atom: |
| 12787 | // | NAME |
| 12788 | // | '(' star_target ')' |
| 12789 | // | '(' star_targets_seq? ')' |
| 12790 | // | '[' star_targets_seq? ']' |
| 12791 | static expr_ty |
| 12792 | star_atom_rule(Parser *p) |
| 12793 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12794 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12795 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12796 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12797 | return NULL; |
| 12798 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12799 | expr_ty _res = NULL; |
| 12800 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12801 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12802 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12803 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12804 | return NULL; |
| 12805 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12806 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12807 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12808 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12809 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12810 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12811 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12812 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12813 | return NULL; |
| 12814 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12815 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12816 | expr_ty a; |
| 12817 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12818 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12819 | ) |
| 12820 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12821 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12822 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 12823 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12824 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12825 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12826 | return NULL; |
| 12827 | } |
| 12828 | goto done; |
| 12829 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12830 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12831 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 12832 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12833 | } |
| 12834 | { // '(' star_target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12835 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12836 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12837 | return NULL; |
| 12838 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12839 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12840 | Token * _literal; |
| 12841 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12842 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12843 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12844 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12845 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12846 | (a = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12847 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12848 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12849 | ) |
| 12850 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12851 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12852 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 12853 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12854 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12855 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12856 | return NULL; |
| 12857 | } |
| 12858 | goto done; |
| 12859 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12860 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12861 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 12862 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12863 | } |
| 12864 | { // '(' star_targets_seq? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12865 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12866 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12867 | return NULL; |
| 12868 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12869 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12870 | Token * _literal; |
| 12871 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12872 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12873 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12874 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12875 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12876 | (a = star_targets_seq_rule(p), 1) // star_targets_seq? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12877 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12878 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12879 | ) |
| 12880 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12881 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12882 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12883 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12884 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12885 | return NULL; |
| 12886 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12887 | int _end_lineno = _token->end_lineno; |
| 12888 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12889 | int _end_col_offset = _token->end_col_offset; |
| 12890 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12891 | _res = _Py_Tuple ( a , Store , EXTRA ); |
| 12892 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12893 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12894 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12895 | return NULL; |
| 12896 | } |
| 12897 | goto done; |
| 12898 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12899 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12900 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 12901 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12902 | } |
| 12903 | { // '[' star_targets_seq? ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12904 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12905 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12906 | return NULL; |
| 12907 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12908 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12909 | Token * _literal; |
| 12910 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12911 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12912 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12913 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12914 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12915 | (a = star_targets_seq_rule(p), 1) // star_targets_seq? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12916 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12917 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12918 | ) |
| 12919 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12920 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12921 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12922 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12923 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12924 | return NULL; |
| 12925 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12926 | int _end_lineno = _token->end_lineno; |
| 12927 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12928 | int _end_col_offset = _token->end_col_offset; |
| 12929 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12930 | _res = _Py_List ( a , Store , EXTRA ); |
| 12931 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12932 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12933 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12934 | return NULL; |
| 12935 | } |
| 12936 | goto done; |
| 12937 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12938 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12939 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 12940 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12941 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12942 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12943 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12944 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12945 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12946 | } |
| 12947 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12948 | // single_target: single_subscript_attribute_target | NAME | '(' single_target ')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12949 | static expr_ty |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12950 | single_target_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12951 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12952 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12953 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12954 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12955 | return NULL; |
| 12956 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12957 | expr_ty _res = NULL; |
| 12958 | int _mark = p->mark; |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12959 | { // single_subscript_attribute_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12960 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12961 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12962 | return NULL; |
| 12963 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12964 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12965 | expr_ty single_subscript_attribute_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12966 | if ( |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12967 | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12968 | ) |
| 12969 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12970 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12971 | _res = single_subscript_attribute_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12972 | goto done; |
| 12973 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12974 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12975 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12976 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12977 | } |
| 12978 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12979 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12980 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12981 | return NULL; |
| 12982 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12983 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12984 | expr_ty a; |
| 12985 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12986 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12987 | ) |
| 12988 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12989 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12990 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 12991 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12992 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12993 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12994 | return NULL; |
| 12995 | } |
| 12996 | goto done; |
| 12997 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12998 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12999 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13000 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13001 | } |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 13002 | { // '(' single_target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13003 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13004 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13005 | return NULL; |
| 13006 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13007 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13008 | Token * _literal; |
| 13009 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13010 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13011 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13012 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13013 | && |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 13014 | (a = single_target_rule(p)) // single_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13015 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13016 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13017 | ) |
| 13018 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13019 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13020 | _res = a; |
| 13021 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13022 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13023 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13024 | return NULL; |
| 13025 | } |
| 13026 | goto done; |
| 13027 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13028 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13029 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13030 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13031 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13032 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13033 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13034 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13035 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13036 | } |
| 13037 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 13038 | // single_subscript_attribute_target: |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13039 | // | t_primary '.' NAME !t_lookahead |
| 13040 | // | t_primary '[' slices ']' !t_lookahead |
| 13041 | static expr_ty |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 13042 | single_subscript_attribute_target_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13043 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13044 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13045 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13046 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13047 | return NULL; |
| 13048 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13049 | expr_ty _res = NULL; |
| 13050 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13051 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13052 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13053 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13054 | return NULL; |
| 13055 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13056 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13057 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13058 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13059 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13060 | { // t_primary '.' NAME !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13061 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13062 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13063 | return NULL; |
| 13064 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13065 | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13066 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13067 | expr_ty a; |
| 13068 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13069 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13070 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13071 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13072 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13073 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13074 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13075 | && |
| 13076 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 13077 | ) |
| 13078 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13079 | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13080 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13081 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13082 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13083 | return NULL; |
| 13084 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13085 | int _end_lineno = _token->end_lineno; |
| 13086 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13087 | int _end_col_offset = _token->end_col_offset; |
| 13088 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13089 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 13090 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13091 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13092 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13093 | return NULL; |
| 13094 | } |
| 13095 | goto done; |
| 13096 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13097 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13098 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13099 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13100 | } |
| 13101 | { // t_primary '[' slices ']' !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13102 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13103 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13104 | return NULL; |
| 13105 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13106 | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13107 | Token * _literal; |
| 13108 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13109 | expr_ty a; |
| 13110 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13111 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13112 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13113 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13114 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13115 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13116 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13117 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13118 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13119 | && |
| 13120 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 13121 | ) |
| 13122 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13123 | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13124 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13125 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13126 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13127 | return NULL; |
| 13128 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13129 | int _end_lineno = _token->end_lineno; |
| 13130 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13131 | int _end_col_offset = _token->end_col_offset; |
| 13132 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13133 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 13134 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13135 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13136 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13137 | return NULL; |
| 13138 | } |
| 13139 | goto done; |
| 13140 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13141 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13142 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13143 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13144 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13145 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13146 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13147 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13148 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13149 | } |
| 13150 | |
| 13151 | // del_targets: ','.del_target+ ','? |
| 13152 | static asdl_seq* |
| 13153 | del_targets_rule(Parser *p) |
| 13154 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13155 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13156 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13157 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13158 | return NULL; |
| 13159 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13160 | asdl_seq* _res = NULL; |
| 13161 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13162 | { // ','.del_target+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13163 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13164 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13165 | return NULL; |
| 13166 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13167 | D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13168 | void *_opt_var; |
| 13169 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13170 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13171 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13172 | (a = _gather_121_rule(p)) // ','.del_target+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13173 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13174 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13175 | ) |
| 13176 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13177 | D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13178 | _res = a; |
| 13179 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13180 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13181 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13182 | return NULL; |
| 13183 | } |
| 13184 | goto done; |
| 13185 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13186 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13187 | D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 13188 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13189 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13190 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13191 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13192 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13193 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13194 | } |
| 13195 | |
| 13196 | // del_target: |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13197 | // | t_primary '.' NAME &del_target_end |
| 13198 | // | t_primary '[' slices ']' &del_target_end |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13199 | // | del_t_atom |
| 13200 | static expr_ty |
| 13201 | del_target_rule(Parser *p) |
| 13202 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13203 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13204 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13205 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13206 | return NULL; |
| 13207 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13208 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13209 | if (_PyPegen_is_memoized(p, del_target_type, &_res)) { |
| 13210 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13211 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13212 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13213 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13214 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13215 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13216 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13217 | return NULL; |
| 13218 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13219 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13220 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13221 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13222 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13223 | { // t_primary '.' NAME &del_target_end |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13224 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13225 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13226 | return NULL; |
| 13227 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13228 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &del_target_end")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13229 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13230 | expr_ty a; |
| 13231 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13232 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13233 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13234 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13235 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13236 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13237 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13238 | && |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13239 | _PyPegen_lookahead(1, del_target_end_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13240 | ) |
| 13241 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13242 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &del_target_end")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13243 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13244 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13245 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13246 | return NULL; |
| 13247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13248 | int _end_lineno = _token->end_lineno; |
| 13249 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13250 | int _end_col_offset = _token->end_col_offset; |
| 13251 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13252 | _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA ); |
| 13253 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13254 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13255 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13256 | return NULL; |
| 13257 | } |
| 13258 | goto done; |
| 13259 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13260 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13261 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13262 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &del_target_end")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13263 | } |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13264 | { // t_primary '[' slices ']' &del_target_end |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13265 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13266 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13267 | return NULL; |
| 13268 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13269 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13270 | Token * _literal; |
| 13271 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13272 | expr_ty a; |
| 13273 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13274 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13275 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13276 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13277 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13278 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13279 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13280 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13281 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13282 | && |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13283 | _PyPegen_lookahead(1, del_target_end_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13284 | ) |
| 13285 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13286 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13287 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13288 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13289 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13290 | return NULL; |
| 13291 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13292 | int _end_lineno = _token->end_lineno; |
| 13293 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13294 | int _end_col_offset = _token->end_col_offset; |
| 13295 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13296 | _res = _Py_Subscript ( a , b , Del , EXTRA ); |
| 13297 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13298 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13299 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13300 | return NULL; |
| 13301 | } |
| 13302 | goto done; |
| 13303 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13304 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13305 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13306 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13307 | } |
| 13308 | { // del_t_atom |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13309 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13310 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13311 | return NULL; |
| 13312 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13313 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13314 | expr_ty del_t_atom_var; |
| 13315 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13316 | (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13317 | ) |
| 13318 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13319 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13320 | _res = del_t_atom_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13321 | goto done; |
| 13322 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13323 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13324 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13325 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13326 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13327 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13328 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13329 | _PyPegen_insert_memo(p, _mark, del_target_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13330 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13331 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13332 | } |
| 13333 | |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13334 | // del_t_atom: |
| 13335 | // | NAME &del_target_end |
| 13336 | // | '(' del_target ')' |
| 13337 | // | '(' del_targets? ')' |
| 13338 | // | '[' del_targets? ']' |
| 13339 | // | invalid_del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13340 | static expr_ty |
| 13341 | del_t_atom_rule(Parser *p) |
| 13342 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13343 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13344 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13345 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13346 | return NULL; |
| 13347 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13348 | expr_ty _res = NULL; |
| 13349 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13350 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13351 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13352 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13353 | return NULL; |
| 13354 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13355 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13356 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13357 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13358 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13359 | { // NAME &del_target_end |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13360 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13361 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13362 | return NULL; |
| 13363 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13364 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME &del_target_end")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13365 | expr_ty a; |
| 13366 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13367 | (a = _PyPegen_name_token(p)) // NAME |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13368 | && |
| 13369 | _PyPegen_lookahead(1, del_target_end_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13370 | ) |
| 13371 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13372 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME &del_target_end")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13373 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
| 13374 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13375 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13376 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13377 | return NULL; |
| 13378 | } |
| 13379 | goto done; |
| 13380 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13381 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13382 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13383 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME &del_target_end")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13384 | } |
| 13385 | { // '(' del_target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13386 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13387 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13388 | return NULL; |
| 13389 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13390 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13391 | Token * _literal; |
| 13392 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13393 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13394 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13395 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13396 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13397 | (a = del_target_rule(p)) // del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13398 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13399 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13400 | ) |
| 13401 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13402 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13403 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
| 13404 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13405 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13406 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13407 | return NULL; |
| 13408 | } |
| 13409 | goto done; |
| 13410 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13411 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13412 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13413 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13414 | } |
| 13415 | { // '(' del_targets? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13416 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13417 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13418 | return NULL; |
| 13419 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13420 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13421 | Token * _literal; |
| 13422 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13423 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13424 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13425 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13426 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13427 | (a = del_targets_rule(p), 1) // del_targets? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13428 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13429 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13430 | ) |
| 13431 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13432 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13433 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13434 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13435 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13436 | return NULL; |
| 13437 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13438 | int _end_lineno = _token->end_lineno; |
| 13439 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13440 | int _end_col_offset = _token->end_col_offset; |
| 13441 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13442 | _res = _Py_Tuple ( a , Del , EXTRA ); |
| 13443 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13444 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13445 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13446 | return NULL; |
| 13447 | } |
| 13448 | goto done; |
| 13449 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13450 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13451 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13452 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13453 | } |
| 13454 | { // '[' del_targets? ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13455 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13456 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13457 | return NULL; |
| 13458 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13459 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13460 | Token * _literal; |
| 13461 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13462 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13463 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13464 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13465 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13466 | (a = del_targets_rule(p), 1) // del_targets? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13467 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13468 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13469 | ) |
| 13470 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13471 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13472 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13473 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13474 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13475 | return NULL; |
| 13476 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13477 | int _end_lineno = _token->end_lineno; |
| 13478 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13479 | int _end_col_offset = _token->end_col_offset; |
| 13480 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13481 | _res = _Py_List ( a , Del , EXTRA ); |
| 13482 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13483 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13484 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13485 | return NULL; |
| 13486 | } |
| 13487 | goto done; |
| 13488 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13489 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13490 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13491 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13492 | } |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13493 | { // invalid_del_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13494 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13495 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13496 | return NULL; |
| 13497 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13498 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_target")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13499 | void *invalid_del_target_var; |
| 13500 | if ( |
| 13501 | (invalid_del_target_var = invalid_del_target_rule(p)) // invalid_del_target |
| 13502 | ) |
| 13503 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13504 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_target")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13505 | _res = invalid_del_target_var; |
| 13506 | goto done; |
| 13507 | } |
| 13508 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13509 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13510 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_target")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13511 | } |
| 13512 | _res = NULL; |
| 13513 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13514 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13515 | return _res; |
| 13516 | } |
| 13517 | |
| 13518 | // del_target_end: ')' | ']' | ',' | ';' | NEWLINE |
| 13519 | static void * |
| 13520 | del_target_end_rule(Parser *p) |
| 13521 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13522 | D(p->level++); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13523 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13524 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13525 | return NULL; |
| 13526 | } |
| 13527 | void * _res = NULL; |
| 13528 | int _mark = p->mark; |
| 13529 | { // ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13530 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13531 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13532 | return NULL; |
| 13533 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13534 | D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13535 | Token * _literal; |
| 13536 | if ( |
| 13537 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 13538 | ) |
| 13539 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13540 | D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13541 | _res = _literal; |
| 13542 | goto done; |
| 13543 | } |
| 13544 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13545 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13546 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13547 | } |
| 13548 | { // ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13549 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13550 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13551 | return NULL; |
| 13552 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13553 | D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "']'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13554 | Token * _literal; |
| 13555 | if ( |
| 13556 | (_literal = _PyPegen_expect_token(p, 10)) // token=']' |
| 13557 | ) |
| 13558 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13559 | D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "']'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13560 | _res = _literal; |
| 13561 | goto done; |
| 13562 | } |
| 13563 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13564 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13565 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "']'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13566 | } |
| 13567 | { // ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13568 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13569 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13570 | return NULL; |
| 13571 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13572 | D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13573 | Token * _literal; |
| 13574 | if ( |
| 13575 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 13576 | ) |
| 13577 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13578 | D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13579 | _res = _literal; |
| 13580 | goto done; |
| 13581 | } |
| 13582 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13583 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13584 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13585 | } |
| 13586 | { // ';' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13587 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13588 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13589 | return NULL; |
| 13590 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13591 | D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13592 | Token * _literal; |
| 13593 | if ( |
| 13594 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
| 13595 | ) |
| 13596 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13597 | D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13598 | _res = _literal; |
| 13599 | goto done; |
| 13600 | } |
| 13601 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13602 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13603 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13604 | } |
| 13605 | { // NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13606 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13607 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13608 | return NULL; |
| 13609 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13610 | D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13611 | Token * newline_var; |
| 13612 | if ( |
| 13613 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 13614 | ) |
| 13615 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13616 | D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13617 | _res = newline_var; |
| 13618 | goto done; |
| 13619 | } |
| 13620 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13621 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13622 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13623 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13624 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13625 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13626 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13627 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13628 | } |
| 13629 | |
| 13630 | // targets: ','.target+ ','? |
| 13631 | static asdl_seq* |
| 13632 | targets_rule(Parser *p) |
| 13633 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13634 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13635 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13636 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13637 | return NULL; |
| 13638 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13639 | asdl_seq* _res = NULL; |
| 13640 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13641 | { // ','.target+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13642 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13643 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13644 | return NULL; |
| 13645 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13646 | D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13647 | void *_opt_var; |
| 13648 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13649 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13650 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13651 | (a = _gather_123_rule(p)) // ','.target+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13652 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13653 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13654 | ) |
| 13655 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13656 | D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13657 | _res = a; |
| 13658 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13659 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13660 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13661 | return NULL; |
| 13662 | } |
| 13663 | goto done; |
| 13664 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13665 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13666 | D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 13667 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13668 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13669 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13670 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13671 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13672 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13673 | } |
| 13674 | |
| 13675 | // target: |
| 13676 | // | t_primary '.' NAME !t_lookahead |
| 13677 | // | t_primary '[' slices ']' !t_lookahead |
| 13678 | // | t_atom |
| 13679 | static expr_ty |
| 13680 | target_rule(Parser *p) |
| 13681 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13682 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13683 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13684 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13685 | return NULL; |
| 13686 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13687 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13688 | if (_PyPegen_is_memoized(p, target_type, &_res)) { |
| 13689 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13690 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13691 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13692 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13693 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13694 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13695 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13696 | return NULL; |
| 13697 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13698 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13699 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13700 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13701 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13702 | { // t_primary '.' NAME !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13703 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13704 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13705 | return NULL; |
| 13706 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13707 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13708 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13709 | expr_ty a; |
| 13710 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13711 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13712 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13713 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13714 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13715 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13716 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13717 | && |
| 13718 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 13719 | ) |
| 13720 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13721 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13722 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13723 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13724 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13725 | return NULL; |
| 13726 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13727 | int _end_lineno = _token->end_lineno; |
| 13728 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13729 | int _end_col_offset = _token->end_col_offset; |
| 13730 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13731 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 13732 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13733 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13734 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13735 | return NULL; |
| 13736 | } |
| 13737 | goto done; |
| 13738 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13739 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13740 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13741 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13742 | } |
| 13743 | { // t_primary '[' slices ']' !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13744 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13745 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13746 | return NULL; |
| 13747 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13748 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13749 | Token * _literal; |
| 13750 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13751 | expr_ty a; |
| 13752 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13753 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13754 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13755 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13756 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13757 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13758 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13759 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13760 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13761 | && |
| 13762 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 13763 | ) |
| 13764 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13765 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13766 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13767 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13768 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13769 | return NULL; |
| 13770 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13771 | int _end_lineno = _token->end_lineno; |
| 13772 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13773 | int _end_col_offset = _token->end_col_offset; |
| 13774 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13775 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 13776 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13777 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13778 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13779 | return NULL; |
| 13780 | } |
| 13781 | goto done; |
| 13782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13783 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13784 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13785 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13786 | } |
| 13787 | { // t_atom |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13788 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13789 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13790 | return NULL; |
| 13791 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13792 | D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13793 | expr_ty t_atom_var; |
| 13794 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13795 | (t_atom_var = t_atom_rule(p)) // t_atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13796 | ) |
| 13797 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13798 | D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13799 | _res = t_atom_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13800 | goto done; |
| 13801 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13802 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13803 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13804 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13805 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13806 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13807 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13808 | _PyPegen_insert_memo(p, _mark, target_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13809 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13810 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13811 | } |
| 13812 | |
| 13813 | // Left-recursive |
| 13814 | // t_primary: |
| 13815 | // | t_primary '.' NAME &t_lookahead |
| 13816 | // | t_primary '[' slices ']' &t_lookahead |
| 13817 | // | t_primary genexp &t_lookahead |
| 13818 | // | t_primary '(' arguments? ')' &t_lookahead |
| 13819 | // | atom &t_lookahead |
| 13820 | static expr_ty t_primary_raw(Parser *); |
| 13821 | static expr_ty |
| 13822 | t_primary_rule(Parser *p) |
| 13823 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13824 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13825 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13826 | if (_PyPegen_is_memoized(p, t_primary_type, &_res)) { |
| 13827 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13828 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13829 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13830 | int _mark = p->mark; |
| 13831 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13832 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13833 | int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13834 | if (tmpvar_8) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13835 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13836 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13837 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13838 | p->mark = _mark; |
| 13839 | void *_raw = t_primary_raw(p); |
| 13840 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13841 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13842 | _resmark = p->mark; |
| 13843 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13844 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13845 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13846 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13847 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13848 | } |
| 13849 | static expr_ty |
| 13850 | t_primary_raw(Parser *p) |
| 13851 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13852 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13853 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13854 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13855 | return NULL; |
| 13856 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13857 | expr_ty _res = NULL; |
| 13858 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13859 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13860 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13861 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13862 | return NULL; |
| 13863 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13864 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13865 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13866 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13867 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13868 | { // t_primary '.' NAME &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13869 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13870 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13871 | return NULL; |
| 13872 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13873 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13874 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13875 | expr_ty a; |
| 13876 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13877 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13878 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13879 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13880 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13881 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13882 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13883 | && |
| 13884 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 13885 | ) |
| 13886 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13887 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13888 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13889 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13890 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13891 | return NULL; |
| 13892 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13893 | int _end_lineno = _token->end_lineno; |
| 13894 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13895 | int _end_col_offset = _token->end_col_offset; |
| 13896 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13897 | _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
| 13898 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13899 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13900 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13901 | return NULL; |
| 13902 | } |
| 13903 | goto done; |
| 13904 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13905 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13906 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 13907 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13908 | } |
| 13909 | { // t_primary '[' slices ']' &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13910 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13911 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13912 | return NULL; |
| 13913 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13914 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13915 | Token * _literal; |
| 13916 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13917 | expr_ty a; |
| 13918 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13919 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13920 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13921 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13922 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13923 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13924 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13925 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13926 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13927 | && |
| 13928 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 13929 | ) |
| 13930 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13931 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13932 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13933 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13934 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13935 | return NULL; |
| 13936 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13937 | int _end_lineno = _token->end_lineno; |
| 13938 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13939 | int _end_col_offset = _token->end_col_offset; |
| 13940 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13941 | _res = _Py_Subscript ( a , b , Load , EXTRA ); |
| 13942 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13943 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13944 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13945 | return NULL; |
| 13946 | } |
| 13947 | goto done; |
| 13948 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13949 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13950 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 13951 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13952 | } |
| 13953 | { // t_primary genexp &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13954 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13955 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13956 | return NULL; |
| 13957 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13958 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13959 | expr_ty a; |
| 13960 | expr_ty b; |
| 13961 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13962 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13963 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13964 | (b = genexp_rule(p)) // genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13965 | && |
| 13966 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 13967 | ) |
| 13968 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13969 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13970 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13971 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13972 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13973 | return NULL; |
| 13974 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13975 | int _end_lineno = _token->end_lineno; |
| 13976 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13977 | int _end_col_offset = _token->end_col_offset; |
| 13978 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13979 | _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
| 13980 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13981 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13982 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13983 | return NULL; |
| 13984 | } |
| 13985 | goto done; |
| 13986 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13987 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13988 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 13989 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13990 | } |
| 13991 | { // t_primary '(' arguments? ')' &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13992 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13993 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13994 | return NULL; |
| 13995 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13996 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13997 | Token * _literal; |
| 13998 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13999 | expr_ty a; |
| 14000 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14001 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14002 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14003 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14004 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14005 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14006 | (b = arguments_rule(p), 1) // arguments? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14007 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14008 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14009 | && |
| 14010 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 14011 | ) |
| 14012 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14013 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14014 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14015 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14016 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14017 | return NULL; |
| 14018 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14019 | int _end_lineno = _token->end_lineno; |
| 14020 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14021 | int _end_col_offset = _token->end_col_offset; |
| 14022 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14023 | _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 14024 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14025 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14026 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14027 | return NULL; |
| 14028 | } |
| 14029 | goto done; |
| 14030 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14031 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14032 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 14033 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14034 | } |
| 14035 | { // atom &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14036 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14037 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14038 | return NULL; |
| 14039 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14040 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14041 | expr_ty a; |
| 14042 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14043 | (a = atom_rule(p)) // atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14044 | && |
| 14045 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 14046 | ) |
| 14047 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14048 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14049 | _res = a; |
| 14050 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14051 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14052 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14053 | return NULL; |
| 14054 | } |
| 14055 | goto done; |
| 14056 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14057 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14058 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 14059 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14060 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14061 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14062 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14063 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14064 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14065 | } |
| 14066 | |
| 14067 | // t_lookahead: '(' | '[' | '.' |
| 14068 | static void * |
| 14069 | t_lookahead_rule(Parser *p) |
| 14070 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14071 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14072 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14073 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14074 | return NULL; |
| 14075 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14076 | void * _res = NULL; |
| 14077 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14078 | { // '(' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14079 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14080 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14081 | return NULL; |
| 14082 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14083 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14084 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14085 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14086 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14087 | ) |
| 14088 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14089 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14090 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14091 | goto done; |
| 14092 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14093 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14094 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 14095 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14096 | } |
| 14097 | { // '[' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14098 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14099 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14100 | return NULL; |
| 14101 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14102 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14103 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14104 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14105 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14106 | ) |
| 14107 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14108 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14109 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14110 | goto done; |
| 14111 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14112 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14113 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 14114 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14115 | } |
| 14116 | { // '.' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14117 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14118 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14119 | return NULL; |
| 14120 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14121 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14122 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14123 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14124 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14125 | ) |
| 14126 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14127 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14128 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14129 | goto done; |
| 14130 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14131 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14132 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 14133 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14134 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14135 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14136 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14137 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14138 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14139 | } |
| 14140 | |
| 14141 | // t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']' |
| 14142 | static expr_ty |
| 14143 | t_atom_rule(Parser *p) |
| 14144 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14145 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14146 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14147 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14148 | return NULL; |
| 14149 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14150 | expr_ty _res = NULL; |
| 14151 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14152 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14153 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14154 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14155 | return NULL; |
| 14156 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14157 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14158 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14159 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14160 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14161 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14162 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14163 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14164 | return NULL; |
| 14165 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14166 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14167 | expr_ty a; |
| 14168 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14169 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14170 | ) |
| 14171 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14172 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14173 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 14174 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14175 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14176 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14177 | return NULL; |
| 14178 | } |
| 14179 | goto done; |
| 14180 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14181 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14182 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 14183 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14184 | } |
| 14185 | { // '(' target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14186 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14187 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14188 | return NULL; |
| 14189 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14190 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14191 | Token * _literal; |
| 14192 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14193 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14194 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14195 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14196 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14197 | (a = target_rule(p)) // target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14198 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14199 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14200 | ) |
| 14201 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14202 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14203 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 14204 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14205 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14206 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14207 | return NULL; |
| 14208 | } |
| 14209 | goto done; |
| 14210 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14211 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14212 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 14213 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14214 | } |
| 14215 | { // '(' targets? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14216 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14217 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14218 | return NULL; |
| 14219 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14220 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14221 | Token * _literal; |
| 14222 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14223 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14224 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14225 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14226 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14227 | (b = targets_rule(p), 1) // targets? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14228 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14229 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14230 | ) |
| 14231 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14232 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14233 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14234 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14235 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14236 | return NULL; |
| 14237 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14238 | int _end_lineno = _token->end_lineno; |
| 14239 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14240 | int _end_col_offset = _token->end_col_offset; |
| 14241 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14242 | _res = _Py_Tuple ( b , Store , EXTRA ); |
| 14243 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14244 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14245 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14246 | return NULL; |
| 14247 | } |
| 14248 | goto done; |
| 14249 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14250 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14251 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 14252 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14253 | } |
| 14254 | { // '[' targets? ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14255 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14256 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14257 | return NULL; |
| 14258 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14259 | D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14260 | Token * _literal; |
| 14261 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14262 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14263 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14264 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14265 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14266 | (b = targets_rule(p), 1) // targets? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14267 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14268 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14269 | ) |
| 14270 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14271 | D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14272 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14273 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14274 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14275 | return NULL; |
| 14276 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14277 | int _end_lineno = _token->end_lineno; |
| 14278 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14279 | int _end_col_offset = _token->end_col_offset; |
| 14280 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14281 | _res = _Py_List ( b , Store , EXTRA ); |
| 14282 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14283 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14284 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14285 | return NULL; |
| 14286 | } |
| 14287 | goto done; |
| 14288 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14289 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14290 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 14291 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14292 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14293 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14294 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14295 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14296 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14297 | } |
| 14298 | |
| 14299 | // incorrect_arguments: |
| 14300 | // | args ',' '*' |
| 14301 | // | expression for_if_clauses ',' [args | expression for_if_clauses] |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14302 | // | args for_if_clauses |
| 14303 | // | args ',' expression for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14304 | // | args ',' args |
| 14305 | static void * |
| 14306 | incorrect_arguments_rule(Parser *p) |
| 14307 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14308 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14309 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14310 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14311 | return NULL; |
| 14312 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14313 | void * _res = NULL; |
| 14314 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14315 | { // args ',' '*' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14316 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14317 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14318 | return NULL; |
| 14319 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14320 | D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14321 | Token * _literal; |
| 14322 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14323 | expr_ty args_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14324 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14325 | (args_var = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14326 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14327 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14328 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14329 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14330 | ) |
| 14331 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14332 | D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14333 | _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" ); |
| 14334 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14335 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14336 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14337 | return NULL; |
| 14338 | } |
| 14339 | goto done; |
| 14340 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14341 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14342 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14343 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14344 | } |
| 14345 | { // expression for_if_clauses ',' [args | expression for_if_clauses] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14346 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14347 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14348 | return NULL; |
| 14349 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14350 | D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14351 | Token * _literal; |
| 14352 | void *_opt_var; |
| 14353 | UNUSED(_opt_var); // Silence compiler warnings |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14354 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14355 | asdl_seq* for_if_clauses_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14356 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14357 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14358 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14359 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14360 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14361 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14362 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14363 | (_opt_var = _tmp_125_rule(p), 1) // [args | expression for_if_clauses] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14364 | ) |
| 14365 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14366 | D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14367 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14368 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14369 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14370 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14371 | return NULL; |
| 14372 | } |
| 14373 | goto done; |
| 14374 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14375 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14376 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14377 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14378 | } |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14379 | { // args for_if_clauses |
| 14380 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14381 | D(p->level--); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14382 | return NULL; |
| 14383 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14384 | D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14385 | expr_ty a; |
| 14386 | asdl_seq* for_if_clauses_var; |
| 14387 | if ( |
| 14388 | (a = args_rule(p)) // args |
| 14389 | && |
| 14390 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 14391 | ) |
| 14392 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14393 | D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14394 | _res = _PyPegen_nonparen_genexp_in_call ( p , a ); |
| 14395 | if (_res == NULL && PyErr_Occurred()) { |
| 14396 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14397 | D(p->level--); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14398 | return NULL; |
| 14399 | } |
| 14400 | goto done; |
| 14401 | } |
| 14402 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14403 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14404 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses")); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14405 | } |
| 14406 | { // args ',' expression for_if_clauses |
| 14407 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14408 | D(p->level--); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14409 | return NULL; |
| 14410 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14411 | D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14412 | Token * _literal; |
| 14413 | expr_ty a; |
| 14414 | expr_ty args_var; |
| 14415 | asdl_seq* for_if_clauses_var; |
| 14416 | if ( |
| 14417 | (args_var = args_rule(p)) // args |
| 14418 | && |
| 14419 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 14420 | && |
| 14421 | (a = expression_rule(p)) // expression |
| 14422 | && |
| 14423 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 14424 | ) |
| 14425 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14426 | D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14427 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); |
| 14428 | if (_res == NULL && PyErr_Occurred()) { |
| 14429 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14430 | D(p->level--); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14431 | return NULL; |
| 14432 | } |
| 14433 | goto done; |
| 14434 | } |
| 14435 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14436 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14437 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses")); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14438 | } |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14439 | { // args ',' args |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14440 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14441 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14442 | return NULL; |
| 14443 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14444 | D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14445 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14446 | expr_ty a; |
| 14447 | expr_ty args_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14448 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14449 | (a = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14450 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14451 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14452 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14453 | (args_var = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14454 | ) |
| 14455 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14456 | D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14457 | _res = _PyPegen_arguments_parsing_error ( p , a ); |
| 14458 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14459 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14460 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14461 | return NULL; |
| 14462 | } |
| 14463 | goto done; |
| 14464 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14465 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14466 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14467 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14468 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14469 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14470 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14471 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14472 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14473 | } |
| 14474 | |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14475 | // invalid_kwarg: expression '=' |
| 14476 | static void * |
| 14477 | invalid_kwarg_rule(Parser *p) |
| 14478 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14479 | D(p->level++); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14480 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14481 | D(p->level--); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14482 | return NULL; |
| 14483 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14484 | void * _res = NULL; |
| 14485 | int _mark = p->mark; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14486 | { // expression '=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14487 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14488 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14489 | return NULL; |
| 14490 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14491 | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14492 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14493 | expr_ty a; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14494 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14495 | (a = expression_rule(p)) // expression |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14496 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14497 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14498 | ) |
| 14499 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14500 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14501 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14502 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14503 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14504 | D(p->level--); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14505 | return NULL; |
| 14506 | } |
| 14507 | goto done; |
| 14508 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14509 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14510 | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', |
| 14511 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='")); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14512 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14513 | _res = NULL; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14514 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14515 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14516 | return _res; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14517 | } |
| 14518 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14519 | // invalid_named_expression: expression ':=' expression |
| 14520 | static void * |
| 14521 | invalid_named_expression_rule(Parser *p) |
| 14522 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14523 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14524 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14525 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14526 | return NULL; |
| 14527 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14528 | void * _res = NULL; |
| 14529 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14530 | { // expression ':=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14531 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14532 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14533 | return NULL; |
| 14534 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14535 | D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14536 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14537 | expr_ty a; |
| 14538 | expr_ty expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14539 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14540 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14541 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14542 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14543 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14544 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14545 | ) |
| 14546 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14547 | D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14548 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14549 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14550 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14551 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14552 | return NULL; |
| 14553 | } |
| 14554 | goto done; |
| 14555 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14556 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14557 | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 14558 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14559 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14560 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14561 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14562 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14563 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14564 | } |
| 14565 | |
| 14566 | // invalid_assignment: |
| 14567 | // | list ':' |
| 14568 | // | tuple ':' |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14569 | // | star_named_expression ',' star_named_expressions* ':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14570 | // | expression ':' expression ['=' annotated_rhs] |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14571 | // | star_expressions '=' (yield_expr | star_expressions) |
| 14572 | // | star_expressions augassign (yield_expr | star_expressions) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14573 | static void * |
| 14574 | invalid_assignment_rule(Parser *p) |
| 14575 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14576 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14577 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14578 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14579 | return NULL; |
| 14580 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14581 | void * _res = NULL; |
| 14582 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14583 | { // list ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14584 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14585 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14586 | return NULL; |
| 14587 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14588 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list ':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14589 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14590 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14591 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14592 | (a = list_rule(p)) // list |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14593 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14594 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14595 | ) |
| 14596 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14597 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list ':'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14598 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not list) can be annotated" ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14599 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14600 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14601 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14602 | return NULL; |
| 14603 | } |
| 14604 | goto done; |
| 14605 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14606 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14607 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14608 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list ':'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14609 | } |
| 14610 | { // tuple ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14611 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14612 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14613 | return NULL; |
| 14614 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14615 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple ':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14616 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14617 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14618 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14619 | (a = tuple_rule(p)) // tuple |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14620 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14621 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14622 | ) |
| 14623 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14624 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple ':'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14625 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); |
| 14626 | if (_res == NULL && PyErr_Occurred()) { |
| 14627 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14628 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14629 | return NULL; |
| 14630 | } |
| 14631 | goto done; |
| 14632 | } |
| 14633 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14634 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14635 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple ':'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14636 | } |
| 14637 | { // star_named_expression ',' star_named_expressions* ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14638 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14639 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14640 | return NULL; |
| 14641 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14642 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14643 | Token * _literal; |
| 14644 | Token * _literal_1; |
| 14645 | asdl_seq * _loop0_126_var; |
| 14646 | expr_ty a; |
| 14647 | if ( |
| 14648 | (a = star_named_expression_rule(p)) // star_named_expression |
| 14649 | && |
| 14650 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 14651 | && |
| 14652 | (_loop0_126_var = _loop0_126_rule(p)) // star_named_expressions* |
| 14653 | && |
| 14654 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
| 14655 | ) |
| 14656 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14657 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14658 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14659 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14660 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14661 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14662 | return NULL; |
| 14663 | } |
| 14664 | goto done; |
| 14665 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14666 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14667 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14668 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14669 | } |
| 14670 | { // expression ':' expression ['=' annotated_rhs] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14671 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14672 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14673 | return NULL; |
| 14674 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14675 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14676 | Token * _literal; |
| 14677 | void *_opt_var; |
| 14678 | UNUSED(_opt_var); // Silence compiler warnings |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14679 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14680 | expr_ty expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14681 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14682 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14683 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14684 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14685 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14686 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14687 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14688 | (_opt_var = _tmp_127_rule(p), 1) // ['=' annotated_rhs] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14689 | ) |
| 14690 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14691 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14692 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14693 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14694 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14695 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14696 | return NULL; |
| 14697 | } |
| 14698 | goto done; |
| 14699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14700 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14701 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14702 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14703 | } |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14704 | { // star_expressions '=' (yield_expr | star_expressions) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14705 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14706 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14707 | return NULL; |
| 14708 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14709 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14710 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 14711 | void *_tmp_128_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14712 | expr_ty a; |
| 14713 | if ( |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14714 | (a = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14715 | && |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14716 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 14717 | && |
| 14718 | (_tmp_128_var = _tmp_128_rule(p)) // yield_expr | star_expressions |
| 14719 | ) |
| 14720 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14721 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14722 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( _PyPegen_get_invalid_target ( a ) , "cannot assign to %s" , _PyPegen_get_expr_name ( _PyPegen_get_invalid_target ( a ) ) ); |
| 14723 | if (_res == NULL && PyErr_Occurred()) { |
| 14724 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14725 | D(p->level--); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14726 | return NULL; |
| 14727 | } |
| 14728 | goto done; |
| 14729 | } |
| 14730 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14731 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14732 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14733 | } |
| 14734 | { // star_expressions augassign (yield_expr | star_expressions) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14735 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14736 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14737 | return NULL; |
| 14738 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14739 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14740 | void *_tmp_129_var; |
| 14741 | expr_ty a; |
| 14742 | AugOperator* augassign_var; |
| 14743 | if ( |
| 14744 | (a = star_expressions_rule(p)) // star_expressions |
| 14745 | && |
| 14746 | (augassign_var = augassign_rule(p)) // augassign |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 14747 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14748 | (_tmp_129_var = _tmp_129_rule(p)) // yield_expr | star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14749 | ) |
| 14750 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14751 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14752 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14753 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14754 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14755 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14756 | return NULL; |
| 14757 | } |
| 14758 | goto done; |
| 14759 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14760 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14761 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14762 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14763 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14764 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14765 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14766 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14767 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14768 | } |
| 14769 | |
| 14770 | // invalid_block: NEWLINE !INDENT |
| 14771 | static void * |
| 14772 | invalid_block_rule(Parser *p) |
| 14773 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14774 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14775 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14776 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14777 | return NULL; |
| 14778 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14779 | void * _res = NULL; |
| 14780 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14781 | { // NEWLINE !INDENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14782 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14783 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14784 | return NULL; |
| 14785 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14786 | D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 14787 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14788 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14789 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14790 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14791 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14792 | ) |
| 14793 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14794 | D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14795 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block" ); |
| 14796 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14797 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14798 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14799 | return NULL; |
| 14800 | } |
| 14801 | goto done; |
| 14802 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14803 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14804 | D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 14805 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14806 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14807 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14808 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14809 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14810 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14811 | } |
| 14812 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14813 | // invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14814 | static void * |
| 14815 | invalid_comprehension_rule(Parser *p) |
| 14816 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14817 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14818 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14819 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14820 | return NULL; |
| 14821 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14822 | void * _res = NULL; |
| 14823 | int _mark = p->mark; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14824 | { // ('[' | '(' | '{') starred_expression for_if_clauses |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14825 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14826 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14827 | return NULL; |
| 14828 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14829 | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14830 | void *_tmp_130_var; |
| 14831 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14832 | asdl_seq* for_if_clauses_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14833 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14834 | (_tmp_130_var = _tmp_130_rule(p)) // '[' | '(' | '{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14835 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14836 | (a = starred_expression_rule(p)) // starred_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14837 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14838 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14839 | ) |
| 14840 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14841 | D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14842 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14843 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14844 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14845 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14846 | return NULL; |
| 14847 | } |
| 14848 | goto done; |
| 14849 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14850 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14851 | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
| 14852 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14853 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14854 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14855 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14856 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14857 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14858 | } |
| 14859 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14860 | // invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}' |
| 14861 | static void * |
| 14862 | invalid_dict_comprehension_rule(Parser *p) |
| 14863 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14864 | D(p->level++); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14865 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14866 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14867 | return NULL; |
| 14868 | } |
| 14869 | void * _res = NULL; |
| 14870 | int _mark = p->mark; |
| 14871 | { // '{' '**' bitwise_or for_if_clauses '}' |
| 14872 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14873 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14874 | return NULL; |
| 14875 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14876 | D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14877 | Token * _literal; |
| 14878 | Token * _literal_1; |
| 14879 | Token * a; |
| 14880 | expr_ty bitwise_or_var; |
| 14881 | asdl_seq* for_if_clauses_var; |
| 14882 | if ( |
| 14883 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 14884 | && |
| 14885 | (a = _PyPegen_expect_token(p, 35)) // token='**' |
| 14886 | && |
| 14887 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
| 14888 | && |
| 14889 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 14890 | && |
| 14891 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 14892 | ) |
| 14893 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14894 | D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14895 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" ); |
| 14896 | if (_res == NULL && PyErr_Occurred()) { |
| 14897 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14898 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14899 | return NULL; |
| 14900 | } |
| 14901 | goto done; |
| 14902 | } |
| 14903 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14904 | D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
| 14905 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14906 | } |
| 14907 | _res = NULL; |
| 14908 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14909 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14910 | return _res; |
| 14911 | } |
| 14912 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14913 | // invalid_parameters: |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 14914 | // | param_no_default* (slash_with_default | param_with_default+) param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14915 | static void * |
| 14916 | invalid_parameters_rule(Parser *p) |
| 14917 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14918 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14919 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14920 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14921 | return NULL; |
| 14922 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14923 | void * _res = NULL; |
| 14924 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 14925 | { // param_no_default* (slash_with_default | param_with_default+) param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14926 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14927 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14928 | return NULL; |
| 14929 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14930 | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14931 | asdl_seq * _loop0_131_var; |
| 14932 | void *_tmp_132_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 14933 | arg_ty param_no_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14934 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14935 | (_loop0_131_var = _loop0_131_rule(p)) // param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14936 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14937 | (_tmp_132_var = _tmp_132_rule(p)) // slash_with_default | param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14938 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14939 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14940 | ) |
| 14941 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14942 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14943 | _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); |
| 14944 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14945 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14946 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14947 | return NULL; |
| 14948 | } |
| 14949 | goto done; |
| 14950 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14951 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14952 | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 14953 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14954 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14955 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14956 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14957 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14958 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14959 | } |
| 14960 | |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 14961 | // invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14962 | static void * |
| 14963 | invalid_star_etc_rule(Parser *p) |
| 14964 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14965 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14966 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14967 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14968 | return NULL; |
| 14969 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14970 | void * _res = NULL; |
| 14971 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14972 | { // '*' (')' | ',' (')' | '**')) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14973 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14974 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14975 | return NULL; |
| 14976 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14977 | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14978 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14979 | void *_tmp_133_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14980 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14981 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14982 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14983 | (_tmp_133_var = _tmp_133_rule(p)) // ')' | ',' (')' | '**') |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14984 | ) |
| 14985 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14986 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14987 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
| 14988 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14989 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14990 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14991 | return NULL; |
| 14992 | } |
| 14993 | goto done; |
| 14994 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14995 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14996 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 14997 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 14998 | } |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 14999 | { // '*' ',' TYPE_COMMENT |
Pablo Galindo | ced4e5c | 2020-05-18 22:47:51 +0100 | [diff] [blame] | 15000 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15001 | D(p->level--); |
Pablo Galindo | ced4e5c | 2020-05-18 22:47:51 +0100 | [diff] [blame] | 15002 | return NULL; |
| 15003 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15004 | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 15005 | Token * _literal; |
| 15006 | Token * _literal_1; |
| 15007 | Token * type_comment_var; |
| 15008 | if ( |
| 15009 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 15010 | && |
| 15011 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 15012 | && |
| 15013 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 15014 | ) |
| 15015 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15016 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 15017 | _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" ); |
| 15018 | if (_res == NULL && PyErr_Occurred()) { |
| 15019 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15020 | D(p->level--); |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 15021 | return NULL; |
| 15022 | } |
| 15023 | goto done; |
| 15024 | } |
| 15025 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15026 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 15027 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 15028 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15029 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15030 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15031 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15032 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15033 | } |
| 15034 | |
| 15035 | // invalid_lambda_star_etc: '*' (':' | ',' (':' | '**')) |
| 15036 | static void * |
| 15037 | invalid_lambda_star_etc_rule(Parser *p) |
| 15038 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15039 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15040 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15041 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15042 | return NULL; |
| 15043 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15044 | void * _res = NULL; |
| 15045 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15046 | { // '*' (':' | ',' (':' | '**')) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15047 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15048 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15049 | return NULL; |
| 15050 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15051 | D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15052 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 15053 | void *_tmp_134_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15054 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15055 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15056 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 15057 | (_tmp_134_var = _tmp_134_rule(p)) // ':' | ',' (':' | '**') |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15058 | ) |
| 15059 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15060 | D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15061 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
| 15062 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15063 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15064 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15065 | return NULL; |
| 15066 | } |
| 15067 | goto done; |
| 15068 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15069 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15070 | D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 15071 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15072 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15073 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15074 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15075 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15076 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15077 | } |
| 15078 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15079 | // invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
| 15080 | static void * |
| 15081 | invalid_double_type_comments_rule(Parser *p) |
| 15082 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15083 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15084 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15085 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15086 | return NULL; |
| 15087 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15088 | void * _res = NULL; |
| 15089 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15090 | { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15091 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15092 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15093 | return NULL; |
| 15094 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15095 | D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 15096 | Token * indent_var; |
| 15097 | Token * newline_var; |
| 15098 | Token * newline_var_1; |
| 15099 | Token * type_comment_var; |
| 15100 | Token * type_comment_var_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15101 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15102 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15103 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15104 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15105 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15106 | (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15107 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15108 | (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15109 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15110 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15111 | ) |
| 15112 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15113 | 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")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15114 | _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" ); |
| 15115 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15116 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15117 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15118 | return NULL; |
| 15119 | } |
| 15120 | goto done; |
| 15121 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15122 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15123 | D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ', |
| 15124 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15125 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15126 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15127 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15128 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15129 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15130 | } |
| 15131 | |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15132 | // invalid_del_target: star_expression &del_target_end |
| 15133 | static void * |
| 15134 | invalid_del_target_rule(Parser *p) |
| 15135 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15136 | D(p->level++); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15137 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15138 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15139 | return NULL; |
| 15140 | } |
| 15141 | void * _res = NULL; |
| 15142 | int _mark = p->mark; |
| 15143 | { // star_expression &del_target_end |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15144 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15145 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15146 | return NULL; |
| 15147 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15148 | D(fprintf(stderr, "%*c> invalid_del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression &del_target_end")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15149 | expr_ty a; |
| 15150 | if ( |
| 15151 | (a = star_expression_rule(p)) // star_expression |
| 15152 | && |
| 15153 | _PyPegen_lookahead(1, del_target_end_rule, p) |
| 15154 | ) |
| 15155 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15156 | D(fprintf(stderr, "%*c+ invalid_del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression &del_target_end")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 15157 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot delete %s" , _PyPegen_get_expr_name ( a ) ); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15158 | if (_res == NULL && PyErr_Occurred()) { |
| 15159 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15160 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15161 | return NULL; |
| 15162 | } |
| 15163 | goto done; |
| 15164 | } |
| 15165 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15166 | D(fprintf(stderr, "%*c%s invalid_del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15167 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression &del_target_end")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15168 | } |
| 15169 | _res = NULL; |
| 15170 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15171 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15172 | return _res; |
| 15173 | } |
| 15174 | |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15175 | // invalid_import_from_targets: import_from_as_names ',' |
| 15176 | static void * |
| 15177 | invalid_import_from_targets_rule(Parser *p) |
| 15178 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15179 | D(p->level++); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15180 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15181 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15182 | return NULL; |
| 15183 | } |
| 15184 | void * _res = NULL; |
| 15185 | int _mark = p->mark; |
| 15186 | { // import_from_as_names ',' |
| 15187 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15188 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15189 | return NULL; |
| 15190 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15191 | D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15192 | Token * _literal; |
| 15193 | asdl_seq* import_from_as_names_var; |
| 15194 | if ( |
| 15195 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
| 15196 | && |
| 15197 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 15198 | ) |
| 15199 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15200 | D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15201 | _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" ); |
| 15202 | if (_res == NULL && PyErr_Occurred()) { |
| 15203 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15204 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15205 | return NULL; |
| 15206 | } |
| 15207 | goto done; |
| 15208 | } |
| 15209 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15210 | D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 15211 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','")); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15212 | } |
| 15213 | _res = NULL; |
| 15214 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15215 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15216 | return _res; |
| 15217 | } |
| 15218 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15219 | // _loop0_1: NEWLINE |
| 15220 | static asdl_seq * |
| 15221 | _loop0_1_rule(Parser *p) |
| 15222 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15223 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15224 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15225 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15226 | return NULL; |
| 15227 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15228 | void *_res = NULL; |
| 15229 | int _mark = p->mark; |
| 15230 | int _start_mark = p->mark; |
| 15231 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15232 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15233 | p->error_indicator = 1; |
| 15234 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15235 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15236 | return NULL; |
| 15237 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15238 | ssize_t _children_capacity = 1; |
| 15239 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15240 | { // NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15241 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15242 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15243 | return NULL; |
| 15244 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15245 | D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 15246 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15247 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15248 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15249 | ) |
| 15250 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15251 | _res = newline_var; |
| 15252 | if (_n == _children_capacity) { |
| 15253 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15254 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15255 | if (!_new_children) { |
| 15256 | p->error_indicator = 1; |
| 15257 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15258 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15259 | return NULL; |
| 15260 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15261 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15262 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15263 | _children[_n++] = _res; |
| 15264 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15265 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15266 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15267 | D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ', |
| 15268 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15269 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15270 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15271 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15272 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15273 | p->error_indicator = 1; |
| 15274 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15275 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15276 | return NULL; |
| 15277 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15278 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15279 | PyMem_Free(_children); |
| 15280 | _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15281 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15282 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15283 | } |
| 15284 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15285 | // _loop0_2: NEWLINE |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15286 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15287 | _loop0_2_rule(Parser *p) |
| 15288 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15289 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15290 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15291 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15292 | return NULL; |
| 15293 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15294 | void *_res = NULL; |
| 15295 | int _mark = p->mark; |
| 15296 | int _start_mark = p->mark; |
| 15297 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15298 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15299 | p->error_indicator = 1; |
| 15300 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15301 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15302 | return NULL; |
| 15303 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15304 | ssize_t _children_capacity = 1; |
| 15305 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15306 | { // NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15307 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15308 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15309 | return NULL; |
| 15310 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15311 | D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 15312 | Token * newline_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15313 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15314 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15315 | ) |
| 15316 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15317 | _res = newline_var; |
| 15318 | if (_n == _children_capacity) { |
| 15319 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15320 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15321 | if (!_new_children) { |
| 15322 | p->error_indicator = 1; |
| 15323 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15324 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15325 | return NULL; |
| 15326 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15327 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15328 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15329 | _children[_n++] = _res; |
| 15330 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15331 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15332 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15333 | D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ', |
| 15334 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15335 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15336 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15337 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15338 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15339 | p->error_indicator = 1; |
| 15340 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15341 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15342 | return NULL; |
| 15343 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15344 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15345 | PyMem_Free(_children); |
| 15346 | _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15347 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15348 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15349 | } |
| 15350 | |
| 15351 | // _loop0_4: ',' expression |
| 15352 | static asdl_seq * |
| 15353 | _loop0_4_rule(Parser *p) |
| 15354 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15355 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15356 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15357 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15358 | return NULL; |
| 15359 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15360 | void *_res = NULL; |
| 15361 | int _mark = p->mark; |
| 15362 | int _start_mark = p->mark; |
| 15363 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15364 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15365 | p->error_indicator = 1; |
| 15366 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15367 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15368 | return NULL; |
| 15369 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15370 | ssize_t _children_capacity = 1; |
| 15371 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15372 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15373 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15374 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15375 | return NULL; |
| 15376 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15377 | D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15378 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15379 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15380 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15381 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15382 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15383 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15384 | ) |
| 15385 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15386 | _res = elem; |
| 15387 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15388 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15389 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15390 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15391 | return NULL; |
| 15392 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15393 | if (_n == _children_capacity) { |
| 15394 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15395 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15396 | if (!_new_children) { |
| 15397 | p->error_indicator = 1; |
| 15398 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15399 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15400 | return NULL; |
| 15401 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15402 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15403 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15404 | _children[_n++] = _res; |
| 15405 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15406 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15407 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15408 | D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ', |
| 15409 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15410 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15411 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15412 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15413 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15414 | p->error_indicator = 1; |
| 15415 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15416 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15417 | return NULL; |
| 15418 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15419 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15420 | PyMem_Free(_children); |
| 15421 | _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15422 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15423 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15424 | } |
| 15425 | |
| 15426 | // _gather_3: expression _loop0_4 |
| 15427 | static asdl_seq * |
| 15428 | _gather_3_rule(Parser *p) |
| 15429 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15430 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15431 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15432 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15433 | return NULL; |
| 15434 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15435 | asdl_seq * _res = NULL; |
| 15436 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15437 | { // expression _loop0_4 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15438 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15439 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15440 | return NULL; |
| 15441 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15442 | D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15443 | expr_ty elem; |
| 15444 | asdl_seq * seq; |
| 15445 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15446 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15447 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15448 | (seq = _loop0_4_rule(p)) // _loop0_4 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15449 | ) |
| 15450 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15451 | D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15452 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15453 | goto done; |
| 15454 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15455 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15456 | D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ', |
| 15457 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15458 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15459 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15460 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15461 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15462 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15463 | } |
| 15464 | |
| 15465 | // _loop0_6: ',' expression |
| 15466 | static asdl_seq * |
| 15467 | _loop0_6_rule(Parser *p) |
| 15468 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15469 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15470 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15471 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15472 | return NULL; |
| 15473 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15474 | void *_res = NULL; |
| 15475 | int _mark = p->mark; |
| 15476 | int _start_mark = p->mark; |
| 15477 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15478 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15479 | p->error_indicator = 1; |
| 15480 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15481 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15482 | return NULL; |
| 15483 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15484 | ssize_t _children_capacity = 1; |
| 15485 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15486 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15487 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15488 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15489 | return NULL; |
| 15490 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15491 | D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15492 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15493 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15494 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15495 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15496 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15497 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15498 | ) |
| 15499 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15500 | _res = elem; |
| 15501 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15502 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15503 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15504 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15505 | return NULL; |
| 15506 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15507 | if (_n == _children_capacity) { |
| 15508 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15509 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15510 | if (!_new_children) { |
| 15511 | p->error_indicator = 1; |
| 15512 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15513 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15514 | return NULL; |
| 15515 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15516 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15517 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15518 | _children[_n++] = _res; |
| 15519 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15520 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15521 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15522 | D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ', |
| 15523 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15524 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15525 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15526 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15527 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15528 | p->error_indicator = 1; |
| 15529 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15530 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15531 | return NULL; |
| 15532 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15533 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15534 | PyMem_Free(_children); |
| 15535 | _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15536 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15537 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15538 | } |
| 15539 | |
| 15540 | // _gather_5: expression _loop0_6 |
| 15541 | static asdl_seq * |
| 15542 | _gather_5_rule(Parser *p) |
| 15543 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15544 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15545 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15546 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15547 | return NULL; |
| 15548 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15549 | asdl_seq * _res = NULL; |
| 15550 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15551 | { // expression _loop0_6 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15552 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15553 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15554 | return NULL; |
| 15555 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15556 | D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15557 | expr_ty elem; |
| 15558 | asdl_seq * seq; |
| 15559 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15560 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15561 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15562 | (seq = _loop0_6_rule(p)) // _loop0_6 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15563 | ) |
| 15564 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15565 | D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15566 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15567 | goto done; |
| 15568 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15569 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15570 | D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ', |
| 15571 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15572 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15573 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15574 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15575 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15576 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15577 | } |
| 15578 | |
| 15579 | // _loop0_8: ',' expression |
| 15580 | static asdl_seq * |
| 15581 | _loop0_8_rule(Parser *p) |
| 15582 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15583 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15584 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15585 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15586 | return NULL; |
| 15587 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15588 | void *_res = NULL; |
| 15589 | int _mark = p->mark; |
| 15590 | int _start_mark = p->mark; |
| 15591 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15592 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15593 | p->error_indicator = 1; |
| 15594 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15595 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15596 | return NULL; |
| 15597 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15598 | ssize_t _children_capacity = 1; |
| 15599 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15600 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15601 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15602 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15603 | return NULL; |
| 15604 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15605 | D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15606 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15607 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15608 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15609 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15610 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15611 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15612 | ) |
| 15613 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15614 | _res = elem; |
| 15615 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15616 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15617 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15618 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15619 | return NULL; |
| 15620 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15621 | if (_n == _children_capacity) { |
| 15622 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15623 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15624 | if (!_new_children) { |
| 15625 | p->error_indicator = 1; |
| 15626 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15627 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15628 | return NULL; |
| 15629 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15630 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15631 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15632 | _children[_n++] = _res; |
| 15633 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15634 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15635 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15636 | D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ', |
| 15637 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15638 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15639 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15640 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15641 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15642 | p->error_indicator = 1; |
| 15643 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15644 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15645 | return NULL; |
| 15646 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15647 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15648 | PyMem_Free(_children); |
| 15649 | _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15650 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15651 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15652 | } |
| 15653 | |
| 15654 | // _gather_7: expression _loop0_8 |
| 15655 | static asdl_seq * |
| 15656 | _gather_7_rule(Parser *p) |
| 15657 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15658 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15659 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15660 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15661 | return NULL; |
| 15662 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15663 | asdl_seq * _res = NULL; |
| 15664 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15665 | { // expression _loop0_8 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15666 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15667 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15668 | return NULL; |
| 15669 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15670 | D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15671 | expr_ty elem; |
| 15672 | asdl_seq * seq; |
| 15673 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15674 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15675 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15676 | (seq = _loop0_8_rule(p)) // _loop0_8 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15677 | ) |
| 15678 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15679 | D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15680 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15681 | goto done; |
| 15682 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15683 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15684 | D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ', |
| 15685 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15686 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15687 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15688 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15689 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15690 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15691 | } |
| 15692 | |
| 15693 | // _loop0_10: ',' expression |
| 15694 | static asdl_seq * |
| 15695 | _loop0_10_rule(Parser *p) |
| 15696 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15697 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15698 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15699 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15700 | return NULL; |
| 15701 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15702 | void *_res = NULL; |
| 15703 | int _mark = p->mark; |
| 15704 | int _start_mark = p->mark; |
| 15705 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15706 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15707 | p->error_indicator = 1; |
| 15708 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15709 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15710 | return NULL; |
| 15711 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15712 | ssize_t _children_capacity = 1; |
| 15713 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15714 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15715 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15716 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15717 | return NULL; |
| 15718 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15719 | D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15720 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15721 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15722 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15723 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15724 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15725 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15726 | ) |
| 15727 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15728 | _res = elem; |
| 15729 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15730 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15731 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15732 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15733 | return NULL; |
| 15734 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15735 | if (_n == _children_capacity) { |
| 15736 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15737 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15738 | if (!_new_children) { |
| 15739 | p->error_indicator = 1; |
| 15740 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15741 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15742 | return NULL; |
| 15743 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15744 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15745 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15746 | _children[_n++] = _res; |
| 15747 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15748 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15749 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15750 | D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ', |
| 15751 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15752 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15753 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15754 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15755 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15756 | p->error_indicator = 1; |
| 15757 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15758 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15759 | return NULL; |
| 15760 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15761 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15762 | PyMem_Free(_children); |
| 15763 | _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15764 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15765 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15766 | } |
| 15767 | |
| 15768 | // _gather_9: expression _loop0_10 |
| 15769 | static asdl_seq * |
| 15770 | _gather_9_rule(Parser *p) |
| 15771 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15772 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15773 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15774 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15775 | return NULL; |
| 15776 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15777 | asdl_seq * _res = NULL; |
| 15778 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15779 | { // expression _loop0_10 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15780 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15781 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15782 | return NULL; |
| 15783 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15784 | D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15785 | expr_ty elem; |
| 15786 | asdl_seq * seq; |
| 15787 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15788 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15789 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15790 | (seq = _loop0_10_rule(p)) // _loop0_10 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15791 | ) |
| 15792 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15793 | D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15794 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15795 | goto done; |
| 15796 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15797 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15798 | D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ', |
| 15799 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15800 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15801 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15802 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15803 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15804 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15805 | } |
| 15806 | |
| 15807 | // _loop1_11: statement |
| 15808 | static asdl_seq * |
| 15809 | _loop1_11_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15810 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15811 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15812 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15813 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15814 | return NULL; |
| 15815 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15816 | void *_res = NULL; |
| 15817 | int _mark = p->mark; |
| 15818 | int _start_mark = p->mark; |
| 15819 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15820 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15821 | p->error_indicator = 1; |
| 15822 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15823 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15824 | return NULL; |
| 15825 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15826 | ssize_t _children_capacity = 1; |
| 15827 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15828 | { // statement |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15829 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15830 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15831 | return NULL; |
| 15832 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15833 | D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15834 | asdl_seq* statement_var; |
| 15835 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15836 | (statement_var = statement_rule(p)) // statement |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15837 | ) |
| 15838 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15839 | _res = statement_var; |
| 15840 | if (_n == _children_capacity) { |
| 15841 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15842 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15843 | if (!_new_children) { |
| 15844 | p->error_indicator = 1; |
| 15845 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15846 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15847 | return NULL; |
| 15848 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15849 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15850 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15851 | _children[_n++] = _res; |
| 15852 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15853 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15854 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15855 | D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ', |
| 15856 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15857 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15858 | if (_n == 0 || p->error_indicator) { |
| 15859 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15860 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15861 | return NULL; |
| 15862 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15863 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15864 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15865 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15866 | p->error_indicator = 1; |
| 15867 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15868 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15869 | return NULL; |
| 15870 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15871 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15872 | PyMem_Free(_children); |
| 15873 | _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15874 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15875 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15876 | } |
| 15877 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15878 | // _loop0_13: ';' small_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15879 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15880 | _loop0_13_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15881 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15882 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15883 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15884 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15885 | return NULL; |
| 15886 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15887 | void *_res = NULL; |
| 15888 | int _mark = p->mark; |
| 15889 | int _start_mark = p->mark; |
| 15890 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15891 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15892 | p->error_indicator = 1; |
| 15893 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15894 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15895 | return NULL; |
| 15896 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15897 | ssize_t _children_capacity = 1; |
| 15898 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15899 | { // ';' small_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15900 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15901 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15902 | return NULL; |
| 15903 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15904 | D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15905 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15906 | stmt_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15907 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15908 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15909 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15910 | (elem = small_stmt_rule(p)) // small_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15911 | ) |
| 15912 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15913 | _res = elem; |
| 15914 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15915 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15916 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15917 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15918 | return NULL; |
| 15919 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15920 | if (_n == _children_capacity) { |
| 15921 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15922 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15923 | if (!_new_children) { |
| 15924 | p->error_indicator = 1; |
| 15925 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15926 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15927 | return NULL; |
| 15928 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15929 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15930 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15931 | _children[_n++] = _res; |
| 15932 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15933 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15934 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15935 | D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ', |
| 15936 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15937 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15938 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15939 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15940 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15941 | p->error_indicator = 1; |
| 15942 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15943 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15944 | return NULL; |
| 15945 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15946 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15947 | PyMem_Free(_children); |
| 15948 | _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15949 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15950 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15951 | } |
| 15952 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15953 | // _gather_12: small_stmt _loop0_13 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15954 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15955 | _gather_12_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15956 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15957 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15958 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15959 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15960 | return NULL; |
| 15961 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15962 | asdl_seq * _res = NULL; |
| 15963 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15964 | { // small_stmt _loop0_13 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15965 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15966 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15967 | return NULL; |
| 15968 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15969 | D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15970 | stmt_ty elem; |
| 15971 | asdl_seq * seq; |
| 15972 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15973 | (elem = small_stmt_rule(p)) // small_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15974 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15975 | (seq = _loop0_13_rule(p)) // _loop0_13 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15976 | ) |
| 15977 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15978 | D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15979 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15980 | goto done; |
| 15981 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15982 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15983 | D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ', |
| 15984 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15985 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15986 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15987 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15988 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15989 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15990 | } |
| 15991 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15992 | // _tmp_14: 'import' | 'from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15993 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15994 | _tmp_14_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15995 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15996 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15997 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15998 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15999 | return NULL; |
| 16000 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16001 | void * _res = NULL; |
| 16002 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16003 | { // 'import' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16004 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16005 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16006 | return NULL; |
| 16007 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16008 | D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16009 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16010 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16011 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16012 | ) |
| 16013 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16014 | D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16015 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16016 | goto done; |
| 16017 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16018 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16019 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', |
| 16020 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16021 | } |
| 16022 | { // 'from' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16023 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16024 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16025 | return NULL; |
| 16026 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16027 | D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16028 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16029 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16030 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16031 | ) |
| 16032 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16033 | D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16034 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16035 | goto done; |
| 16036 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16037 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16038 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', |
| 16039 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16040 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16041 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16042 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16043 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16044 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16045 | } |
| 16046 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16047 | // _tmp_15: 'def' | '@' | ASYNC |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16048 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16049 | _tmp_15_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16050 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16051 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16052 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16053 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16054 | return NULL; |
| 16055 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16056 | void * _res = NULL; |
| 16057 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16058 | { // 'def' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16059 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16060 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16061 | return NULL; |
| 16062 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16063 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16064 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16065 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16066 | (_keyword = _PyPegen_expect_token(p, 522)) // token='def' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16067 | ) |
| 16068 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16069 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16070 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16071 | goto done; |
| 16072 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16073 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16074 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 16075 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16076 | } |
| 16077 | { // '@' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16078 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16079 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16080 | return NULL; |
| 16081 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16082 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16083 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16084 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16085 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16086 | ) |
| 16087 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16088 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16089 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16090 | goto done; |
| 16091 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16092 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16093 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 16094 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16095 | } |
| 16096 | { // ASYNC |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16097 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16098 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16099 | return NULL; |
| 16100 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16101 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 16102 | Token * async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16103 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16104 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16105 | ) |
| 16106 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16107 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16108 | _res = async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16109 | goto done; |
| 16110 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16111 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16112 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 16113 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16114 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16115 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16116 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16117 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16118 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16119 | } |
| 16120 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16121 | // _tmp_16: 'class' | '@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16122 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16123 | _tmp_16_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16124 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16125 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16126 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16127 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16128 | return NULL; |
| 16129 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16130 | void * _res = NULL; |
| 16131 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16132 | { // 'class' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16133 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16134 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16135 | return NULL; |
| 16136 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16137 | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16138 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16139 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16140 | (_keyword = _PyPegen_expect_token(p, 523)) // token='class' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16141 | ) |
| 16142 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16143 | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16144 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16145 | goto done; |
| 16146 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16147 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16148 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
| 16149 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16150 | } |
| 16151 | { // '@' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16152 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16153 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16154 | return NULL; |
| 16155 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16156 | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16157 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16158 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16159 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16160 | ) |
| 16161 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16162 | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16163 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16164 | goto done; |
| 16165 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16166 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16167 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
| 16168 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16169 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16170 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16171 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16172 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16173 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16174 | } |
| 16175 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16176 | // _tmp_17: 'with' | ASYNC |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16177 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16178 | _tmp_17_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16179 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16180 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16181 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16182 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16183 | return NULL; |
| 16184 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16185 | void * _res = NULL; |
| 16186 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16187 | { // 'with' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16188 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16189 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16190 | return NULL; |
| 16191 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16192 | D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16193 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16194 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16195 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16196 | ) |
| 16197 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16198 | D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16199 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16200 | goto done; |
| 16201 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16202 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16203 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', |
| 16204 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16205 | } |
| 16206 | { // ASYNC |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16207 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16208 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16209 | return NULL; |
| 16210 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16211 | D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 16212 | Token * async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16213 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16214 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16215 | ) |
| 16216 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16217 | D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16218 | _res = async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16219 | goto done; |
| 16220 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16221 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16222 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', |
| 16223 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16224 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16225 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16226 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16227 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16228 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16229 | } |
| 16230 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16231 | // _tmp_18: 'for' | ASYNC |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16232 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16233 | _tmp_18_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16234 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16235 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16236 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16237 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16238 | return NULL; |
| 16239 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16240 | void * _res = NULL; |
| 16241 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16242 | { // 'for' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16243 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16244 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16245 | return NULL; |
| 16246 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16247 | D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16248 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16249 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16250 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16251 | ) |
| 16252 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16253 | D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16254 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16255 | goto done; |
| 16256 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16257 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16258 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', |
| 16259 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16260 | } |
| 16261 | { // ASYNC |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16262 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16263 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16264 | return NULL; |
| 16265 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16266 | D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 16267 | Token * async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16268 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16269 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16270 | ) |
| 16271 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16272 | D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16273 | _res = async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16274 | goto done; |
| 16275 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16276 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16277 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', |
| 16278 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16279 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16280 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16281 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16282 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16283 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16284 | } |
| 16285 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16286 | // _tmp_19: '=' annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16287 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16288 | _tmp_19_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16289 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16290 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16291 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16292 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16293 | return NULL; |
| 16294 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16295 | void * _res = NULL; |
| 16296 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16297 | { // '=' annotated_rhs |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16298 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16299 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16300 | return NULL; |
| 16301 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16302 | D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16303 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16304 | expr_ty d; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16305 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16306 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16307 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16308 | (d = annotated_rhs_rule(p)) // annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16309 | ) |
| 16310 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16311 | D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16312 | _res = d; |
| 16313 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16314 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16315 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16316 | return NULL; |
| 16317 | } |
| 16318 | goto done; |
| 16319 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16320 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16321 | D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ', |
| 16322 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16323 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16324 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16325 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16326 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16327 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16328 | } |
| 16329 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16330 | // _tmp_20: '(' single_target ')' | single_subscript_attribute_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16331 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16332 | _tmp_20_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16333 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16334 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16335 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16336 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16337 | return NULL; |
| 16338 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16339 | void * _res = NULL; |
| 16340 | int _mark = p->mark; |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16341 | { // '(' single_target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16342 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16343 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16344 | return NULL; |
| 16345 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16346 | D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16347 | Token * _literal; |
| 16348 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16349 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16350 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16351 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16352 | && |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16353 | (b = single_target_rule(p)) // single_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16354 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16355 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16356 | ) |
| 16357 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16358 | D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16359 | _res = b; |
| 16360 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16361 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16362 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16363 | return NULL; |
| 16364 | } |
| 16365 | goto done; |
| 16366 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16367 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16368 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', |
| 16369 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16370 | } |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16371 | { // single_subscript_attribute_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16372 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16373 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16374 | return NULL; |
| 16375 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16376 | D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16377 | expr_ty single_subscript_attribute_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16378 | if ( |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16379 | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16380 | ) |
| 16381 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16382 | D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16383 | _res = single_subscript_attribute_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16384 | goto done; |
| 16385 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16386 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16387 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', |
| 16388 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16389 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16390 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16391 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16392 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16393 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16394 | } |
| 16395 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16396 | // _tmp_21: '=' annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16397 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16398 | _tmp_21_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16399 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16400 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16401 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16402 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16403 | return NULL; |
| 16404 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16405 | void * _res = NULL; |
| 16406 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16407 | { // '=' annotated_rhs |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16408 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16409 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16410 | return NULL; |
| 16411 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16412 | D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16413 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16414 | expr_ty d; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16415 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16416 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16417 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16418 | (d = annotated_rhs_rule(p)) // annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16419 | ) |
| 16420 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16421 | D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16422 | _res = d; |
| 16423 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16424 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16425 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16426 | return NULL; |
| 16427 | } |
| 16428 | goto done; |
| 16429 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16430 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16431 | D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ', |
| 16432 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16433 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16434 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16435 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16436 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16437 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16438 | } |
| 16439 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16440 | // _loop1_22: (star_targets '=') |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16441 | static asdl_seq * |
| 16442 | _loop1_22_rule(Parser *p) |
| 16443 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16444 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16445 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16446 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16447 | return NULL; |
| 16448 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16449 | void *_res = NULL; |
| 16450 | int _mark = p->mark; |
| 16451 | int _start_mark = p->mark; |
| 16452 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16453 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16454 | p->error_indicator = 1; |
| 16455 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16456 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16457 | return NULL; |
| 16458 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16459 | ssize_t _children_capacity = 1; |
| 16460 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16461 | { // (star_targets '=') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16462 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16463 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16464 | return NULL; |
| 16465 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16466 | D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16467 | void *_tmp_135_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16468 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16469 | (_tmp_135_var = _tmp_135_rule(p)) // star_targets '=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16470 | ) |
| 16471 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16472 | _res = _tmp_135_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16473 | if (_n == _children_capacity) { |
| 16474 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16475 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16476 | if (!_new_children) { |
| 16477 | p->error_indicator = 1; |
| 16478 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16479 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16480 | return NULL; |
| 16481 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16482 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16483 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16484 | _children[_n++] = _res; |
| 16485 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16486 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16487 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16488 | D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ', |
| 16489 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16490 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16491 | if (_n == 0 || p->error_indicator) { |
| 16492 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16493 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16494 | return NULL; |
| 16495 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16496 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 16497 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16498 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16499 | p->error_indicator = 1; |
| 16500 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16501 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16502 | return NULL; |
| 16503 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16504 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 16505 | PyMem_Free(_children); |
| 16506 | _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16507 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16508 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16509 | } |
| 16510 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16511 | // _tmp_23: yield_expr | star_expressions |
| 16512 | static void * |
| 16513 | _tmp_23_rule(Parser *p) |
| 16514 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16515 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16516 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16517 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16518 | return NULL; |
| 16519 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16520 | void * _res = NULL; |
| 16521 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16522 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16523 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16524 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16525 | return NULL; |
| 16526 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16527 | D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16528 | expr_ty yield_expr_var; |
| 16529 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16530 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16531 | ) |
| 16532 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16533 | D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16534 | _res = yield_expr_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16535 | goto done; |
| 16536 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16537 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16538 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', |
| 16539 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16540 | } |
| 16541 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16542 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16543 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16544 | return NULL; |
| 16545 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16546 | D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16547 | expr_ty star_expressions_var; |
| 16548 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16549 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16550 | ) |
| 16551 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16552 | D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16553 | _res = star_expressions_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16554 | goto done; |
| 16555 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16556 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16557 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', |
| 16558 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16559 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16560 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16561 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16562 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16563 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16564 | } |
| 16565 | |
| 16566 | // _tmp_24: yield_expr | star_expressions |
| 16567 | static void * |
| 16568 | _tmp_24_rule(Parser *p) |
| 16569 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16570 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16571 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16572 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16573 | return NULL; |
| 16574 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16575 | void * _res = NULL; |
| 16576 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16577 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16578 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16579 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16580 | return NULL; |
| 16581 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16582 | D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16583 | expr_ty yield_expr_var; |
| 16584 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16585 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16586 | ) |
| 16587 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16588 | D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16589 | _res = yield_expr_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16590 | goto done; |
| 16591 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16592 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16593 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', |
| 16594 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16595 | } |
| 16596 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16597 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16598 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16599 | return NULL; |
| 16600 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16601 | D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16602 | expr_ty star_expressions_var; |
| 16603 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16604 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16605 | ) |
| 16606 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16607 | D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16608 | _res = star_expressions_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16609 | goto done; |
| 16610 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16611 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16612 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', |
| 16613 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16614 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16615 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16616 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16617 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16618 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16619 | } |
| 16620 | |
| 16621 | // _loop0_26: ',' NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16622 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16623 | _loop0_26_rule(Parser *p) |
| 16624 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16625 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16626 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16627 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16628 | return NULL; |
| 16629 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16630 | void *_res = NULL; |
| 16631 | int _mark = p->mark; |
| 16632 | int _start_mark = p->mark; |
| 16633 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16634 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16635 | p->error_indicator = 1; |
| 16636 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16637 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16638 | return NULL; |
| 16639 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16640 | ssize_t _children_capacity = 1; |
| 16641 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16642 | { // ',' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16643 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16644 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16645 | return NULL; |
| 16646 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16647 | D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16648 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16649 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16650 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16651 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16652 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16653 | (elem = _PyPegen_name_token(p)) // NAME |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16654 | ) |
| 16655 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16656 | _res = elem; |
| 16657 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16658 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16659 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16660 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16661 | return NULL; |
| 16662 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16663 | if (_n == _children_capacity) { |
| 16664 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16665 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16666 | if (!_new_children) { |
| 16667 | p->error_indicator = 1; |
| 16668 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16669 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16670 | return NULL; |
| 16671 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16672 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16673 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16674 | _children[_n++] = _res; |
| 16675 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16676 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16677 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16678 | D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ', |
| 16679 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16680 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16681 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 16682 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16683 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16684 | p->error_indicator = 1; |
| 16685 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16686 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16687 | return NULL; |
| 16688 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16689 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 16690 | PyMem_Free(_children); |
| 16691 | _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16692 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16693 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16694 | } |
| 16695 | |
| 16696 | // _gather_25: NAME _loop0_26 |
| 16697 | static asdl_seq * |
| 16698 | _gather_25_rule(Parser *p) |
| 16699 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16700 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16701 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16702 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16703 | return NULL; |
| 16704 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16705 | asdl_seq * _res = NULL; |
| 16706 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16707 | { // NAME _loop0_26 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16708 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16709 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16710 | return NULL; |
| 16711 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16712 | D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16713 | expr_ty elem; |
| 16714 | asdl_seq * seq; |
| 16715 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16716 | (elem = _PyPegen_name_token(p)) // NAME |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16717 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16718 | (seq = _loop0_26_rule(p)) // _loop0_26 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16719 | ) |
| 16720 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16721 | D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16722 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16723 | goto done; |
| 16724 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16725 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16726 | D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ', |
| 16727 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16728 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16729 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16730 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16731 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16732 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16733 | } |
| 16734 | |
| 16735 | // _loop0_28: ',' NAME |
| 16736 | static asdl_seq * |
| 16737 | _loop0_28_rule(Parser *p) |
| 16738 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16739 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16740 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16741 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16742 | return NULL; |
| 16743 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16744 | void *_res = NULL; |
| 16745 | int _mark = p->mark; |
| 16746 | int _start_mark = p->mark; |
| 16747 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16748 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16749 | p->error_indicator = 1; |
| 16750 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16751 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16752 | return NULL; |
| 16753 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16754 | ssize_t _children_capacity = 1; |
| 16755 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16756 | { // ',' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16757 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16758 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16759 | return NULL; |
| 16760 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16761 | D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16762 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16763 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16764 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16765 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16766 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16767 | (elem = _PyPegen_name_token(p)) // NAME |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16768 | ) |
| 16769 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16770 | _res = elem; |
| 16771 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16772 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16773 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16774 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16775 | return NULL; |
| 16776 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16777 | if (_n == _children_capacity) { |
| 16778 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16779 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16780 | if (!_new_children) { |
| 16781 | p->error_indicator = 1; |
| 16782 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16783 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16784 | return NULL; |
| 16785 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16786 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16787 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16788 | _children[_n++] = _res; |
| 16789 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16790 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16791 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16792 | D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', |
| 16793 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16794 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16795 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 16796 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16797 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16798 | p->error_indicator = 1; |
| 16799 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16800 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16801 | return NULL; |
| 16802 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16803 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 16804 | PyMem_Free(_children); |
| 16805 | _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16806 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16807 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16808 | } |
| 16809 | |
| 16810 | // _gather_27: NAME _loop0_28 |
| 16811 | static asdl_seq * |
| 16812 | _gather_27_rule(Parser *p) |
| 16813 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16814 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16815 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16816 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16817 | return NULL; |
| 16818 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16819 | asdl_seq * _res = NULL; |
| 16820 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16821 | { // NAME _loop0_28 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16822 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16823 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16824 | return NULL; |
| 16825 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16826 | D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16827 | expr_ty elem; |
| 16828 | asdl_seq * seq; |
| 16829 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16830 | (elem = _PyPegen_name_token(p)) // NAME |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16831 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16832 | (seq = _loop0_28_rule(p)) // _loop0_28 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16833 | ) |
| 16834 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16835 | D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16836 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16837 | goto done; |
| 16838 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16839 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16840 | D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ', |
| 16841 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16842 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16843 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16844 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16845 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16846 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16847 | } |
| 16848 | |
| 16849 | // _tmp_29: ',' expression |
| 16850 | static void * |
| 16851 | _tmp_29_rule(Parser *p) |
| 16852 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16853 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16854 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16855 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16856 | return NULL; |
| 16857 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16858 | void * _res = NULL; |
| 16859 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16860 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16861 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16862 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16863 | return NULL; |
| 16864 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16865 | D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16866 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16867 | expr_ty z; |
| 16868 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16869 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16870 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16871 | (z = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16872 | ) |
| 16873 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16874 | D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16875 | _res = z; |
| 16876 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16877 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16878 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16879 | return NULL; |
| 16880 | } |
| 16881 | goto done; |
| 16882 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16883 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16884 | D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ', |
| 16885 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16886 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16887 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16888 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16889 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16890 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16891 | } |
| 16892 | |
| 16893 | // _loop0_30: ('.' | '...') |
| 16894 | static asdl_seq * |
| 16895 | _loop0_30_rule(Parser *p) |
| 16896 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16897 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16898 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16899 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16900 | return NULL; |
| 16901 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16902 | void *_res = NULL; |
| 16903 | int _mark = p->mark; |
| 16904 | int _start_mark = p->mark; |
| 16905 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16906 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16907 | p->error_indicator = 1; |
| 16908 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16909 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16910 | return NULL; |
| 16911 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16912 | ssize_t _children_capacity = 1; |
| 16913 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16914 | { // ('.' | '...') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16915 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16916 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16917 | return NULL; |
| 16918 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16919 | D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16920 | void *_tmp_136_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16921 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16922 | (_tmp_136_var = _tmp_136_rule(p)) // '.' | '...' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16923 | ) |
| 16924 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16925 | _res = _tmp_136_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16926 | if (_n == _children_capacity) { |
| 16927 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16928 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16929 | if (!_new_children) { |
| 16930 | p->error_indicator = 1; |
| 16931 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16932 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16933 | return NULL; |
| 16934 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16935 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16936 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16937 | _children[_n++] = _res; |
| 16938 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16939 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16940 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16941 | D(fprintf(stderr, "%*c%s _loop0_30[%d-%d]: %s failed!\n", p->level, ' ', |
| 16942 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16943 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16944 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 16945 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16946 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16947 | p->error_indicator = 1; |
| 16948 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16949 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16950 | return NULL; |
| 16951 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16952 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 16953 | PyMem_Free(_children); |
| 16954 | _PyPegen_insert_memo(p, _start_mark, _loop0_30_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16955 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16956 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16957 | } |
| 16958 | |
| 16959 | // _loop1_31: ('.' | '...') |
| 16960 | static asdl_seq * |
| 16961 | _loop1_31_rule(Parser *p) |
| 16962 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16963 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16964 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16965 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16966 | return NULL; |
| 16967 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16968 | void *_res = NULL; |
| 16969 | int _mark = p->mark; |
| 16970 | int _start_mark = p->mark; |
| 16971 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16972 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16973 | p->error_indicator = 1; |
| 16974 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16975 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16976 | return NULL; |
| 16977 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16978 | ssize_t _children_capacity = 1; |
| 16979 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16980 | { // ('.' | '...') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16981 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16982 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16983 | return NULL; |
| 16984 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16985 | D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16986 | void *_tmp_137_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16987 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16988 | (_tmp_137_var = _tmp_137_rule(p)) // '.' | '...' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16989 | ) |
| 16990 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 16991 | _res = _tmp_137_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16992 | if (_n == _children_capacity) { |
| 16993 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16994 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16995 | if (!_new_children) { |
| 16996 | p->error_indicator = 1; |
| 16997 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16998 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16999 | return NULL; |
| 17000 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17001 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17002 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17003 | _children[_n++] = _res; |
| 17004 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17005 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17006 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17007 | D(fprintf(stderr, "%*c%s _loop1_31[%d-%d]: %s failed!\n", p->level, ' ', |
| 17008 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17009 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17010 | if (_n == 0 || p->error_indicator) { |
| 17011 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17012 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17013 | return NULL; |
| 17014 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17015 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17016 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17017 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17018 | p->error_indicator = 1; |
| 17019 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17020 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17021 | return NULL; |
| 17022 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17023 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17024 | PyMem_Free(_children); |
| 17025 | _PyPegen_insert_memo(p, _start_mark, _loop1_31_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17026 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17027 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17028 | } |
| 17029 | |
| 17030 | // _loop0_33: ',' import_from_as_name |
| 17031 | static asdl_seq * |
| 17032 | _loop0_33_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17033 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17034 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17035 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17036 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17037 | return NULL; |
| 17038 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17039 | void *_res = NULL; |
| 17040 | int _mark = p->mark; |
| 17041 | int _start_mark = p->mark; |
| 17042 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17043 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17044 | p->error_indicator = 1; |
| 17045 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17046 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17047 | return NULL; |
| 17048 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17049 | ssize_t _children_capacity = 1; |
| 17050 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17051 | { // ',' import_from_as_name |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17052 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17053 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17054 | return NULL; |
| 17055 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17056 | D(fprintf(stderr, "%*c> _loop0_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17057 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17058 | alias_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17059 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17060 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17061 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17062 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17063 | ) |
| 17064 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17065 | _res = elem; |
| 17066 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17067 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17068 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17069 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17070 | return NULL; |
| 17071 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17072 | if (_n == _children_capacity) { |
| 17073 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17074 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17075 | if (!_new_children) { |
| 17076 | p->error_indicator = 1; |
| 17077 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17078 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17079 | return NULL; |
| 17080 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17081 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17082 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17083 | _children[_n++] = _res; |
| 17084 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17085 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17086 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17087 | D(fprintf(stderr, "%*c%s _loop0_33[%d-%d]: %s failed!\n", p->level, ' ', |
| 17088 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17089 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17090 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17091 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17092 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17093 | p->error_indicator = 1; |
| 17094 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17095 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17096 | return NULL; |
| 17097 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17098 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17099 | PyMem_Free(_children); |
| 17100 | _PyPegen_insert_memo(p, _start_mark, _loop0_33_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17101 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17102 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17103 | } |
| 17104 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17105 | // _gather_32: import_from_as_name _loop0_33 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17106 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17107 | _gather_32_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17108 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17109 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17110 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17111 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17112 | return NULL; |
| 17113 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17114 | asdl_seq * _res = NULL; |
| 17115 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17116 | { // import_from_as_name _loop0_33 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17117 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17118 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17119 | return NULL; |
| 17120 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17121 | D(fprintf(stderr, "%*c> _gather_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17122 | alias_ty elem; |
| 17123 | asdl_seq * seq; |
| 17124 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17125 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17126 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17127 | (seq = _loop0_33_rule(p)) // _loop0_33 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17128 | ) |
| 17129 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17130 | D(fprintf(stderr, "%*c+ _gather_32[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17131 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17132 | goto done; |
| 17133 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17134 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17135 | D(fprintf(stderr, "%*c%s _gather_32[%d-%d]: %s failed!\n", p->level, ' ', |
| 17136 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_33")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17137 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17138 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17139 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17140 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17141 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17142 | } |
| 17143 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17144 | // _tmp_34: 'as' NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17145 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17146 | _tmp_34_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17147 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17148 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17149 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17150 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17151 | return NULL; |
| 17152 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17153 | void * _res = NULL; |
| 17154 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17155 | { // 'as' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17156 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17157 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17158 | return NULL; |
| 17159 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17160 | D(fprintf(stderr, "%*c> _tmp_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17161 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17162 | expr_ty z; |
| 17163 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17164 | (_keyword = _PyPegen_expect_token(p, 531)) // token='as' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17165 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17166 | (z = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17167 | ) |
| 17168 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17169 | D(fprintf(stderr, "%*c+ _tmp_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17170 | _res = z; |
| 17171 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17172 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17173 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17174 | return NULL; |
| 17175 | } |
| 17176 | goto done; |
| 17177 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17178 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17179 | D(fprintf(stderr, "%*c%s _tmp_34[%d-%d]: %s failed!\n", p->level, ' ', |
| 17180 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17181 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17182 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17183 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17184 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17185 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17186 | } |
| 17187 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17188 | // _loop0_36: ',' dotted_as_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17189 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17190 | _loop0_36_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17191 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17192 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17193 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17194 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17195 | return NULL; |
| 17196 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17197 | void *_res = NULL; |
| 17198 | int _mark = p->mark; |
| 17199 | int _start_mark = p->mark; |
| 17200 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17201 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17202 | p->error_indicator = 1; |
| 17203 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17204 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17205 | return NULL; |
| 17206 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17207 | ssize_t _children_capacity = 1; |
| 17208 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17209 | { // ',' dotted_as_name |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17210 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17211 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17212 | return NULL; |
| 17213 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17214 | D(fprintf(stderr, "%*c> _loop0_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17215 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17216 | alias_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17217 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17218 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17219 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17220 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17221 | ) |
| 17222 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17223 | _res = elem; |
| 17224 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17225 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17226 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17227 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17228 | return NULL; |
| 17229 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17230 | if (_n == _children_capacity) { |
| 17231 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17232 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17233 | if (!_new_children) { |
| 17234 | p->error_indicator = 1; |
| 17235 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17236 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17237 | return NULL; |
| 17238 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17239 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17240 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17241 | _children[_n++] = _res; |
| 17242 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17243 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17244 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17245 | D(fprintf(stderr, "%*c%s _loop0_36[%d-%d]: %s failed!\n", p->level, ' ', |
| 17246 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17248 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17249 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17250 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17251 | p->error_indicator = 1; |
| 17252 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17253 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17254 | return NULL; |
| 17255 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17256 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17257 | PyMem_Free(_children); |
| 17258 | _PyPegen_insert_memo(p, _start_mark, _loop0_36_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17259 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17260 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17261 | } |
| 17262 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17263 | // _gather_35: dotted_as_name _loop0_36 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17264 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17265 | _gather_35_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17266 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17267 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17268 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17269 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17270 | return NULL; |
| 17271 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17272 | asdl_seq * _res = NULL; |
| 17273 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17274 | { // dotted_as_name _loop0_36 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17275 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17276 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17277 | return NULL; |
| 17278 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17279 | D(fprintf(stderr, "%*c> _gather_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17280 | alias_ty elem; |
| 17281 | asdl_seq * seq; |
| 17282 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17283 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17284 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17285 | (seq = _loop0_36_rule(p)) // _loop0_36 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17286 | ) |
| 17287 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17288 | D(fprintf(stderr, "%*c+ _gather_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17289 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17290 | goto done; |
| 17291 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17292 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17293 | D(fprintf(stderr, "%*c%s _gather_35[%d-%d]: %s failed!\n", p->level, ' ', |
| 17294 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_36")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17295 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17296 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17297 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17298 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17299 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17300 | } |
| 17301 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17302 | // _tmp_37: 'as' NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17303 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17304 | _tmp_37_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17305 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17306 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17307 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17308 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17309 | return NULL; |
| 17310 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17311 | void * _res = NULL; |
| 17312 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17313 | { // 'as' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17314 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17315 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17316 | return NULL; |
| 17317 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17318 | D(fprintf(stderr, "%*c> _tmp_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17319 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17320 | expr_ty z; |
| 17321 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17322 | (_keyword = _PyPegen_expect_token(p, 531)) // token='as' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17323 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17324 | (z = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17325 | ) |
| 17326 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17327 | D(fprintf(stderr, "%*c+ _tmp_37[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17328 | _res = z; |
| 17329 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17330 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17331 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17332 | return NULL; |
| 17333 | } |
| 17334 | goto done; |
| 17335 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17336 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17337 | D(fprintf(stderr, "%*c%s _tmp_37[%d-%d]: %s failed!\n", p->level, ' ', |
| 17338 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17339 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17340 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17341 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17342 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17343 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17344 | } |
| 17345 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17346 | // _loop0_39: ',' with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17347 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17348 | _loop0_39_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17349 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17350 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17351 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17352 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17353 | return NULL; |
| 17354 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17355 | void *_res = NULL; |
| 17356 | int _mark = p->mark; |
| 17357 | int _start_mark = p->mark; |
| 17358 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17359 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17360 | p->error_indicator = 1; |
| 17361 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17362 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17363 | return NULL; |
| 17364 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17365 | ssize_t _children_capacity = 1; |
| 17366 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17367 | { // ',' with_item |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17368 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17369 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17370 | return NULL; |
| 17371 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17372 | D(fprintf(stderr, "%*c> _loop0_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17373 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17374 | withitem_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17375 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17376 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17377 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17378 | (elem = with_item_rule(p)) // with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17379 | ) |
| 17380 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17381 | _res = elem; |
| 17382 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17383 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17384 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17385 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17386 | return NULL; |
| 17387 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17388 | if (_n == _children_capacity) { |
| 17389 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17390 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17391 | if (!_new_children) { |
| 17392 | p->error_indicator = 1; |
| 17393 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17394 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17395 | return NULL; |
| 17396 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17397 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17398 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17399 | _children[_n++] = _res; |
| 17400 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17401 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17402 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17403 | D(fprintf(stderr, "%*c%s _loop0_39[%d-%d]: %s failed!\n", p->level, ' ', |
| 17404 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17405 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17406 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17407 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17408 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17409 | p->error_indicator = 1; |
| 17410 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17411 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17412 | return NULL; |
| 17413 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17414 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17415 | PyMem_Free(_children); |
| 17416 | _PyPegen_insert_memo(p, _start_mark, _loop0_39_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17417 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17418 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17419 | } |
| 17420 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17421 | // _gather_38: with_item _loop0_39 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17422 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17423 | _gather_38_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17424 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17425 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17426 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17427 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17428 | return NULL; |
| 17429 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17430 | asdl_seq * _res = NULL; |
| 17431 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17432 | { // with_item _loop0_39 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17433 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17434 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17435 | return NULL; |
| 17436 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17437 | D(fprintf(stderr, "%*c> _gather_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17438 | withitem_ty elem; |
| 17439 | asdl_seq * seq; |
| 17440 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17441 | (elem = with_item_rule(p)) // with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17442 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17443 | (seq = _loop0_39_rule(p)) // _loop0_39 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17444 | ) |
| 17445 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17446 | D(fprintf(stderr, "%*c+ _gather_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17447 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17448 | goto done; |
| 17449 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17450 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17451 | D(fprintf(stderr, "%*c%s _gather_38[%d-%d]: %s failed!\n", p->level, ' ', |
| 17452 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_39")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17453 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17454 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17455 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17456 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17457 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17458 | } |
| 17459 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17460 | // _loop0_41: ',' with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17461 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17462 | _loop0_41_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17463 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17464 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17465 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17466 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17467 | return NULL; |
| 17468 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17469 | void *_res = NULL; |
| 17470 | int _mark = p->mark; |
| 17471 | int _start_mark = p->mark; |
| 17472 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17473 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17474 | p->error_indicator = 1; |
| 17475 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17476 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17477 | return NULL; |
| 17478 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17479 | ssize_t _children_capacity = 1; |
| 17480 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17481 | { // ',' with_item |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17482 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17483 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17484 | return NULL; |
| 17485 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17486 | D(fprintf(stderr, "%*c> _loop0_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17487 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17488 | withitem_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17489 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17490 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17491 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17492 | (elem = with_item_rule(p)) // with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17493 | ) |
| 17494 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17495 | _res = elem; |
| 17496 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17497 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17498 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17499 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17500 | return NULL; |
| 17501 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17502 | if (_n == _children_capacity) { |
| 17503 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17504 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17505 | if (!_new_children) { |
| 17506 | p->error_indicator = 1; |
| 17507 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17508 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17509 | return NULL; |
| 17510 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17511 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17512 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17513 | _children[_n++] = _res; |
| 17514 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17515 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17516 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17517 | D(fprintf(stderr, "%*c%s _loop0_41[%d-%d]: %s failed!\n", p->level, ' ', |
| 17518 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17519 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17520 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17521 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17522 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17523 | p->error_indicator = 1; |
| 17524 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17525 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17526 | return NULL; |
| 17527 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17528 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17529 | PyMem_Free(_children); |
| 17530 | _PyPegen_insert_memo(p, _start_mark, _loop0_41_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17531 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17532 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17533 | } |
| 17534 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17535 | // _gather_40: with_item _loop0_41 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17536 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17537 | _gather_40_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17538 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17539 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17540 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17541 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17542 | return NULL; |
| 17543 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17544 | asdl_seq * _res = NULL; |
| 17545 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17546 | { // with_item _loop0_41 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17547 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17548 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17549 | return NULL; |
| 17550 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17551 | D(fprintf(stderr, "%*c> _gather_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17552 | withitem_ty elem; |
| 17553 | asdl_seq * seq; |
| 17554 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17555 | (elem = with_item_rule(p)) // with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17556 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17557 | (seq = _loop0_41_rule(p)) // _loop0_41 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17558 | ) |
| 17559 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17560 | D(fprintf(stderr, "%*c+ _gather_40[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17561 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17562 | goto done; |
| 17563 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17564 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17565 | D(fprintf(stderr, "%*c%s _gather_40[%d-%d]: %s failed!\n", p->level, ' ', |
| 17566 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_41")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17567 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17568 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17569 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17570 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17571 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17572 | } |
| 17573 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17574 | // _loop0_43: ',' with_item |
| 17575 | static asdl_seq * |
| 17576 | _loop0_43_rule(Parser *p) |
| 17577 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17578 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17579 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17580 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17581 | return NULL; |
| 17582 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17583 | void *_res = NULL; |
| 17584 | int _mark = p->mark; |
| 17585 | int _start_mark = p->mark; |
| 17586 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17587 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17588 | p->error_indicator = 1; |
| 17589 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17590 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17591 | return NULL; |
| 17592 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17593 | ssize_t _children_capacity = 1; |
| 17594 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17595 | { // ',' with_item |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17596 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17597 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17598 | return NULL; |
| 17599 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17600 | D(fprintf(stderr, "%*c> _loop0_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17601 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17602 | withitem_ty elem; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17603 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17604 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17605 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17606 | (elem = with_item_rule(p)) // with_item |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17607 | ) |
| 17608 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17609 | _res = elem; |
| 17610 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17611 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17612 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17613 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17614 | return NULL; |
| 17615 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17616 | if (_n == _children_capacity) { |
| 17617 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17618 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17619 | if (!_new_children) { |
| 17620 | p->error_indicator = 1; |
| 17621 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17622 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17623 | return NULL; |
| 17624 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17625 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17626 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17627 | _children[_n++] = _res; |
| 17628 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17629 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17630 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17631 | D(fprintf(stderr, "%*c%s _loop0_43[%d-%d]: %s failed!\n", p->level, ' ', |
| 17632 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17633 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17634 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17635 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17636 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17637 | p->error_indicator = 1; |
| 17638 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17639 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17640 | return NULL; |
| 17641 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17642 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17643 | PyMem_Free(_children); |
| 17644 | _PyPegen_insert_memo(p, _start_mark, _loop0_43_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17645 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17646 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17647 | } |
| 17648 | |
| 17649 | // _gather_42: with_item _loop0_43 |
| 17650 | static asdl_seq * |
| 17651 | _gather_42_rule(Parser *p) |
| 17652 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17653 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17654 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17655 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17656 | return NULL; |
| 17657 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17658 | asdl_seq * _res = NULL; |
| 17659 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17660 | { // with_item _loop0_43 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17661 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17662 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17663 | return NULL; |
| 17664 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17665 | D(fprintf(stderr, "%*c> _gather_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17666 | withitem_ty elem; |
| 17667 | asdl_seq * seq; |
| 17668 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17669 | (elem = with_item_rule(p)) // with_item |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17670 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17671 | (seq = _loop0_43_rule(p)) // _loop0_43 |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17672 | ) |
| 17673 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17674 | D(fprintf(stderr, "%*c+ _gather_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17675 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17676 | goto done; |
| 17677 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17678 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17679 | D(fprintf(stderr, "%*c%s _gather_42[%d-%d]: %s failed!\n", p->level, ' ', |
| 17680 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_43")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17681 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17682 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17683 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17684 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17685 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17686 | } |
| 17687 | |
| 17688 | // _loop0_45: ',' with_item |
| 17689 | static asdl_seq * |
| 17690 | _loop0_45_rule(Parser *p) |
| 17691 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17692 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17693 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17694 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17695 | return NULL; |
| 17696 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17697 | void *_res = NULL; |
| 17698 | int _mark = p->mark; |
| 17699 | int _start_mark = p->mark; |
| 17700 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17701 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17702 | p->error_indicator = 1; |
| 17703 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17704 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17705 | return NULL; |
| 17706 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17707 | ssize_t _children_capacity = 1; |
| 17708 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17709 | { // ',' with_item |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17710 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17711 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17712 | return NULL; |
| 17713 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17714 | D(fprintf(stderr, "%*c> _loop0_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17715 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17716 | withitem_ty elem; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17717 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17718 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17719 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17720 | (elem = with_item_rule(p)) // with_item |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17721 | ) |
| 17722 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17723 | _res = elem; |
| 17724 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17725 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17726 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17727 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17728 | return NULL; |
| 17729 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17730 | if (_n == _children_capacity) { |
| 17731 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17732 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17733 | if (!_new_children) { |
| 17734 | p->error_indicator = 1; |
| 17735 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17736 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17737 | return NULL; |
| 17738 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17739 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17740 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17741 | _children[_n++] = _res; |
| 17742 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17743 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17744 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17745 | D(fprintf(stderr, "%*c%s _loop0_45[%d-%d]: %s failed!\n", p->level, ' ', |
| 17746 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17747 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17748 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17749 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17750 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17751 | p->error_indicator = 1; |
| 17752 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17753 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17754 | return NULL; |
| 17755 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17756 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17757 | PyMem_Free(_children); |
| 17758 | _PyPegen_insert_memo(p, _start_mark, _loop0_45_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17759 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17760 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17761 | } |
| 17762 | |
| 17763 | // _gather_44: with_item _loop0_45 |
| 17764 | static asdl_seq * |
| 17765 | _gather_44_rule(Parser *p) |
| 17766 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17767 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17768 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17769 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17770 | return NULL; |
| 17771 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17772 | asdl_seq * _res = NULL; |
| 17773 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17774 | { // with_item _loop0_45 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17775 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17776 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17777 | return NULL; |
| 17778 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17779 | D(fprintf(stderr, "%*c> _gather_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17780 | withitem_ty elem; |
| 17781 | asdl_seq * seq; |
| 17782 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17783 | (elem = with_item_rule(p)) // with_item |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17784 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17785 | (seq = _loop0_45_rule(p)) // _loop0_45 |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17786 | ) |
| 17787 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17788 | D(fprintf(stderr, "%*c+ _gather_44[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17789 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17790 | goto done; |
| 17791 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17792 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17793 | D(fprintf(stderr, "%*c%s _gather_44[%d-%d]: %s failed!\n", p->level, ' ', |
| 17794 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_45")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17795 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17796 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17797 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17798 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17799 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17800 | } |
| 17801 | |
| 17802 | // _tmp_46: 'as' target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17803 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17804 | _tmp_46_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17805 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17806 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17807 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17808 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17809 | return NULL; |
| 17810 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17811 | void * _res = NULL; |
| 17812 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17813 | { // 'as' target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17814 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17815 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17816 | return NULL; |
| 17817 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17818 | D(fprintf(stderr, "%*c> _tmp_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17819 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17820 | expr_ty t; |
| 17821 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17822 | (_keyword = _PyPegen_expect_token(p, 531)) // token='as' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17823 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17824 | (t = target_rule(p)) // target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17825 | ) |
| 17826 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17827 | D(fprintf(stderr, "%*c+ _tmp_46[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17828 | _res = t; |
| 17829 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17830 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17831 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17832 | return NULL; |
| 17833 | } |
| 17834 | goto done; |
| 17835 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17836 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17837 | D(fprintf(stderr, "%*c%s _tmp_46[%d-%d]: %s failed!\n", p->level, ' ', |
| 17838 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17839 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17840 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17841 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17842 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17843 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17844 | } |
| 17845 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17846 | // _loop1_47: except_block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17847 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17848 | _loop1_47_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17849 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17850 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17851 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17852 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17853 | return NULL; |
| 17854 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17855 | void *_res = NULL; |
| 17856 | int _mark = p->mark; |
| 17857 | int _start_mark = p->mark; |
| 17858 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17859 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17860 | p->error_indicator = 1; |
| 17861 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17862 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17863 | return NULL; |
| 17864 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17865 | ssize_t _children_capacity = 1; |
| 17866 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17867 | { // except_block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17868 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17869 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17870 | return NULL; |
| 17871 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17872 | D(fprintf(stderr, "%*c> _loop1_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17873 | excepthandler_ty except_block_var; |
| 17874 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17875 | (except_block_var = except_block_rule(p)) // except_block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17876 | ) |
| 17877 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17878 | _res = except_block_var; |
| 17879 | if (_n == _children_capacity) { |
| 17880 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17881 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17882 | if (!_new_children) { |
| 17883 | p->error_indicator = 1; |
| 17884 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17885 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17886 | return NULL; |
| 17887 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17888 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17889 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17890 | _children[_n++] = _res; |
| 17891 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17892 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17893 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17894 | D(fprintf(stderr, "%*c%s _loop1_47[%d-%d]: %s failed!\n", p->level, ' ', |
| 17895 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17896 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17897 | if (_n == 0 || p->error_indicator) { |
| 17898 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17899 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17900 | return NULL; |
| 17901 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17902 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17903 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17904 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17905 | p->error_indicator = 1; |
| 17906 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17907 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17908 | return NULL; |
| 17909 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17910 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17911 | PyMem_Free(_children); |
| 17912 | _PyPegen_insert_memo(p, _start_mark, _loop1_47_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17913 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17914 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17915 | } |
| 17916 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 17917 | // _tmp_48: 'as' NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17918 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17919 | _tmp_48_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17920 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17921 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17922 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17923 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17924 | return NULL; |
| 17925 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17926 | void * _res = NULL; |
| 17927 | int _mark = p->mark; |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 17928 | { // 'as' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17929 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17930 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17931 | return NULL; |
| 17932 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17933 | D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17934 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17935 | expr_ty z; |
| 17936 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17937 | (_keyword = _PyPegen_expect_token(p, 531)) // token='as' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17938 | && |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 17939 | (z = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17940 | ) |
| 17941 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17942 | D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17943 | _res = z; |
| 17944 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17945 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17946 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17947 | return NULL; |
| 17948 | } |
| 17949 | goto done; |
| 17950 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17951 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17952 | D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ', |
| 17953 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17954 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17955 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17956 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17957 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17958 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17959 | } |
| 17960 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17961 | // _tmp_49: 'from' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17962 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17963 | _tmp_49_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17964 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17965 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17966 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17967 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17968 | return NULL; |
| 17969 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17970 | void * _res = NULL; |
| 17971 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17972 | { // 'from' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17973 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17974 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17975 | return NULL; |
| 17976 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17977 | D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17978 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17979 | expr_ty z; |
| 17980 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17981 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17982 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17983 | (z = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17984 | ) |
| 17985 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17986 | D(fprintf(stderr, "%*c+ _tmp_49[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17987 | _res = z; |
| 17988 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17989 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17990 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17991 | return NULL; |
| 17992 | } |
| 17993 | goto done; |
| 17994 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17995 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17996 | D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ', |
| 17997 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17998 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17999 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18000 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18001 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18002 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18003 | } |
| 18004 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18005 | // _tmp_50: '->' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18006 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18007 | _tmp_50_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18008 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18009 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18010 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18011 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18012 | return NULL; |
| 18013 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18014 | void * _res = NULL; |
| 18015 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18016 | { // '->' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18017 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18018 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18019 | return NULL; |
| 18020 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18021 | D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18022 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18023 | expr_ty z; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18024 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18025 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18026 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18027 | (z = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18028 | ) |
| 18029 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18030 | D(fprintf(stderr, "%*c+ _tmp_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18031 | _res = z; |
| 18032 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18033 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18034 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18035 | return NULL; |
| 18036 | } |
| 18037 | goto done; |
| 18038 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18039 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18040 | D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ', |
| 18041 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18042 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18043 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18044 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18045 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18046 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18047 | } |
| 18048 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18049 | // _tmp_51: '->' expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18050 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18051 | _tmp_51_rule(Parser *p) |
| 18052 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18053 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18054 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18055 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18056 | return NULL; |
| 18057 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18058 | void * _res = NULL; |
| 18059 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18060 | { // '->' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18061 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18062 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18063 | return NULL; |
| 18064 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18065 | D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18066 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18067 | expr_ty z; |
| 18068 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18069 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18070 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18071 | (z = expression_rule(p)) // expression |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18072 | ) |
| 18073 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18074 | D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18075 | _res = z; |
| 18076 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18077 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18078 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18079 | return NULL; |
| 18080 | } |
| 18081 | goto done; |
| 18082 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18083 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18084 | D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ', |
| 18085 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18086 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18087 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18088 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18089 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18090 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18091 | } |
| 18092 | |
| 18093 | // _tmp_52: NEWLINE INDENT |
| 18094 | static void * |
| 18095 | _tmp_52_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18096 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18097 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18098 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18099 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18100 | return NULL; |
| 18101 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18102 | void * _res = NULL; |
| 18103 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18104 | { // NEWLINE INDENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18105 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18106 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18107 | return NULL; |
| 18108 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18109 | D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 18110 | Token * indent_var; |
| 18111 | Token * newline_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18112 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18113 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18114 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18115 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18116 | ) |
| 18117 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18118 | D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18119 | _res = _PyPegen_dummy_name(p, newline_var, indent_var); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18120 | goto done; |
| 18121 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18122 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18123 | D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ', |
| 18124 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18125 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18126 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18127 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18128 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18129 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18130 | } |
| 18131 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18132 | // _loop0_53: param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18133 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18134 | _loop0_53_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18135 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18136 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18137 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18138 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18139 | return NULL; |
| 18140 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18141 | void *_res = NULL; |
| 18142 | int _mark = p->mark; |
| 18143 | int _start_mark = p->mark; |
| 18144 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18145 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18146 | p->error_indicator = 1; |
| 18147 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18148 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18149 | return NULL; |
| 18150 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18151 | ssize_t _children_capacity = 1; |
| 18152 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18153 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18154 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18155 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18156 | return NULL; |
| 18157 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18158 | D(fprintf(stderr, "%*c> _loop0_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18159 | arg_ty param_no_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18160 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18161 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18162 | ) |
| 18163 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18164 | _res = param_no_default_var; |
| 18165 | if (_n == _children_capacity) { |
| 18166 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18167 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18168 | if (!_new_children) { |
| 18169 | p->error_indicator = 1; |
| 18170 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18171 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18172 | return NULL; |
| 18173 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18174 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18175 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18176 | _children[_n++] = _res; |
| 18177 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18178 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18179 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18180 | D(fprintf(stderr, "%*c%s _loop0_53[%d-%d]: %s failed!\n", p->level, ' ', |
| 18181 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18182 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18183 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18184 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18185 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18186 | p->error_indicator = 1; |
| 18187 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18188 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18189 | return NULL; |
| 18190 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18191 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18192 | PyMem_Free(_children); |
| 18193 | _PyPegen_insert_memo(p, _start_mark, _loop0_53_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18194 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18195 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18196 | } |
| 18197 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18198 | // _loop0_54: param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18199 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18200 | _loop0_54_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18201 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18202 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18203 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18204 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18205 | return NULL; |
| 18206 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18207 | void *_res = NULL; |
| 18208 | int _mark = p->mark; |
| 18209 | int _start_mark = p->mark; |
| 18210 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18211 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18212 | p->error_indicator = 1; |
| 18213 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18214 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18215 | return NULL; |
| 18216 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18217 | ssize_t _children_capacity = 1; |
| 18218 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18219 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18220 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18221 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18222 | return NULL; |
| 18223 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18224 | D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18225 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18226 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18227 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18228 | ) |
| 18229 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18230 | _res = param_with_default_var; |
| 18231 | if (_n == _children_capacity) { |
| 18232 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18233 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18234 | if (!_new_children) { |
| 18235 | p->error_indicator = 1; |
| 18236 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18237 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18238 | return NULL; |
| 18239 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18240 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18241 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18242 | _children[_n++] = _res; |
| 18243 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18244 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18245 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18246 | D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ', |
| 18247 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18248 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18249 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18250 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18251 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18252 | p->error_indicator = 1; |
| 18253 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18254 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18255 | return NULL; |
| 18256 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18257 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18258 | PyMem_Free(_children); |
| 18259 | _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18260 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18261 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18262 | } |
| 18263 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18264 | // _loop0_55: param_with_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18265 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18266 | _loop0_55_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18267 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18268 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18269 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18270 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18271 | return NULL; |
| 18272 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18273 | void *_res = NULL; |
| 18274 | int _mark = p->mark; |
| 18275 | int _start_mark = p->mark; |
| 18276 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18277 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18278 | p->error_indicator = 1; |
| 18279 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18280 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18281 | return NULL; |
| 18282 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18283 | ssize_t _children_capacity = 1; |
| 18284 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18285 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18286 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18287 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18288 | return NULL; |
| 18289 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18290 | D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18291 | NameDefaultPair* param_with_default_var; |
| 18292 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18293 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18294 | ) |
| 18295 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18296 | _res = param_with_default_var; |
| 18297 | if (_n == _children_capacity) { |
| 18298 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18299 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18300 | if (!_new_children) { |
| 18301 | p->error_indicator = 1; |
| 18302 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18303 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18304 | return NULL; |
| 18305 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18306 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18307 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18308 | _children[_n++] = _res; |
| 18309 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18310 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18311 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18312 | D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ', |
| 18313 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18314 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18315 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18316 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18317 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18318 | p->error_indicator = 1; |
| 18319 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18320 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18321 | return NULL; |
| 18322 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18323 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18324 | PyMem_Free(_children); |
| 18325 | _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18326 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18327 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18328 | } |
| 18329 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18330 | // _loop1_56: param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18331 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18332 | _loop1_56_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18333 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18334 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18335 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18336 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18337 | return NULL; |
| 18338 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18339 | void *_res = NULL; |
| 18340 | int _mark = p->mark; |
| 18341 | int _start_mark = p->mark; |
| 18342 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18343 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18344 | p->error_indicator = 1; |
| 18345 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18346 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18347 | return NULL; |
| 18348 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18349 | ssize_t _children_capacity = 1; |
| 18350 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18351 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18352 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18353 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18354 | return NULL; |
| 18355 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18356 | D(fprintf(stderr, "%*c> _loop1_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18357 | arg_ty param_no_default_var; |
| 18358 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18359 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18360 | ) |
| 18361 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18362 | _res = param_no_default_var; |
| 18363 | if (_n == _children_capacity) { |
| 18364 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18365 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18366 | if (!_new_children) { |
| 18367 | p->error_indicator = 1; |
| 18368 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18369 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18370 | return NULL; |
| 18371 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18372 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18373 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18374 | _children[_n++] = _res; |
| 18375 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18376 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18377 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18378 | D(fprintf(stderr, "%*c%s _loop1_56[%d-%d]: %s failed!\n", p->level, ' ', |
| 18379 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18380 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18381 | if (_n == 0 || p->error_indicator) { |
| 18382 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18383 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18384 | return NULL; |
| 18385 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18386 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18387 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18388 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18389 | p->error_indicator = 1; |
| 18390 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18391 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18392 | return NULL; |
| 18393 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18394 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18395 | PyMem_Free(_children); |
| 18396 | _PyPegen_insert_memo(p, _start_mark, _loop1_56_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18397 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18398 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18399 | } |
| 18400 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18401 | // _loop0_57: param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18402 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18403 | _loop0_57_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18404 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18405 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18406 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18407 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18408 | return NULL; |
| 18409 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18410 | void *_res = NULL; |
| 18411 | int _mark = p->mark; |
| 18412 | int _start_mark = p->mark; |
| 18413 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18414 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18415 | p->error_indicator = 1; |
| 18416 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18417 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18418 | return NULL; |
| 18419 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18420 | ssize_t _children_capacity = 1; |
| 18421 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18422 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18423 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18424 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18425 | return NULL; |
| 18426 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18427 | D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18428 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18429 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18430 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18431 | ) |
| 18432 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18433 | _res = param_with_default_var; |
| 18434 | if (_n == _children_capacity) { |
| 18435 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18436 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18437 | if (!_new_children) { |
| 18438 | p->error_indicator = 1; |
| 18439 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18440 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18441 | return NULL; |
| 18442 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18443 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18444 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18445 | _children[_n++] = _res; |
| 18446 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18447 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18448 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18449 | D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', |
| 18450 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18451 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18452 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18453 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18454 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18455 | p->error_indicator = 1; |
| 18456 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18457 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18458 | return NULL; |
| 18459 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18460 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18461 | PyMem_Free(_children); |
| 18462 | _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18463 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18464 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18465 | } |
| 18466 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18467 | // _loop1_58: param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18468 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18469 | _loop1_58_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18470 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18471 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18472 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18473 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18474 | return NULL; |
| 18475 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18476 | void *_res = NULL; |
| 18477 | int _mark = p->mark; |
| 18478 | int _start_mark = p->mark; |
| 18479 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18480 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18481 | p->error_indicator = 1; |
| 18482 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18483 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18484 | return NULL; |
| 18485 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18486 | ssize_t _children_capacity = 1; |
| 18487 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18488 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18489 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18490 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18491 | return NULL; |
| 18492 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18493 | D(fprintf(stderr, "%*c> _loop1_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18494 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18495 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18496 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18497 | ) |
| 18498 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18499 | _res = param_with_default_var; |
| 18500 | if (_n == _children_capacity) { |
| 18501 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18502 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18503 | if (!_new_children) { |
| 18504 | p->error_indicator = 1; |
| 18505 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18506 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18507 | return NULL; |
| 18508 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18509 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18510 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18511 | _children[_n++] = _res; |
| 18512 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18513 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18514 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18515 | D(fprintf(stderr, "%*c%s _loop1_58[%d-%d]: %s failed!\n", p->level, ' ', |
| 18516 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18517 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18518 | if (_n == 0 || p->error_indicator) { |
| 18519 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18520 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18521 | return NULL; |
| 18522 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18523 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18524 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18525 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18526 | p->error_indicator = 1; |
| 18527 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18528 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18529 | return NULL; |
| 18530 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18531 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18532 | PyMem_Free(_children); |
| 18533 | _PyPegen_insert_memo(p, _start_mark, _loop1_58_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18534 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18535 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18536 | } |
| 18537 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18538 | // _loop1_59: param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18539 | static asdl_seq * |
| 18540 | _loop1_59_rule(Parser *p) |
| 18541 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18542 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18543 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18544 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18545 | return NULL; |
| 18546 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18547 | void *_res = NULL; |
| 18548 | int _mark = p->mark; |
| 18549 | int _start_mark = p->mark; |
| 18550 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18551 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18552 | p->error_indicator = 1; |
| 18553 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18554 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18555 | return NULL; |
| 18556 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18557 | ssize_t _children_capacity = 1; |
| 18558 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18559 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18560 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18561 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18562 | return NULL; |
| 18563 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18564 | D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18565 | arg_ty param_no_default_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18566 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18567 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18568 | ) |
| 18569 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18570 | _res = param_no_default_var; |
| 18571 | if (_n == _children_capacity) { |
| 18572 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18573 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18574 | if (!_new_children) { |
| 18575 | p->error_indicator = 1; |
| 18576 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18577 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18578 | return NULL; |
| 18579 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18580 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18581 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18582 | _children[_n++] = _res; |
| 18583 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18584 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18585 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18586 | D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ', |
| 18587 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18588 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18589 | if (_n == 0 || p->error_indicator) { |
| 18590 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18591 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18592 | return NULL; |
| 18593 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18594 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18595 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18596 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18597 | p->error_indicator = 1; |
| 18598 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18599 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18600 | return NULL; |
| 18601 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18602 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18603 | PyMem_Free(_children); |
| 18604 | _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18605 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18606 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18607 | } |
| 18608 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18609 | // _loop1_60: param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18610 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18611 | _loop1_60_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18612 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18613 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18614 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18615 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18616 | return NULL; |
| 18617 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18618 | void *_res = NULL; |
| 18619 | int _mark = p->mark; |
| 18620 | int _start_mark = p->mark; |
| 18621 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18622 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18623 | p->error_indicator = 1; |
| 18624 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18625 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18626 | return NULL; |
| 18627 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18628 | ssize_t _children_capacity = 1; |
| 18629 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18630 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18631 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18632 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18633 | return NULL; |
| 18634 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18635 | D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18636 | arg_ty param_no_default_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18637 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18638 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18639 | ) |
| 18640 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18641 | _res = param_no_default_var; |
| 18642 | if (_n == _children_capacity) { |
| 18643 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18644 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18645 | if (!_new_children) { |
| 18646 | p->error_indicator = 1; |
| 18647 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18648 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18649 | return NULL; |
| 18650 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18651 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18652 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18653 | _children[_n++] = _res; |
| 18654 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18655 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18656 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18657 | D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ', |
| 18658 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18659 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18660 | if (_n == 0 || p->error_indicator) { |
| 18661 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18662 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18663 | return NULL; |
| 18664 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18665 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18666 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18667 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18668 | p->error_indicator = 1; |
| 18669 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18670 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18671 | return NULL; |
| 18672 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18673 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18674 | PyMem_Free(_children); |
| 18675 | _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18676 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18677 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18678 | } |
| 18679 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18680 | // _loop0_61: param_no_default |
| 18681 | static asdl_seq * |
| 18682 | _loop0_61_rule(Parser *p) |
| 18683 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18684 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18685 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18686 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18687 | return NULL; |
| 18688 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18689 | void *_res = NULL; |
| 18690 | int _mark = p->mark; |
| 18691 | int _start_mark = p->mark; |
| 18692 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18693 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18694 | p->error_indicator = 1; |
| 18695 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18696 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18697 | return NULL; |
| 18698 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18699 | ssize_t _children_capacity = 1; |
| 18700 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18701 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18702 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18703 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18704 | return NULL; |
| 18705 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18706 | D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18707 | arg_ty param_no_default_var; |
| 18708 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18709 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18710 | ) |
| 18711 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18712 | _res = param_no_default_var; |
| 18713 | if (_n == _children_capacity) { |
| 18714 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18715 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18716 | if (!_new_children) { |
| 18717 | p->error_indicator = 1; |
| 18718 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18719 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18720 | return NULL; |
| 18721 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18722 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18723 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18724 | _children[_n++] = _res; |
| 18725 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18726 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18727 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18728 | D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', |
| 18729 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18730 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18731 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18732 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18733 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18734 | p->error_indicator = 1; |
| 18735 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18736 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18737 | return NULL; |
| 18738 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18739 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18740 | PyMem_Free(_children); |
| 18741 | _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18742 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18743 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18744 | } |
| 18745 | |
| 18746 | // _loop1_62: param_with_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18747 | static asdl_seq * |
| 18748 | _loop1_62_rule(Parser *p) |
| 18749 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18750 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18751 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18752 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18753 | return NULL; |
| 18754 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18755 | void *_res = NULL; |
| 18756 | int _mark = p->mark; |
| 18757 | int _start_mark = p->mark; |
| 18758 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18759 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18760 | p->error_indicator = 1; |
| 18761 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18762 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18763 | return NULL; |
| 18764 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18765 | ssize_t _children_capacity = 1; |
| 18766 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18767 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18768 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18769 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18770 | return NULL; |
| 18771 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18772 | D(fprintf(stderr, "%*c> _loop1_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18773 | NameDefaultPair* param_with_default_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18774 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18775 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18776 | ) |
| 18777 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18778 | _res = param_with_default_var; |
| 18779 | if (_n == _children_capacity) { |
| 18780 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18781 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18782 | if (!_new_children) { |
| 18783 | p->error_indicator = 1; |
| 18784 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18785 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18786 | return NULL; |
| 18787 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18788 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18789 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18790 | _children[_n++] = _res; |
| 18791 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18792 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18793 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18794 | D(fprintf(stderr, "%*c%s _loop1_62[%d-%d]: %s failed!\n", p->level, ' ', |
| 18795 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18796 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18797 | if (_n == 0 || p->error_indicator) { |
| 18798 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18799 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18800 | return NULL; |
| 18801 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18802 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18803 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18804 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18805 | p->error_indicator = 1; |
| 18806 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18807 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18808 | return NULL; |
| 18809 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18810 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18811 | PyMem_Free(_children); |
| 18812 | _PyPegen_insert_memo(p, _start_mark, _loop1_62_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18813 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18814 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18815 | } |
| 18816 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18817 | // _loop0_63: param_no_default |
| 18818 | static asdl_seq * |
| 18819 | _loop0_63_rule(Parser *p) |
| 18820 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18821 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18822 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18823 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18824 | return NULL; |
| 18825 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18826 | void *_res = NULL; |
| 18827 | int _mark = p->mark; |
| 18828 | int _start_mark = p->mark; |
| 18829 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18830 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18831 | p->error_indicator = 1; |
| 18832 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18833 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18834 | return NULL; |
| 18835 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18836 | ssize_t _children_capacity = 1; |
| 18837 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18838 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18839 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18840 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18841 | return NULL; |
| 18842 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18843 | D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18844 | arg_ty param_no_default_var; |
| 18845 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18846 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18847 | ) |
| 18848 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18849 | _res = param_no_default_var; |
| 18850 | if (_n == _children_capacity) { |
| 18851 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18852 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18853 | if (!_new_children) { |
| 18854 | p->error_indicator = 1; |
| 18855 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18856 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18857 | return NULL; |
| 18858 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18859 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18860 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18861 | _children[_n++] = _res; |
| 18862 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18863 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18864 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18865 | D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', |
| 18866 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18867 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18868 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18869 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18870 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18871 | p->error_indicator = 1; |
| 18872 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18873 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18874 | return NULL; |
| 18875 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18876 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18877 | PyMem_Free(_children); |
| 18878 | _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18879 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18880 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18881 | } |
| 18882 | |
| 18883 | // _loop1_64: param_with_default |
| 18884 | static asdl_seq * |
| 18885 | _loop1_64_rule(Parser *p) |
| 18886 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18887 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18888 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18889 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18890 | return NULL; |
| 18891 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18892 | void *_res = NULL; |
| 18893 | int _mark = p->mark; |
| 18894 | int _start_mark = p->mark; |
| 18895 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18896 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18897 | p->error_indicator = 1; |
| 18898 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18899 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18900 | return NULL; |
| 18901 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18902 | ssize_t _children_capacity = 1; |
| 18903 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18904 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18905 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18906 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18907 | return NULL; |
| 18908 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18909 | D(fprintf(stderr, "%*c> _loop1_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18910 | NameDefaultPair* param_with_default_var; |
| 18911 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18912 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18913 | ) |
| 18914 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18915 | _res = param_with_default_var; |
| 18916 | if (_n == _children_capacity) { |
| 18917 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18918 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18919 | if (!_new_children) { |
| 18920 | p->error_indicator = 1; |
| 18921 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18922 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18923 | return NULL; |
| 18924 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18925 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18926 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18927 | _children[_n++] = _res; |
| 18928 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18929 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18930 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18931 | D(fprintf(stderr, "%*c%s _loop1_64[%d-%d]: %s failed!\n", p->level, ' ', |
| 18932 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18933 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18934 | if (_n == 0 || p->error_indicator) { |
| 18935 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18936 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18937 | return NULL; |
| 18938 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18939 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18940 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18941 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18942 | p->error_indicator = 1; |
| 18943 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18944 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18945 | return NULL; |
| 18946 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18947 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18948 | PyMem_Free(_children); |
| 18949 | _PyPegen_insert_memo(p, _start_mark, _loop1_64_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18950 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18951 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18952 | } |
| 18953 | |
| 18954 | // _loop0_65: param_maybe_default |
| 18955 | static asdl_seq * |
| 18956 | _loop0_65_rule(Parser *p) |
| 18957 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18958 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18959 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18960 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18961 | return NULL; |
| 18962 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18963 | void *_res = NULL; |
| 18964 | int _mark = p->mark; |
| 18965 | int _start_mark = p->mark; |
| 18966 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18967 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18968 | p->error_indicator = 1; |
| 18969 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18970 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18971 | return NULL; |
| 18972 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18973 | ssize_t _children_capacity = 1; |
| 18974 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18975 | { // param_maybe_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18976 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18977 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18978 | return NULL; |
| 18979 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18980 | D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18981 | NameDefaultPair* param_maybe_default_var; |
| 18982 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18983 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18984 | ) |
| 18985 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18986 | _res = param_maybe_default_var; |
| 18987 | if (_n == _children_capacity) { |
| 18988 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18989 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18990 | if (!_new_children) { |
| 18991 | p->error_indicator = 1; |
| 18992 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18993 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18994 | return NULL; |
| 18995 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18996 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18997 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18998 | _children[_n++] = _res; |
| 18999 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19000 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19001 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19002 | D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ', |
| 19003 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19004 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19005 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19006 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19007 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19008 | p->error_indicator = 1; |
| 19009 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19010 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19011 | return NULL; |
| 19012 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19013 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19014 | PyMem_Free(_children); |
| 19015 | _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19016 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19017 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19018 | } |
| 19019 | |
| 19020 | // _loop1_66: param_maybe_default |
| 19021 | static asdl_seq * |
| 19022 | _loop1_66_rule(Parser *p) |
| 19023 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19024 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19025 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19026 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19027 | return NULL; |
| 19028 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19029 | void *_res = NULL; |
| 19030 | int _mark = p->mark; |
| 19031 | int _start_mark = p->mark; |
| 19032 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19033 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19034 | p->error_indicator = 1; |
| 19035 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19036 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19037 | return NULL; |
| 19038 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19039 | ssize_t _children_capacity = 1; |
| 19040 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19041 | { // param_maybe_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19042 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19043 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19044 | return NULL; |
| 19045 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19046 | D(fprintf(stderr, "%*c> _loop1_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19047 | NameDefaultPair* param_maybe_default_var; |
| 19048 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19049 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19050 | ) |
| 19051 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19052 | _res = param_maybe_default_var; |
| 19053 | if (_n == _children_capacity) { |
| 19054 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19055 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19056 | if (!_new_children) { |
| 19057 | p->error_indicator = 1; |
| 19058 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19059 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19060 | return NULL; |
| 19061 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19062 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19063 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19064 | _children[_n++] = _res; |
| 19065 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19066 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19067 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19068 | D(fprintf(stderr, "%*c%s _loop1_66[%d-%d]: %s failed!\n", p->level, ' ', |
| 19069 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19070 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19071 | if (_n == 0 || p->error_indicator) { |
| 19072 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19073 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19074 | return NULL; |
| 19075 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19076 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19077 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19078 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19079 | p->error_indicator = 1; |
| 19080 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19081 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19082 | return NULL; |
| 19083 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19084 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19085 | PyMem_Free(_children); |
| 19086 | _PyPegen_insert_memo(p, _start_mark, _loop1_66_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19087 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19088 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19089 | } |
| 19090 | |
| 19091 | // _loop1_67: ('@' named_expression NEWLINE) |
| 19092 | static asdl_seq * |
| 19093 | _loop1_67_rule(Parser *p) |
| 19094 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19095 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19096 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19097 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19098 | return NULL; |
| 19099 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19100 | void *_res = NULL; |
| 19101 | int _mark = p->mark; |
| 19102 | int _start_mark = p->mark; |
| 19103 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19104 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19105 | p->error_indicator = 1; |
| 19106 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19107 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19108 | return NULL; |
| 19109 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19110 | ssize_t _children_capacity = 1; |
| 19111 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19112 | { // ('@' named_expression NEWLINE) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19113 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19114 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19115 | return NULL; |
| 19116 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19117 | D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19118 | void *_tmp_138_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19119 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19120 | (_tmp_138_var = _tmp_138_rule(p)) // '@' named_expression NEWLINE |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19121 | ) |
| 19122 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19123 | _res = _tmp_138_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19124 | if (_n == _children_capacity) { |
| 19125 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19126 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19127 | if (!_new_children) { |
| 19128 | p->error_indicator = 1; |
| 19129 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19130 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19131 | return NULL; |
| 19132 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19133 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19134 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19135 | _children[_n++] = _res; |
| 19136 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19137 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19138 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19139 | D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ', |
| 19140 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19141 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19142 | if (_n == 0 || p->error_indicator) { |
| 19143 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19144 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19145 | return NULL; |
| 19146 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19147 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19148 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19149 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19150 | p->error_indicator = 1; |
| 19151 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19152 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19153 | return NULL; |
| 19154 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19155 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19156 | PyMem_Free(_children); |
| 19157 | _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19158 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19159 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19160 | } |
| 19161 | |
| 19162 | // _tmp_68: '(' arguments? ')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19163 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19164 | _tmp_68_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19165 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19166 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19167 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19168 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19169 | return NULL; |
| 19170 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19171 | void * _res = NULL; |
| 19172 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19173 | { // '(' arguments? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19174 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19175 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19176 | return NULL; |
| 19177 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19178 | D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19179 | Token * _literal; |
| 19180 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19181 | void *z; |
| 19182 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19183 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19184 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19185 | (z = arguments_rule(p), 1) // arguments? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19186 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19187 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19188 | ) |
| 19189 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19190 | D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19191 | _res = z; |
| 19192 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19193 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19194 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19195 | return NULL; |
| 19196 | } |
| 19197 | goto done; |
| 19198 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19199 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19200 | D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', |
| 19201 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19202 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19203 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19204 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19205 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19206 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19207 | } |
| 19208 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19209 | // _loop0_70: ',' star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19210 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19211 | _loop0_70_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19212 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19213 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19214 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19215 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19216 | return NULL; |
| 19217 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19218 | void *_res = NULL; |
| 19219 | int _mark = p->mark; |
| 19220 | int _start_mark = p->mark; |
| 19221 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19222 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19223 | p->error_indicator = 1; |
| 19224 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19225 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19226 | return NULL; |
| 19227 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19228 | ssize_t _children_capacity = 1; |
| 19229 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19230 | { // ',' star_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19231 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19232 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19233 | return NULL; |
| 19234 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19235 | D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19236 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19237 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19238 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19239 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19240 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19241 | (elem = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19242 | ) |
| 19243 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19244 | _res = elem; |
| 19245 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19246 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19247 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19248 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19249 | return NULL; |
| 19250 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19251 | if (_n == _children_capacity) { |
| 19252 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19253 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19254 | if (!_new_children) { |
| 19255 | p->error_indicator = 1; |
| 19256 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19257 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19258 | return NULL; |
| 19259 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19260 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19261 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19262 | _children[_n++] = _res; |
| 19263 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19264 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19265 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19266 | D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', |
| 19267 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19268 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19269 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19270 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19271 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19272 | p->error_indicator = 1; |
| 19273 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19274 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19275 | return NULL; |
| 19276 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19277 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19278 | PyMem_Free(_children); |
| 19279 | _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19280 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19281 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19282 | } |
| 19283 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19284 | // _gather_69: star_expression _loop0_70 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19285 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19286 | _gather_69_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19287 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19288 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19289 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19290 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19291 | return NULL; |
| 19292 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19293 | asdl_seq * _res = NULL; |
| 19294 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19295 | { // star_expression _loop0_70 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19296 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19297 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19298 | return NULL; |
| 19299 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19300 | D(fprintf(stderr, "%*c> _gather_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_70")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19301 | expr_ty elem; |
| 19302 | asdl_seq * seq; |
| 19303 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19304 | (elem = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19305 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19306 | (seq = _loop0_70_rule(p)) // _loop0_70 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19307 | ) |
| 19308 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19309 | D(fprintf(stderr, "%*c+ _gather_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_70")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19310 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19311 | goto done; |
| 19312 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19313 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19314 | D(fprintf(stderr, "%*c%s _gather_69[%d-%d]: %s failed!\n", p->level, ' ', |
| 19315 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_70")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19316 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19317 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19318 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19319 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19320 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19321 | } |
| 19322 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19323 | // _loop1_71: (',' star_expression) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19324 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19325 | _loop1_71_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19326 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19327 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19328 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19329 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19330 | return NULL; |
| 19331 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19332 | void *_res = NULL; |
| 19333 | int _mark = p->mark; |
| 19334 | int _start_mark = p->mark; |
| 19335 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19336 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19337 | p->error_indicator = 1; |
| 19338 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19339 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19340 | return NULL; |
| 19341 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19342 | ssize_t _children_capacity = 1; |
| 19343 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19344 | { // (',' star_expression) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19345 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19346 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19347 | return NULL; |
| 19348 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19349 | D(fprintf(stderr, "%*c> _loop1_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19350 | void *_tmp_139_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19351 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19352 | (_tmp_139_var = _tmp_139_rule(p)) // ',' star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19353 | ) |
| 19354 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19355 | _res = _tmp_139_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19356 | if (_n == _children_capacity) { |
| 19357 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19358 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19359 | if (!_new_children) { |
| 19360 | p->error_indicator = 1; |
| 19361 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19362 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19363 | return NULL; |
| 19364 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19365 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19366 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19367 | _children[_n++] = _res; |
| 19368 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19369 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19370 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19371 | D(fprintf(stderr, "%*c%s _loop1_71[%d-%d]: %s failed!\n", p->level, ' ', |
| 19372 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19373 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19374 | if (_n == 0 || p->error_indicator) { |
| 19375 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19376 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19377 | return NULL; |
| 19378 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19379 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19380 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19381 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19382 | p->error_indicator = 1; |
| 19383 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19384 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19385 | return NULL; |
| 19386 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19387 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19388 | PyMem_Free(_children); |
| 19389 | _PyPegen_insert_memo(p, _start_mark, _loop1_71_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19390 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19391 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19392 | } |
| 19393 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19394 | // _loop0_73: ',' star_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19395 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19396 | _loop0_73_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19397 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19398 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19399 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19400 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19401 | return NULL; |
| 19402 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19403 | void *_res = NULL; |
| 19404 | int _mark = p->mark; |
| 19405 | int _start_mark = p->mark; |
| 19406 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19407 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19408 | p->error_indicator = 1; |
| 19409 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19410 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19411 | return NULL; |
| 19412 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19413 | ssize_t _children_capacity = 1; |
| 19414 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19415 | { // ',' star_named_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19416 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19417 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19418 | return NULL; |
| 19419 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19420 | D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19421 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19422 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19423 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19424 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19425 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19426 | (elem = star_named_expression_rule(p)) // star_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19427 | ) |
| 19428 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19429 | _res = elem; |
| 19430 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19431 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19432 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19433 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19434 | return NULL; |
| 19435 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19436 | if (_n == _children_capacity) { |
| 19437 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19438 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19439 | if (!_new_children) { |
| 19440 | p->error_indicator = 1; |
| 19441 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19442 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19443 | return NULL; |
| 19444 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19445 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19446 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19447 | _children[_n++] = _res; |
| 19448 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19449 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19450 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19451 | D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', |
| 19452 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19453 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19454 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19455 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19456 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19457 | p->error_indicator = 1; |
| 19458 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19459 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19460 | return NULL; |
| 19461 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19462 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19463 | PyMem_Free(_children); |
| 19464 | _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19465 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19466 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19467 | } |
| 19468 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19469 | // _gather_72: star_named_expression _loop0_73 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19470 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19471 | _gather_72_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19472 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19473 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19474 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19475 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19476 | return NULL; |
| 19477 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19478 | asdl_seq * _res = NULL; |
| 19479 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19480 | { // star_named_expression _loop0_73 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19481 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19482 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19483 | return NULL; |
| 19484 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19485 | D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_73")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19486 | expr_ty elem; |
| 19487 | asdl_seq * seq; |
| 19488 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19489 | (elem = star_named_expression_rule(p)) // star_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19490 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19491 | (seq = _loop0_73_rule(p)) // _loop0_73 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19492 | ) |
| 19493 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19494 | D(fprintf(stderr, "%*c+ _gather_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_73")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19495 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19496 | goto done; |
| 19497 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19498 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19499 | D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', |
| 19500 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_73")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19501 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19502 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19503 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19504 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19505 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19506 | } |
| 19507 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19508 | // _loop1_74: (',' expression) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19509 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19510 | _loop1_74_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19511 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19512 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19513 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19514 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19515 | return NULL; |
| 19516 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19517 | void *_res = NULL; |
| 19518 | int _mark = p->mark; |
| 19519 | int _start_mark = p->mark; |
| 19520 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19521 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19522 | p->error_indicator = 1; |
| 19523 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19524 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19525 | return NULL; |
| 19526 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19527 | ssize_t _children_capacity = 1; |
| 19528 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19529 | { // (',' expression) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19530 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19531 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19532 | return NULL; |
| 19533 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19534 | D(fprintf(stderr, "%*c> _loop1_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19535 | void *_tmp_140_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19536 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19537 | (_tmp_140_var = _tmp_140_rule(p)) // ',' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19538 | ) |
| 19539 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 19540 | _res = _tmp_140_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19541 | if (_n == _children_capacity) { |
| 19542 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19543 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19544 | if (!_new_children) { |
| 19545 | p->error_indicator = 1; |
| 19546 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19547 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19548 | return NULL; |
| 19549 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19550 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19551 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19552 | _children[_n++] = _res; |
| 19553 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19554 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19555 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19556 | D(fprintf(stderr, "%*c%s _loop1_74[%d-%d]: %s failed!\n", p->level, ' ', |
| 19557 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19558 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19559 | if (_n == 0 || p->error_indicator) { |
| 19560 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19561 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19562 | return NULL; |
| 19563 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19564 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19565 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19566 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19567 | p->error_indicator = 1; |
| 19568 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19569 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19570 | return NULL; |
| 19571 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19572 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19573 | PyMem_Free(_children); |
| 19574 | _PyPegen_insert_memo(p, _start_mark, _loop1_74_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19575 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19576 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19577 | } |
| 19578 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19579 | // _loop0_75: lambda_param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19580 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19581 | _loop0_75_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19582 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19583 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19584 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19585 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19586 | return NULL; |
| 19587 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19588 | void *_res = NULL; |
| 19589 | int _mark = p->mark; |
| 19590 | int _start_mark = p->mark; |
| 19591 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19592 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19593 | p->error_indicator = 1; |
| 19594 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19595 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19596 | return NULL; |
| 19597 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19598 | ssize_t _children_capacity = 1; |
| 19599 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19600 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19601 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19602 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19603 | return NULL; |
| 19604 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19605 | D(fprintf(stderr, "%*c> _loop0_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19606 | arg_ty lambda_param_no_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19607 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19608 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19609 | ) |
| 19610 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19611 | _res = lambda_param_no_default_var; |
| 19612 | if (_n == _children_capacity) { |
| 19613 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19614 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19615 | if (!_new_children) { |
| 19616 | p->error_indicator = 1; |
| 19617 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19618 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19619 | return NULL; |
| 19620 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19621 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19622 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19623 | _children[_n++] = _res; |
| 19624 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19625 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19626 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19627 | D(fprintf(stderr, "%*c%s _loop0_75[%d-%d]: %s failed!\n", p->level, ' ', |
| 19628 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19629 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19630 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19631 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19632 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19633 | p->error_indicator = 1; |
| 19634 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19635 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19636 | return NULL; |
| 19637 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19638 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19639 | PyMem_Free(_children); |
| 19640 | _PyPegen_insert_memo(p, _start_mark, _loop0_75_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19641 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19642 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19643 | } |
| 19644 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19645 | // _loop0_76: lambda_param_with_default |
| 19646 | static asdl_seq * |
| 19647 | _loop0_76_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19648 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19649 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19650 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19651 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19652 | return NULL; |
| 19653 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19654 | void *_res = NULL; |
| 19655 | int _mark = p->mark; |
| 19656 | int _start_mark = p->mark; |
| 19657 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19658 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19659 | p->error_indicator = 1; |
| 19660 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19661 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19662 | return NULL; |
| 19663 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19664 | ssize_t _children_capacity = 1; |
| 19665 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19666 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19667 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19668 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19669 | return NULL; |
| 19670 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19671 | D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19672 | NameDefaultPair* lambda_param_with_default_var; |
| 19673 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19674 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19675 | ) |
| 19676 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19677 | _res = lambda_param_with_default_var; |
| 19678 | if (_n == _children_capacity) { |
| 19679 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19680 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19681 | if (!_new_children) { |
| 19682 | p->error_indicator = 1; |
| 19683 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19684 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19685 | return NULL; |
| 19686 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19687 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19688 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19689 | _children[_n++] = _res; |
| 19690 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19691 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19692 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19693 | D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ', |
| 19694 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19695 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19696 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19697 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19698 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19699 | p->error_indicator = 1; |
| 19700 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19701 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19702 | return NULL; |
| 19703 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19704 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19705 | PyMem_Free(_children); |
| 19706 | _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19707 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19708 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19709 | } |
| 19710 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19711 | // _loop0_77: lambda_param_with_default |
| 19712 | static asdl_seq * |
| 19713 | _loop0_77_rule(Parser *p) |
| 19714 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19715 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19716 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19717 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19718 | return NULL; |
| 19719 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19720 | void *_res = NULL; |
| 19721 | int _mark = p->mark; |
| 19722 | int _start_mark = p->mark; |
| 19723 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19724 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19725 | p->error_indicator = 1; |
| 19726 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19727 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19728 | return NULL; |
| 19729 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19730 | ssize_t _children_capacity = 1; |
| 19731 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19732 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19733 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19734 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19735 | return NULL; |
| 19736 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19737 | D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19738 | NameDefaultPair* lambda_param_with_default_var; |
| 19739 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19740 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19741 | ) |
| 19742 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19743 | _res = lambda_param_with_default_var; |
| 19744 | if (_n == _children_capacity) { |
| 19745 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19746 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19747 | if (!_new_children) { |
| 19748 | p->error_indicator = 1; |
| 19749 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19750 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19751 | return NULL; |
| 19752 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19753 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19754 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19755 | _children[_n++] = _res; |
| 19756 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19757 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19758 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19759 | D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ', |
| 19760 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19761 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19762 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19763 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19764 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19765 | p->error_indicator = 1; |
| 19766 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19767 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19768 | return NULL; |
| 19769 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19770 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19771 | PyMem_Free(_children); |
| 19772 | _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19773 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19774 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19775 | } |
| 19776 | |
| 19777 | // _loop1_78: lambda_param_no_default |
| 19778 | static asdl_seq * |
| 19779 | _loop1_78_rule(Parser *p) |
| 19780 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19781 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19782 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19783 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19784 | return NULL; |
| 19785 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19786 | void *_res = NULL; |
| 19787 | int _mark = p->mark; |
| 19788 | int _start_mark = p->mark; |
| 19789 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19790 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19791 | p->error_indicator = 1; |
| 19792 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19793 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19794 | return NULL; |
| 19795 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19796 | ssize_t _children_capacity = 1; |
| 19797 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19798 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19799 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19800 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19801 | return NULL; |
| 19802 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19803 | D(fprintf(stderr, "%*c> _loop1_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19804 | arg_ty lambda_param_no_default_var; |
| 19805 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19806 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19807 | ) |
| 19808 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19809 | _res = lambda_param_no_default_var; |
| 19810 | if (_n == _children_capacity) { |
| 19811 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19812 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19813 | if (!_new_children) { |
| 19814 | p->error_indicator = 1; |
| 19815 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19816 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19817 | return NULL; |
| 19818 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19819 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19820 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19821 | _children[_n++] = _res; |
| 19822 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19823 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19824 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19825 | D(fprintf(stderr, "%*c%s _loop1_78[%d-%d]: %s failed!\n", p->level, ' ', |
| 19826 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19827 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19828 | if (_n == 0 || p->error_indicator) { |
| 19829 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19830 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19831 | return NULL; |
| 19832 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19833 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19834 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19835 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19836 | p->error_indicator = 1; |
| 19837 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19838 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19839 | return NULL; |
| 19840 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19841 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19842 | PyMem_Free(_children); |
| 19843 | _PyPegen_insert_memo(p, _start_mark, _loop1_78_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19844 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19845 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19846 | } |
| 19847 | |
| 19848 | // _loop0_79: lambda_param_with_default |
| 19849 | static asdl_seq * |
| 19850 | _loop0_79_rule(Parser *p) |
| 19851 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19852 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19853 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19854 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19855 | return NULL; |
| 19856 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19857 | void *_res = NULL; |
| 19858 | int _mark = p->mark; |
| 19859 | int _start_mark = p->mark; |
| 19860 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19861 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19862 | p->error_indicator = 1; |
| 19863 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19864 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19865 | return NULL; |
| 19866 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19867 | ssize_t _children_capacity = 1; |
| 19868 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19869 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19870 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19871 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19872 | return NULL; |
| 19873 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19874 | D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19875 | NameDefaultPair* lambda_param_with_default_var; |
| 19876 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19877 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19878 | ) |
| 19879 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19880 | _res = lambda_param_with_default_var; |
| 19881 | if (_n == _children_capacity) { |
| 19882 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19883 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19884 | if (!_new_children) { |
| 19885 | p->error_indicator = 1; |
| 19886 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19887 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19888 | return NULL; |
| 19889 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19890 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19891 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19892 | _children[_n++] = _res; |
| 19893 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19894 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19895 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19896 | D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', |
| 19897 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19898 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19899 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19900 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19901 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19902 | p->error_indicator = 1; |
| 19903 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19904 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19905 | return NULL; |
| 19906 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19907 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19908 | PyMem_Free(_children); |
| 19909 | _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19910 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19911 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19912 | } |
| 19913 | |
| 19914 | // _loop1_80: lambda_param_with_default |
| 19915 | static asdl_seq * |
| 19916 | _loop1_80_rule(Parser *p) |
| 19917 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19918 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19919 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19920 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19921 | return NULL; |
| 19922 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19923 | void *_res = NULL; |
| 19924 | int _mark = p->mark; |
| 19925 | int _start_mark = p->mark; |
| 19926 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19927 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19928 | p->error_indicator = 1; |
| 19929 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19930 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19931 | return NULL; |
| 19932 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19933 | ssize_t _children_capacity = 1; |
| 19934 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19935 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19936 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19937 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19938 | return NULL; |
| 19939 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19940 | D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19941 | NameDefaultPair* lambda_param_with_default_var; |
| 19942 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19943 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19944 | ) |
| 19945 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19946 | _res = lambda_param_with_default_var; |
| 19947 | if (_n == _children_capacity) { |
| 19948 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19949 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19950 | if (!_new_children) { |
| 19951 | p->error_indicator = 1; |
| 19952 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19953 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19954 | return NULL; |
| 19955 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19956 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19957 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19958 | _children[_n++] = _res; |
| 19959 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19960 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19961 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19962 | D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', |
| 19963 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19964 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19965 | if (_n == 0 || p->error_indicator) { |
| 19966 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19967 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19968 | return NULL; |
| 19969 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19970 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19971 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19972 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19973 | p->error_indicator = 1; |
| 19974 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19975 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19976 | return NULL; |
| 19977 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19978 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19979 | PyMem_Free(_children); |
| 19980 | _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19981 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19982 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19983 | } |
| 19984 | |
| 19985 | // _loop1_81: lambda_param_no_default |
| 19986 | static asdl_seq * |
| 19987 | _loop1_81_rule(Parser *p) |
| 19988 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19989 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19990 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19991 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19992 | return NULL; |
| 19993 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19994 | void *_res = NULL; |
| 19995 | int _mark = p->mark; |
| 19996 | int _start_mark = p->mark; |
| 19997 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19998 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19999 | p->error_indicator = 1; |
| 20000 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20001 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20002 | return NULL; |
| 20003 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20004 | ssize_t _children_capacity = 1; |
| 20005 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20006 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20007 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20008 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20009 | return NULL; |
| 20010 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20011 | D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20012 | arg_ty lambda_param_no_default_var; |
| 20013 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20014 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20015 | ) |
| 20016 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20017 | _res = lambda_param_no_default_var; |
| 20018 | if (_n == _children_capacity) { |
| 20019 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20020 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20021 | if (!_new_children) { |
| 20022 | p->error_indicator = 1; |
| 20023 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20024 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20025 | return NULL; |
| 20026 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20027 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20028 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20029 | _children[_n++] = _res; |
| 20030 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20031 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20032 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20033 | D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', |
| 20034 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20035 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20036 | if (_n == 0 || p->error_indicator) { |
| 20037 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20038 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20039 | return NULL; |
| 20040 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20041 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20042 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20043 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20044 | p->error_indicator = 1; |
| 20045 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20046 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20047 | return NULL; |
| 20048 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20049 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20050 | PyMem_Free(_children); |
| 20051 | _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20052 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20053 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20054 | } |
| 20055 | |
| 20056 | // _loop1_82: lambda_param_no_default |
| 20057 | static asdl_seq * |
| 20058 | _loop1_82_rule(Parser *p) |
| 20059 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20060 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20061 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20062 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20063 | return NULL; |
| 20064 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20065 | void *_res = NULL; |
| 20066 | int _mark = p->mark; |
| 20067 | int _start_mark = p->mark; |
| 20068 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20069 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20070 | p->error_indicator = 1; |
| 20071 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20072 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20073 | return NULL; |
| 20074 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20075 | ssize_t _children_capacity = 1; |
| 20076 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20077 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20078 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20079 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20080 | return NULL; |
| 20081 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20082 | D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20083 | arg_ty lambda_param_no_default_var; |
| 20084 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20085 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20086 | ) |
| 20087 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20088 | _res = lambda_param_no_default_var; |
| 20089 | if (_n == _children_capacity) { |
| 20090 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20091 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20092 | if (!_new_children) { |
| 20093 | p->error_indicator = 1; |
| 20094 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20095 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20096 | return NULL; |
| 20097 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20098 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20099 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20100 | _children[_n++] = _res; |
| 20101 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20102 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20103 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20104 | D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ', |
| 20105 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20106 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20107 | if (_n == 0 || p->error_indicator) { |
| 20108 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20109 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20110 | return NULL; |
| 20111 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20112 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20113 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20114 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20115 | p->error_indicator = 1; |
| 20116 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20117 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20118 | return NULL; |
| 20119 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20120 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20121 | PyMem_Free(_children); |
| 20122 | _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20123 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20124 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20125 | } |
| 20126 | |
| 20127 | // _loop0_83: lambda_param_no_default |
| 20128 | static asdl_seq * |
| 20129 | _loop0_83_rule(Parser *p) |
| 20130 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20131 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20132 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20133 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20134 | return NULL; |
| 20135 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20136 | void *_res = NULL; |
| 20137 | int _mark = p->mark; |
| 20138 | int _start_mark = p->mark; |
| 20139 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20140 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20141 | p->error_indicator = 1; |
| 20142 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20143 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20144 | return NULL; |
| 20145 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20146 | ssize_t _children_capacity = 1; |
| 20147 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20148 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20149 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20150 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20151 | return NULL; |
| 20152 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20153 | D(fprintf(stderr, "%*c> _loop0_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20154 | arg_ty lambda_param_no_default_var; |
| 20155 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20156 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20157 | ) |
| 20158 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20159 | _res = lambda_param_no_default_var; |
| 20160 | if (_n == _children_capacity) { |
| 20161 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20162 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20163 | if (!_new_children) { |
| 20164 | p->error_indicator = 1; |
| 20165 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20166 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20167 | return NULL; |
| 20168 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20169 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20170 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20171 | _children[_n++] = _res; |
| 20172 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20173 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20174 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20175 | D(fprintf(stderr, "%*c%s _loop0_83[%d-%d]: %s failed!\n", p->level, ' ', |
| 20176 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20177 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20178 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20179 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20180 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20181 | p->error_indicator = 1; |
| 20182 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20183 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20184 | return NULL; |
| 20185 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20186 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20187 | PyMem_Free(_children); |
| 20188 | _PyPegen_insert_memo(p, _start_mark, _loop0_83_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20189 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20190 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20191 | } |
| 20192 | |
| 20193 | // _loop1_84: lambda_param_with_default |
| 20194 | static asdl_seq * |
| 20195 | _loop1_84_rule(Parser *p) |
| 20196 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20197 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20198 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20199 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20200 | return NULL; |
| 20201 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20202 | void *_res = NULL; |
| 20203 | int _mark = p->mark; |
| 20204 | int _start_mark = p->mark; |
| 20205 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20206 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20207 | p->error_indicator = 1; |
| 20208 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20209 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20210 | return NULL; |
| 20211 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20212 | ssize_t _children_capacity = 1; |
| 20213 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20214 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20215 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20216 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20217 | return NULL; |
| 20218 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20219 | D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20220 | NameDefaultPair* lambda_param_with_default_var; |
| 20221 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20222 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20223 | ) |
| 20224 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20225 | _res = lambda_param_with_default_var; |
| 20226 | if (_n == _children_capacity) { |
| 20227 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20228 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20229 | if (!_new_children) { |
| 20230 | p->error_indicator = 1; |
| 20231 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20232 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20233 | return NULL; |
| 20234 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20235 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20236 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20237 | _children[_n++] = _res; |
| 20238 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20239 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20240 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20241 | D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', |
| 20242 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20243 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20244 | if (_n == 0 || p->error_indicator) { |
| 20245 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20246 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20247 | return NULL; |
| 20248 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20249 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20250 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20251 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20252 | p->error_indicator = 1; |
| 20253 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20254 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20255 | return NULL; |
| 20256 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20257 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20258 | PyMem_Free(_children); |
| 20259 | _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20260 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20261 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20262 | } |
| 20263 | |
| 20264 | // _loop0_85: lambda_param_no_default |
| 20265 | static asdl_seq * |
| 20266 | _loop0_85_rule(Parser *p) |
| 20267 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20268 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20269 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20270 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20271 | return NULL; |
| 20272 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20273 | void *_res = NULL; |
| 20274 | int _mark = p->mark; |
| 20275 | int _start_mark = p->mark; |
| 20276 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20277 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20278 | p->error_indicator = 1; |
| 20279 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20280 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20281 | return NULL; |
| 20282 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20283 | ssize_t _children_capacity = 1; |
| 20284 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20285 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20286 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20287 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20288 | return NULL; |
| 20289 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20290 | D(fprintf(stderr, "%*c> _loop0_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20291 | arg_ty lambda_param_no_default_var; |
| 20292 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20293 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20294 | ) |
| 20295 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20296 | _res = lambda_param_no_default_var; |
| 20297 | if (_n == _children_capacity) { |
| 20298 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20299 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20300 | if (!_new_children) { |
| 20301 | p->error_indicator = 1; |
| 20302 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20303 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20304 | return NULL; |
| 20305 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20306 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20307 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20308 | _children[_n++] = _res; |
| 20309 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20310 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20311 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20312 | D(fprintf(stderr, "%*c%s _loop0_85[%d-%d]: %s failed!\n", p->level, ' ', |
| 20313 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20314 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20315 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20316 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20317 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20318 | p->error_indicator = 1; |
| 20319 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20320 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20321 | return NULL; |
| 20322 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20323 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20324 | PyMem_Free(_children); |
| 20325 | _PyPegen_insert_memo(p, _start_mark, _loop0_85_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20326 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20327 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20328 | } |
| 20329 | |
| 20330 | // _loop1_86: lambda_param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20331 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 20332 | _loop1_86_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20333 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20334 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20335 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20336 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20337 | return NULL; |
| 20338 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20339 | void *_res = NULL; |
| 20340 | int _mark = p->mark; |
| 20341 | int _start_mark = p->mark; |
| 20342 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20343 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20344 | p->error_indicator = 1; |
| 20345 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20346 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20347 | return NULL; |
| 20348 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20349 | ssize_t _children_capacity = 1; |
| 20350 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20351 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20352 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20353 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20354 | return NULL; |
| 20355 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20356 | D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20357 | NameDefaultPair* lambda_param_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20358 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20359 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20360 | ) |
| 20361 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20362 | _res = lambda_param_with_default_var; |
| 20363 | if (_n == _children_capacity) { |
| 20364 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20365 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20366 | if (!_new_children) { |
| 20367 | p->error_indicator = 1; |
| 20368 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20369 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20370 | return NULL; |
| 20371 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20372 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20373 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20374 | _children[_n++] = _res; |
| 20375 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20376 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20377 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20378 | D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', |
| 20379 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20380 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20381 | if (_n == 0 || p->error_indicator) { |
| 20382 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20383 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20384 | return NULL; |
| 20385 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20386 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20387 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20388 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20389 | p->error_indicator = 1; |
| 20390 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20391 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20392 | return NULL; |
| 20393 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20394 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20395 | PyMem_Free(_children); |
| 20396 | _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20397 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20398 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20399 | } |
| 20400 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20401 | // _loop0_87: lambda_param_maybe_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20402 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20403 | _loop0_87_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20404 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20405 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20406 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20407 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20408 | return NULL; |
| 20409 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20410 | void *_res = NULL; |
| 20411 | int _mark = p->mark; |
| 20412 | int _start_mark = p->mark; |
| 20413 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20414 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20415 | p->error_indicator = 1; |
| 20416 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20417 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20418 | return NULL; |
| 20419 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20420 | ssize_t _children_capacity = 1; |
| 20421 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20422 | { // lambda_param_maybe_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20423 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20424 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20425 | return NULL; |
| 20426 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20427 | D(fprintf(stderr, "%*c> _loop0_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20428 | NameDefaultPair* lambda_param_maybe_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20429 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20430 | (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20431 | ) |
| 20432 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20433 | _res = lambda_param_maybe_default_var; |
| 20434 | if (_n == _children_capacity) { |
| 20435 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20436 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20437 | if (!_new_children) { |
| 20438 | p->error_indicator = 1; |
| 20439 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20440 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20441 | return NULL; |
| 20442 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20443 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20444 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20445 | _children[_n++] = _res; |
| 20446 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20447 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20448 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20449 | D(fprintf(stderr, "%*c%s _loop0_87[%d-%d]: %s failed!\n", p->level, ' ', |
| 20450 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20451 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20452 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20453 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20454 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20455 | p->error_indicator = 1; |
| 20456 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20457 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20458 | return NULL; |
| 20459 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20460 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20461 | PyMem_Free(_children); |
| 20462 | _PyPegen_insert_memo(p, _start_mark, _loop0_87_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20463 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20464 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20465 | } |
| 20466 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20467 | // _loop1_88: lambda_param_maybe_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20468 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20469 | _loop1_88_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20470 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20471 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20472 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20473 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20474 | return NULL; |
| 20475 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20476 | void *_res = NULL; |
| 20477 | int _mark = p->mark; |
| 20478 | int _start_mark = p->mark; |
| 20479 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20480 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20481 | p->error_indicator = 1; |
| 20482 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20483 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20484 | return NULL; |
| 20485 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20486 | ssize_t _children_capacity = 1; |
| 20487 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20488 | { // lambda_param_maybe_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20489 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20490 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20491 | return NULL; |
| 20492 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20493 | D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20494 | NameDefaultPair* lambda_param_maybe_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20495 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20496 | (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20497 | ) |
| 20498 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20499 | _res = lambda_param_maybe_default_var; |
| 20500 | if (_n == _children_capacity) { |
| 20501 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20502 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20503 | if (!_new_children) { |
| 20504 | p->error_indicator = 1; |
| 20505 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20506 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20507 | return NULL; |
| 20508 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20509 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20510 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20511 | _children[_n++] = _res; |
| 20512 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20513 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20514 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20515 | D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', |
| 20516 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20517 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20518 | if (_n == 0 || p->error_indicator) { |
| 20519 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20520 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20521 | return NULL; |
| 20522 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20523 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20524 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20525 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20526 | p->error_indicator = 1; |
| 20527 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20528 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20529 | return NULL; |
| 20530 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20531 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20532 | PyMem_Free(_children); |
| 20533 | _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20534 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20535 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20536 | } |
| 20537 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20538 | // _loop1_89: ('or' conjunction) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20539 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20540 | _loop1_89_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20541 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20542 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20543 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20544 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20545 | return NULL; |
| 20546 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20547 | void *_res = NULL; |
| 20548 | int _mark = p->mark; |
| 20549 | int _start_mark = p->mark; |
| 20550 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20551 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20552 | p->error_indicator = 1; |
| 20553 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20554 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20555 | return NULL; |
| 20556 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20557 | ssize_t _children_capacity = 1; |
| 20558 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20559 | { // ('or' conjunction) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20560 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20561 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20562 | return NULL; |
| 20563 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20564 | D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 20565 | void *_tmp_141_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20566 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 20567 | (_tmp_141_var = _tmp_141_rule(p)) // 'or' conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20568 | ) |
| 20569 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 20570 | _res = _tmp_141_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20571 | if (_n == _children_capacity) { |
| 20572 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20573 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20574 | if (!_new_children) { |
| 20575 | p->error_indicator = 1; |
| 20576 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20577 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20578 | return NULL; |
| 20579 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20580 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20581 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20582 | _children[_n++] = _res; |
| 20583 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20584 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20585 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20586 | D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', |
| 20587 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20588 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20589 | if (_n == 0 || p->error_indicator) { |
| 20590 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20591 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20592 | return NULL; |
| 20593 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20594 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20595 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20596 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20597 | p->error_indicator = 1; |
| 20598 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20599 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20600 | return NULL; |
| 20601 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20602 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20603 | PyMem_Free(_children); |
| 20604 | _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20605 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20606 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20607 | } |
| 20608 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20609 | // _loop1_90: ('and' inversion) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20610 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20611 | _loop1_90_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20612 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20613 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20614 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20615 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20616 | return NULL; |
| 20617 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20618 | void *_res = NULL; |
| 20619 | int _mark = p->mark; |
| 20620 | int _start_mark = p->mark; |
| 20621 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20622 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20623 | p->error_indicator = 1; |
| 20624 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20625 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20626 | return NULL; |
| 20627 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20628 | ssize_t _children_capacity = 1; |
| 20629 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20630 | { // ('and' inversion) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20631 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20632 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20633 | return NULL; |
| 20634 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20635 | D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 20636 | void *_tmp_142_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20637 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 20638 | (_tmp_142_var = _tmp_142_rule(p)) // 'and' inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20639 | ) |
| 20640 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 20641 | _res = _tmp_142_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20642 | if (_n == _children_capacity) { |
| 20643 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20644 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20645 | if (!_new_children) { |
| 20646 | p->error_indicator = 1; |
| 20647 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20648 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20649 | return NULL; |
| 20650 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20651 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20652 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20653 | _children[_n++] = _res; |
| 20654 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20655 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20656 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20657 | D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ', |
| 20658 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20659 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20660 | if (_n == 0 || p->error_indicator) { |
| 20661 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20662 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20663 | return NULL; |
| 20664 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20665 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20666 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20667 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20668 | p->error_indicator = 1; |
| 20669 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20670 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20671 | return NULL; |
| 20672 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20673 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20674 | PyMem_Free(_children); |
| 20675 | _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20676 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20677 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20678 | } |
| 20679 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20680 | // _loop1_91: compare_op_bitwise_or_pair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20681 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20682 | _loop1_91_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20683 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20684 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20685 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20686 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20687 | return NULL; |
| 20688 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20689 | void *_res = NULL; |
| 20690 | int _mark = p->mark; |
| 20691 | int _start_mark = p->mark; |
| 20692 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20693 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20694 | p->error_indicator = 1; |
| 20695 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20696 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20697 | return NULL; |
| 20698 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20699 | ssize_t _children_capacity = 1; |
| 20700 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20701 | { // compare_op_bitwise_or_pair |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20702 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20703 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20704 | return NULL; |
| 20705 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20706 | D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20707 | CmpopExprPair* compare_op_bitwise_or_pair_var; |
| 20708 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20709 | (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20710 | ) |
| 20711 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20712 | _res = compare_op_bitwise_or_pair_var; |
| 20713 | if (_n == _children_capacity) { |
| 20714 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20715 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20716 | if (!_new_children) { |
| 20717 | p->error_indicator = 1; |
| 20718 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20719 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20720 | return NULL; |
| 20721 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20722 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20723 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20724 | _children[_n++] = _res; |
| 20725 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20726 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20727 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20728 | D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', |
| 20729 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20730 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20731 | if (_n == 0 || p->error_indicator) { |
| 20732 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20733 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20734 | return NULL; |
| 20735 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20736 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20737 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20738 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20739 | p->error_indicator = 1; |
| 20740 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20741 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20742 | return NULL; |
| 20743 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20744 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20745 | PyMem_Free(_children); |
| 20746 | _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20747 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20748 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20749 | } |
| 20750 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20751 | // _tmp_92: '!=' |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20752 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20753 | _tmp_92_rule(Parser *p) |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20754 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20755 | D(p->level++); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20756 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20757 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20758 | return NULL; |
| 20759 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20760 | void * _res = NULL; |
| 20761 | int _mark = p->mark; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20762 | { // '!=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20763 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20764 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20765 | return NULL; |
| 20766 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20767 | D(fprintf(stderr, "%*c> _tmp_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 20768 | Token * tok; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20769 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20770 | (tok = _PyPegen_expect_token(p, 28)) // token='!=' |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20771 | ) |
| 20772 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20773 | D(fprintf(stderr, "%*c+ _tmp_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20774 | _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; |
| 20775 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20776 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20777 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20778 | return NULL; |
| 20779 | } |
| 20780 | goto done; |
| 20781 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20782 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20783 | D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', |
| 20784 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20785 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20786 | _res = NULL; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20787 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20788 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20789 | return _res; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20790 | } |
| 20791 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20792 | // _loop0_94: ',' slice |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20793 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20794 | _loop0_94_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20795 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20796 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20797 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20798 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20799 | return NULL; |
| 20800 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20801 | void *_res = NULL; |
| 20802 | int _mark = p->mark; |
| 20803 | int _start_mark = p->mark; |
| 20804 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20805 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20806 | p->error_indicator = 1; |
| 20807 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20808 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20809 | return NULL; |
| 20810 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20811 | ssize_t _children_capacity = 1; |
| 20812 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20813 | { // ',' slice |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20814 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20815 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20816 | return NULL; |
| 20817 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20818 | D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20819 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20820 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20821 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20822 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20823 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20824 | (elem = slice_rule(p)) // slice |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20825 | ) |
| 20826 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20827 | _res = elem; |
| 20828 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20829 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20830 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20831 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20832 | return NULL; |
| 20833 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20834 | if (_n == _children_capacity) { |
| 20835 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20836 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20837 | if (!_new_children) { |
| 20838 | p->error_indicator = 1; |
| 20839 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20840 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20841 | return NULL; |
| 20842 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20843 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20844 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20845 | _children[_n++] = _res; |
| 20846 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20847 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20848 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20849 | D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', |
| 20850 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20851 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20852 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20853 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20854 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20855 | p->error_indicator = 1; |
| 20856 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20857 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20858 | return NULL; |
| 20859 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20860 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20861 | PyMem_Free(_children); |
| 20862 | _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20863 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20864 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20865 | } |
| 20866 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20867 | // _gather_93: slice _loop0_94 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20868 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20869 | _gather_93_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20870 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20871 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20872 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20873 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20874 | return NULL; |
| 20875 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20876 | asdl_seq * _res = NULL; |
| 20877 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20878 | { // slice _loop0_94 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20879 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20880 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20881 | return NULL; |
| 20882 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20883 | D(fprintf(stderr, "%*c> _gather_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_94")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20884 | expr_ty elem; |
| 20885 | asdl_seq * seq; |
| 20886 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20887 | (elem = slice_rule(p)) // slice |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20888 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20889 | (seq = _loop0_94_rule(p)) // _loop0_94 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20890 | ) |
| 20891 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20892 | D(fprintf(stderr, "%*c+ _gather_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_94")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20893 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20894 | goto done; |
| 20895 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20896 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20897 | D(fprintf(stderr, "%*c%s _gather_93[%d-%d]: %s failed!\n", p->level, ' ', |
| 20898 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_94")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20899 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20900 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20901 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20902 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20903 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20904 | } |
| 20905 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20906 | // _tmp_95: ':' expression? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20907 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20908 | _tmp_95_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20909 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20910 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20911 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20912 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20913 | return NULL; |
| 20914 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20915 | void * _res = NULL; |
| 20916 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20917 | { // ':' expression? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20918 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20919 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20920 | return NULL; |
| 20921 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20922 | D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20923 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20924 | void *d; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20925 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20926 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20927 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20928 | (d = expression_rule(p), 1) // expression? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20929 | ) |
| 20930 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20931 | D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20932 | _res = d; |
| 20933 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20934 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20935 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20936 | return NULL; |
| 20937 | } |
| 20938 | goto done; |
| 20939 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20940 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20941 | D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ', |
| 20942 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20943 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20944 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20945 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20946 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20947 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20948 | } |
| 20949 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20950 | // _tmp_96: tuple | group | genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20951 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20952 | _tmp_96_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20953 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20954 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20955 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20956 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20957 | return NULL; |
| 20958 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20959 | void * _res = NULL; |
| 20960 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20961 | { // tuple |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20962 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20963 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20964 | return NULL; |
| 20965 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20966 | D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20967 | expr_ty tuple_var; |
| 20968 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20969 | (tuple_var = tuple_rule(p)) // tuple |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20970 | ) |
| 20971 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20972 | D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20973 | _res = tuple_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20974 | goto done; |
| 20975 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20976 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20977 | D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', |
| 20978 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20979 | } |
| 20980 | { // group |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20981 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20982 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20983 | return NULL; |
| 20984 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20985 | D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20986 | expr_ty group_var; |
| 20987 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20988 | (group_var = group_rule(p)) // group |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20989 | ) |
| 20990 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20991 | D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20992 | _res = group_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20993 | goto done; |
| 20994 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20995 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20996 | D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', |
| 20997 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20998 | } |
| 20999 | { // genexp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21000 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21001 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21002 | return NULL; |
| 21003 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21004 | D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21005 | expr_ty genexp_var; |
| 21006 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21007 | (genexp_var = genexp_rule(p)) // genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21008 | ) |
| 21009 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21010 | D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21011 | _res = genexp_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21012 | goto done; |
| 21013 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21014 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21015 | D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', |
| 21016 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21017 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21018 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21019 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21020 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21021 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21022 | } |
| 21023 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21024 | // _tmp_97: list | listcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21025 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21026 | _tmp_97_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21027 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21028 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21029 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21030 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21031 | return NULL; |
| 21032 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21033 | void * _res = NULL; |
| 21034 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21035 | { // list |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21036 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21037 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21038 | return NULL; |
| 21039 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21040 | D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21041 | expr_ty list_var; |
| 21042 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21043 | (list_var = list_rule(p)) // list |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21044 | ) |
| 21045 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21046 | D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21047 | _res = list_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21048 | goto done; |
| 21049 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21050 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21051 | D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ', |
| 21052 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21053 | } |
| 21054 | { // listcomp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21055 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21056 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21057 | return NULL; |
| 21058 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21059 | D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21060 | expr_ty listcomp_var; |
| 21061 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21062 | (listcomp_var = listcomp_rule(p)) // listcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21063 | ) |
| 21064 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21065 | D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21066 | _res = listcomp_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21067 | goto done; |
| 21068 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21069 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21070 | D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ', |
| 21071 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21072 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21073 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21074 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21075 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21076 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21077 | } |
| 21078 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21079 | // _tmp_98: dict | set | dictcomp | setcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21080 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21081 | _tmp_98_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21082 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21083 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21084 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21085 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21086 | return NULL; |
| 21087 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21088 | void * _res = NULL; |
| 21089 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21090 | { // dict |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21091 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21092 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21093 | return NULL; |
| 21094 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21095 | D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21096 | expr_ty dict_var; |
| 21097 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21098 | (dict_var = dict_rule(p)) // dict |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21099 | ) |
| 21100 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21101 | D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21102 | _res = dict_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21103 | goto done; |
| 21104 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21105 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21106 | D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', |
| 21107 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21108 | } |
| 21109 | { // set |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21110 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21111 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21112 | return NULL; |
| 21113 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21114 | D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21115 | expr_ty set_var; |
| 21116 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21117 | (set_var = set_rule(p)) // set |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21118 | ) |
| 21119 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21120 | D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21121 | _res = set_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21122 | goto done; |
| 21123 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21124 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21125 | D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', |
| 21126 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21127 | } |
| 21128 | { // dictcomp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21129 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21130 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21131 | return NULL; |
| 21132 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21133 | D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21134 | expr_ty dictcomp_var; |
| 21135 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21136 | (dictcomp_var = dictcomp_rule(p)) // dictcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21137 | ) |
| 21138 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21139 | D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21140 | _res = dictcomp_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21141 | goto done; |
| 21142 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21143 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21144 | D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', |
| 21145 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21146 | } |
| 21147 | { // setcomp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21148 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21149 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21150 | return NULL; |
| 21151 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21152 | D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21153 | expr_ty setcomp_var; |
| 21154 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21155 | (setcomp_var = setcomp_rule(p)) // setcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21156 | ) |
| 21157 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21158 | D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21159 | _res = setcomp_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21160 | goto done; |
| 21161 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21162 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21163 | D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', |
| 21164 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21165 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21166 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21167 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21168 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21169 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21170 | } |
| 21171 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21172 | // _loop1_99: STRING |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21173 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21174 | _loop1_99_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21175 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21176 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21177 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21178 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21179 | return NULL; |
| 21180 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21181 | void *_res = NULL; |
| 21182 | int _mark = p->mark; |
| 21183 | int _start_mark = p->mark; |
| 21184 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21185 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21186 | p->error_indicator = 1; |
| 21187 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21188 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21189 | return NULL; |
| 21190 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21191 | ssize_t _children_capacity = 1; |
| 21192 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21193 | { // STRING |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21194 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21195 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21196 | return NULL; |
| 21197 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21198 | D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21199 | expr_ty string_var; |
| 21200 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21201 | (string_var = _PyPegen_string_token(p)) // STRING |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21202 | ) |
| 21203 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21204 | _res = string_var; |
| 21205 | if (_n == _children_capacity) { |
| 21206 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21207 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21208 | if (!_new_children) { |
| 21209 | p->error_indicator = 1; |
| 21210 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21211 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21212 | return NULL; |
| 21213 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21214 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21215 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21216 | _children[_n++] = _res; |
| 21217 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21218 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21219 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21220 | D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', |
| 21221 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21222 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21223 | if (_n == 0 || p->error_indicator) { |
| 21224 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21225 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21226 | return NULL; |
| 21227 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21228 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21229 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21230 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21231 | p->error_indicator = 1; |
| 21232 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21233 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21234 | return NULL; |
| 21235 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21236 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21237 | PyMem_Free(_children); |
| 21238 | _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21239 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21240 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21241 | } |
| 21242 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21243 | // _tmp_100: star_named_expression ',' star_named_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21244 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21245 | _tmp_100_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21246 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21247 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21248 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21249 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21250 | return NULL; |
| 21251 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21252 | void * _res = NULL; |
| 21253 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21254 | { // star_named_expression ',' star_named_expressions? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21255 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21256 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21257 | return NULL; |
| 21258 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21259 | D(fprintf(stderr, "%*c> _tmp_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21260 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21261 | expr_ty y; |
| 21262 | void *z; |
| 21263 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21264 | (y = star_named_expression_rule(p)) // star_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21265 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21266 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21267 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21268 | (z = star_named_expressions_rule(p), 1) // star_named_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21269 | ) |
| 21270 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21271 | D(fprintf(stderr, "%*c+ _tmp_100[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21272 | _res = _PyPegen_seq_insert_in_front ( p , y , z ); |
| 21273 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21274 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21275 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21276 | return NULL; |
| 21277 | } |
| 21278 | goto done; |
| 21279 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21280 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21281 | D(fprintf(stderr, "%*c%s _tmp_100[%d-%d]: %s failed!\n", p->level, ' ', |
| 21282 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21283 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21284 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21285 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21286 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21287 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21288 | } |
| 21289 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21290 | // _tmp_101: yield_expr | named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21291 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21292 | _tmp_101_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21293 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21294 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21295 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21296 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21297 | return NULL; |
| 21298 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21299 | void * _res = NULL; |
| 21300 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21301 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21302 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21303 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21304 | return NULL; |
| 21305 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21306 | D(fprintf(stderr, "%*c> _tmp_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21307 | expr_ty yield_expr_var; |
| 21308 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21309 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21310 | ) |
| 21311 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21312 | D(fprintf(stderr, "%*c+ _tmp_101[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21313 | _res = yield_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21314 | goto done; |
| 21315 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21316 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21317 | D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ', |
| 21318 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21319 | } |
| 21320 | { // named_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21321 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21322 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21323 | return NULL; |
| 21324 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21325 | D(fprintf(stderr, "%*c> _tmp_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21326 | expr_ty named_expression_var; |
| 21327 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21328 | (named_expression_var = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21329 | ) |
| 21330 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21331 | D(fprintf(stderr, "%*c+ _tmp_101[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21332 | _res = named_expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21333 | goto done; |
| 21334 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21335 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21336 | D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ', |
| 21337 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21338 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21339 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21340 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21341 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21342 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21343 | } |
| 21344 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21345 | // _loop0_103: ',' double_starred_kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21346 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21347 | _loop0_103_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21348 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21349 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21350 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21351 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21352 | return NULL; |
| 21353 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21354 | void *_res = NULL; |
| 21355 | int _mark = p->mark; |
| 21356 | int _start_mark = p->mark; |
| 21357 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21358 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21359 | p->error_indicator = 1; |
| 21360 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21361 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21362 | return NULL; |
| 21363 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21364 | ssize_t _children_capacity = 1; |
| 21365 | ssize_t _n = 0; |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21366 | { // ',' double_starred_kvpair |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21367 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21368 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21369 | return NULL; |
| 21370 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21371 | D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21372 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21373 | KeyValuePair* elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21374 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21375 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21376 | && |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21377 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21378 | ) |
| 21379 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21380 | _res = elem; |
| 21381 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21382 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21383 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21384 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21385 | return NULL; |
| 21386 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21387 | if (_n == _children_capacity) { |
| 21388 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21389 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21390 | if (!_new_children) { |
| 21391 | p->error_indicator = 1; |
| 21392 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21393 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21394 | return NULL; |
| 21395 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21396 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21397 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21398 | _children[_n++] = _res; |
| 21399 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21400 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21401 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21402 | D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', |
| 21403 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21404 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21405 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21406 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21407 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21408 | p->error_indicator = 1; |
| 21409 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21410 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21411 | return NULL; |
| 21412 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21413 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21414 | PyMem_Free(_children); |
| 21415 | _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21416 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21417 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21418 | } |
| 21419 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21420 | // _gather_102: double_starred_kvpair _loop0_103 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21421 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21422 | _gather_102_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21423 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21424 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21425 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21426 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21427 | return NULL; |
| 21428 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21429 | asdl_seq * _res = NULL; |
| 21430 | int _mark = p->mark; |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21431 | { // double_starred_kvpair _loop0_103 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21432 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21433 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21434 | return NULL; |
| 21435 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21436 | D(fprintf(stderr, "%*c> _gather_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_103")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21437 | KeyValuePair* elem; |
| 21438 | asdl_seq * seq; |
| 21439 | if ( |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21440 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21441 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21442 | (seq = _loop0_103_rule(p)) // _loop0_103 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21443 | ) |
| 21444 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21445 | D(fprintf(stderr, "%*c+ _gather_102[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_103")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21446 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21447 | goto done; |
| 21448 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21449 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21450 | D(fprintf(stderr, "%*c%s _gather_102[%d-%d]: %s failed!\n", p->level, ' ', |
| 21451 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_103")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21452 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21453 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21454 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21455 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21456 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21457 | } |
| 21458 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21459 | // _loop1_104: for_if_clause |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21460 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21461 | _loop1_104_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21462 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21463 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21464 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21465 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21466 | return NULL; |
| 21467 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21468 | void *_res = NULL; |
| 21469 | int _mark = p->mark; |
| 21470 | int _start_mark = p->mark; |
| 21471 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21472 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21473 | p->error_indicator = 1; |
| 21474 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21475 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21476 | return NULL; |
| 21477 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21478 | ssize_t _children_capacity = 1; |
| 21479 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21480 | { // for_if_clause |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21481 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21482 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21483 | return NULL; |
| 21484 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21485 | D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21486 | comprehension_ty for_if_clause_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21487 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21488 | (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21489 | ) |
| 21490 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21491 | _res = for_if_clause_var; |
| 21492 | if (_n == _children_capacity) { |
| 21493 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21494 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21495 | if (!_new_children) { |
| 21496 | p->error_indicator = 1; |
| 21497 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21498 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21499 | return NULL; |
| 21500 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21501 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21502 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21503 | _children[_n++] = _res; |
| 21504 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21505 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21506 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21507 | D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', |
| 21508 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21509 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21510 | if (_n == 0 || p->error_indicator) { |
| 21511 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21512 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21513 | return NULL; |
| 21514 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21515 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21516 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21517 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21518 | p->error_indicator = 1; |
| 21519 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21520 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21521 | return NULL; |
| 21522 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21523 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21524 | PyMem_Free(_children); |
| 21525 | _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21526 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21527 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21528 | } |
| 21529 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21530 | // _loop0_105: ('if' disjunction) |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21531 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21532 | _loop0_105_rule(Parser *p) |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21533 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21534 | D(p->level++); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21535 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21536 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21537 | return NULL; |
| 21538 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21539 | void *_res = NULL; |
| 21540 | int _mark = p->mark; |
| 21541 | int _start_mark = p->mark; |
| 21542 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21543 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21544 | p->error_indicator = 1; |
| 21545 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21546 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21547 | return NULL; |
| 21548 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21549 | ssize_t _children_capacity = 1; |
| 21550 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21551 | { // ('if' disjunction) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21552 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21553 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21554 | return NULL; |
| 21555 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21556 | D(fprintf(stderr, "%*c> _loop0_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 21557 | void *_tmp_143_var; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21558 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 21559 | (_tmp_143_var = _tmp_143_rule(p)) // 'if' disjunction |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21560 | ) |
| 21561 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 21562 | _res = _tmp_143_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21563 | if (_n == _children_capacity) { |
| 21564 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21565 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21566 | if (!_new_children) { |
| 21567 | p->error_indicator = 1; |
| 21568 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21569 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21570 | return NULL; |
| 21571 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21572 | _children = _new_children; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21573 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21574 | _children[_n++] = _res; |
| 21575 | _mark = p->mark; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21576 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21577 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21578 | D(fprintf(stderr, "%*c%s _loop0_105[%d-%d]: %s failed!\n", p->level, ' ', |
| 21579 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21580 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21581 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21582 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21583 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21584 | p->error_indicator = 1; |
| 21585 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21586 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21587 | return NULL; |
| 21588 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21589 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21590 | PyMem_Free(_children); |
| 21591 | _PyPegen_insert_memo(p, _start_mark, _loop0_105_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21592 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21593 | return _seq; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21594 | } |
| 21595 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21596 | // _loop0_106: ('if' disjunction) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21597 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21598 | _loop0_106_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21599 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21600 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21601 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21602 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21603 | return NULL; |
| 21604 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21605 | void *_res = NULL; |
| 21606 | int _mark = p->mark; |
| 21607 | int _start_mark = p->mark; |
| 21608 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21609 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21610 | p->error_indicator = 1; |
| 21611 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21612 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21613 | return NULL; |
| 21614 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21615 | ssize_t _children_capacity = 1; |
| 21616 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21617 | { // ('if' disjunction) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21618 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21619 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21620 | return NULL; |
| 21621 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21622 | D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 21623 | void *_tmp_144_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21624 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 21625 | (_tmp_144_var = _tmp_144_rule(p)) // 'if' disjunction |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21626 | ) |
| 21627 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 21628 | _res = _tmp_144_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21629 | if (_n == _children_capacity) { |
| 21630 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21631 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21632 | if (!_new_children) { |
| 21633 | p->error_indicator = 1; |
| 21634 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21635 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21636 | return NULL; |
| 21637 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21638 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21639 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21640 | _children[_n++] = _res; |
| 21641 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21642 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21643 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21644 | D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', |
| 21645 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21646 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21647 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21648 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21649 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21650 | p->error_indicator = 1; |
| 21651 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21652 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21653 | return NULL; |
| 21654 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21655 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21656 | PyMem_Free(_children); |
| 21657 | _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21658 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21659 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21660 | } |
| 21661 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21662 | // _tmp_107: ',' args |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21663 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21664 | _tmp_107_rule(Parser *p) |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21665 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21666 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21667 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21668 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21669 | return NULL; |
| 21670 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21671 | void * _res = NULL; |
| 21672 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21673 | { // ',' args |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21674 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21675 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21676 | return NULL; |
| 21677 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21678 | D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21679 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21680 | expr_ty c; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21681 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21682 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21683 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21684 | (c = args_rule(p)) // args |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21685 | ) |
| 21686 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21687 | D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21688 | _res = c; |
| 21689 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21690 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21691 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21692 | return NULL; |
| 21693 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21694 | goto done; |
| 21695 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21696 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21697 | D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ', |
| 21698 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21700 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21701 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21702 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21703 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21704 | } |
| 21705 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21706 | // _tmp_108: ',' args |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21707 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21708 | _tmp_108_rule(Parser *p) |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21709 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21710 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21711 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21712 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21713 | return NULL; |
| 21714 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21715 | void * _res = NULL; |
| 21716 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21717 | { // ',' args |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21718 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21719 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21720 | return NULL; |
| 21721 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21722 | D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21723 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21724 | expr_ty c; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21725 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21726 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21727 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21728 | (c = args_rule(p)) // args |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21729 | ) |
| 21730 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21731 | D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21732 | _res = c; |
| 21733 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21734 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21735 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21736 | return NULL; |
| 21737 | } |
| 21738 | goto done; |
| 21739 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21740 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21741 | D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ', |
| 21742 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21743 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21744 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21745 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21746 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21747 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21748 | } |
| 21749 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21750 | // _loop0_110: ',' kwarg_or_starred |
| 21751 | static asdl_seq * |
| 21752 | _loop0_110_rule(Parser *p) |
| 21753 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21754 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21755 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21756 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21757 | return NULL; |
| 21758 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21759 | void *_res = NULL; |
| 21760 | int _mark = p->mark; |
| 21761 | int _start_mark = p->mark; |
| 21762 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21763 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21764 | p->error_indicator = 1; |
| 21765 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21766 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21767 | return NULL; |
| 21768 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21769 | ssize_t _children_capacity = 1; |
| 21770 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21771 | { // ',' kwarg_or_starred |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21772 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21773 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21774 | return NULL; |
| 21775 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21776 | D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21777 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21778 | KeywordOrStarred* elem; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21779 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21780 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21781 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21782 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21783 | ) |
| 21784 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21785 | _res = elem; |
| 21786 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21787 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21788 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21789 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21790 | return NULL; |
| 21791 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21792 | if (_n == _children_capacity) { |
| 21793 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21794 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21795 | if (!_new_children) { |
| 21796 | p->error_indicator = 1; |
| 21797 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21798 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21799 | return NULL; |
| 21800 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21801 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21802 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21803 | _children[_n++] = _res; |
| 21804 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21805 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21806 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21807 | D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', |
| 21808 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21809 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21810 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21811 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21812 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21813 | p->error_indicator = 1; |
| 21814 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21815 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21816 | return NULL; |
| 21817 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21818 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21819 | PyMem_Free(_children); |
| 21820 | _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21821 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21822 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21823 | } |
| 21824 | |
| 21825 | // _gather_109: kwarg_or_starred _loop0_110 |
| 21826 | static asdl_seq * |
| 21827 | _gather_109_rule(Parser *p) |
| 21828 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21829 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21830 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21831 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21832 | return NULL; |
| 21833 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21834 | asdl_seq * _res = NULL; |
| 21835 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21836 | { // kwarg_or_starred _loop0_110 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21837 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21838 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21839 | return NULL; |
| 21840 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21841 | D(fprintf(stderr, "%*c> _gather_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_110")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21842 | KeywordOrStarred* elem; |
| 21843 | asdl_seq * seq; |
| 21844 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21845 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21846 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21847 | (seq = _loop0_110_rule(p)) // _loop0_110 |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21848 | ) |
| 21849 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21850 | D(fprintf(stderr, "%*c+ _gather_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_110")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21851 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21852 | goto done; |
| 21853 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21854 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21855 | D(fprintf(stderr, "%*c%s _gather_109[%d-%d]: %s failed!\n", p->level, ' ', |
| 21856 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_110")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21857 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21858 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21859 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21860 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21861 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21862 | } |
| 21863 | |
| 21864 | // _loop0_112: ',' kwarg_or_double_starred |
| 21865 | static asdl_seq * |
| 21866 | _loop0_112_rule(Parser *p) |
| 21867 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21868 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21869 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21870 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21871 | return NULL; |
| 21872 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21873 | void *_res = NULL; |
| 21874 | int _mark = p->mark; |
| 21875 | int _start_mark = p->mark; |
| 21876 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21877 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21878 | p->error_indicator = 1; |
| 21879 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21880 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21881 | return NULL; |
| 21882 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21883 | ssize_t _children_capacity = 1; |
| 21884 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21885 | { // ',' kwarg_or_double_starred |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21886 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21887 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21888 | return NULL; |
| 21889 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21890 | D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21891 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21892 | KeywordOrStarred* elem; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21893 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21894 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21895 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21896 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21897 | ) |
| 21898 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21899 | _res = elem; |
| 21900 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21901 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21902 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21903 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21904 | return NULL; |
| 21905 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21906 | if (_n == _children_capacity) { |
| 21907 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21908 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21909 | if (!_new_children) { |
| 21910 | p->error_indicator = 1; |
| 21911 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21912 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21913 | return NULL; |
| 21914 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21915 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21916 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21917 | _children[_n++] = _res; |
| 21918 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21919 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21920 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21921 | D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', |
| 21922 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21923 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21924 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21925 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21926 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21927 | p->error_indicator = 1; |
| 21928 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21929 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21930 | return NULL; |
| 21931 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21932 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21933 | PyMem_Free(_children); |
| 21934 | _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21935 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21936 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21937 | } |
| 21938 | |
| 21939 | // _gather_111: kwarg_or_double_starred _loop0_112 |
| 21940 | static asdl_seq * |
| 21941 | _gather_111_rule(Parser *p) |
| 21942 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21943 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21944 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21945 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21946 | return NULL; |
| 21947 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21948 | asdl_seq * _res = NULL; |
| 21949 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21950 | { // kwarg_or_double_starred _loop0_112 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21951 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21952 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21953 | return NULL; |
| 21954 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21955 | D(fprintf(stderr, "%*c> _gather_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_112")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21956 | KeywordOrStarred* elem; |
| 21957 | asdl_seq * seq; |
| 21958 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21959 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21960 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21961 | (seq = _loop0_112_rule(p)) // _loop0_112 |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21962 | ) |
| 21963 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21964 | D(fprintf(stderr, "%*c+ _gather_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_112")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21965 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21966 | goto done; |
| 21967 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21968 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21969 | D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ', |
| 21970 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_112")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21971 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21972 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21973 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21974 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21975 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21976 | } |
| 21977 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21978 | // _loop0_114: ',' kwarg_or_starred |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21979 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21980 | _loop0_114_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21981 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21982 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21983 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21984 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21985 | return NULL; |
| 21986 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21987 | void *_res = NULL; |
| 21988 | int _mark = p->mark; |
| 21989 | int _start_mark = p->mark; |
| 21990 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21991 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21992 | p->error_indicator = 1; |
| 21993 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21994 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21995 | return NULL; |
| 21996 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21997 | ssize_t _children_capacity = 1; |
| 21998 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21999 | { // ',' kwarg_or_starred |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22000 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22001 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22002 | return NULL; |
| 22003 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22004 | D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22005 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22006 | KeywordOrStarred* elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22007 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22008 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22009 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22010 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22011 | ) |
| 22012 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22013 | _res = elem; |
| 22014 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22015 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22016 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22017 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22018 | return NULL; |
| 22019 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22020 | if (_n == _children_capacity) { |
| 22021 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22022 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22023 | if (!_new_children) { |
| 22024 | p->error_indicator = 1; |
| 22025 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22026 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22027 | return NULL; |
| 22028 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22029 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22030 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22031 | _children[_n++] = _res; |
| 22032 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22033 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22034 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22035 | D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ', |
| 22036 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22037 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22038 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22039 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22040 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22041 | p->error_indicator = 1; |
| 22042 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22043 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22044 | return NULL; |
| 22045 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22046 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22047 | PyMem_Free(_children); |
| 22048 | _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22049 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22050 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22051 | } |
| 22052 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22053 | // _gather_113: kwarg_or_starred _loop0_114 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22054 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22055 | _gather_113_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22056 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22057 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22058 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22059 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22060 | return NULL; |
| 22061 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22062 | asdl_seq * _res = NULL; |
| 22063 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22064 | { // kwarg_or_starred _loop0_114 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22065 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22066 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22067 | return NULL; |
| 22068 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22069 | D(fprintf(stderr, "%*c> _gather_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_114")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22070 | KeywordOrStarred* elem; |
| 22071 | asdl_seq * seq; |
| 22072 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22073 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22074 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22075 | (seq = _loop0_114_rule(p)) // _loop0_114 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22076 | ) |
| 22077 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22078 | D(fprintf(stderr, "%*c+ _gather_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_114")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22079 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22080 | goto done; |
| 22081 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22082 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22083 | D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ', |
| 22084 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_114")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22085 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22086 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22087 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22088 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22089 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22090 | } |
| 22091 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22092 | // _loop0_116: ',' kwarg_or_double_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22093 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22094 | _loop0_116_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22095 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22096 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22097 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22098 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22099 | return NULL; |
| 22100 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22101 | void *_res = NULL; |
| 22102 | int _mark = p->mark; |
| 22103 | int _start_mark = p->mark; |
| 22104 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22105 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22106 | p->error_indicator = 1; |
| 22107 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22108 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22109 | return NULL; |
| 22110 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22111 | ssize_t _children_capacity = 1; |
| 22112 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22113 | { // ',' kwarg_or_double_starred |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22114 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22115 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22116 | return NULL; |
| 22117 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22118 | D(fprintf(stderr, "%*c> _loop0_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22119 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22120 | KeywordOrStarred* elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22121 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22122 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22123 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22124 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22125 | ) |
| 22126 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22127 | _res = elem; |
| 22128 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22129 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22130 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22131 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22132 | return NULL; |
| 22133 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22134 | if (_n == _children_capacity) { |
| 22135 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22136 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22137 | if (!_new_children) { |
| 22138 | p->error_indicator = 1; |
| 22139 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22140 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22141 | return NULL; |
| 22142 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22143 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22144 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22145 | _children[_n++] = _res; |
| 22146 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22147 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22148 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22149 | D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ', |
| 22150 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22151 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22152 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22153 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22154 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22155 | p->error_indicator = 1; |
| 22156 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22157 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22158 | return NULL; |
| 22159 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22160 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22161 | PyMem_Free(_children); |
| 22162 | _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22163 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22164 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22165 | } |
| 22166 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22167 | // _gather_115: kwarg_or_double_starred _loop0_116 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22168 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22169 | _gather_115_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22170 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22171 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22172 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22173 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22174 | return NULL; |
| 22175 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22176 | asdl_seq * _res = NULL; |
| 22177 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22178 | { // kwarg_or_double_starred _loop0_116 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22179 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22180 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22181 | return NULL; |
| 22182 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22183 | D(fprintf(stderr, "%*c> _gather_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_116")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22184 | KeywordOrStarred* elem; |
| 22185 | asdl_seq * seq; |
| 22186 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22187 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22188 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22189 | (seq = _loop0_116_rule(p)) // _loop0_116 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22190 | ) |
| 22191 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22192 | D(fprintf(stderr, "%*c+ _gather_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_116")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22193 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22194 | goto done; |
| 22195 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22196 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22197 | D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ', |
| 22198 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_116")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22199 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22200 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22201 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22202 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22203 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22204 | } |
| 22205 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22206 | // _loop0_117: (',' star_target) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22207 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22208 | _loop0_117_rule(Parser *p) |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22209 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22210 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22211 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22212 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22213 | return NULL; |
| 22214 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22215 | void *_res = NULL; |
| 22216 | int _mark = p->mark; |
| 22217 | int _start_mark = p->mark; |
| 22218 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22219 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22220 | p->error_indicator = 1; |
| 22221 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22222 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22223 | return NULL; |
| 22224 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22225 | ssize_t _children_capacity = 1; |
| 22226 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22227 | { // (',' star_target) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22228 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22229 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22230 | return NULL; |
| 22231 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22232 | D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22233 | void *_tmp_145_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22234 | while ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22235 | (_tmp_145_var = _tmp_145_rule(p)) // ',' star_target |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22236 | ) |
| 22237 | { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22238 | _res = _tmp_145_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22239 | if (_n == _children_capacity) { |
| 22240 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22241 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22242 | if (!_new_children) { |
| 22243 | p->error_indicator = 1; |
| 22244 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22245 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22246 | return NULL; |
| 22247 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22248 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22249 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22250 | _children[_n++] = _res; |
| 22251 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22252 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22253 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22254 | D(fprintf(stderr, "%*c%s _loop0_117[%d-%d]: %s failed!\n", p->level, ' ', |
| 22255 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22256 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22257 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22258 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22259 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22260 | p->error_indicator = 1; |
| 22261 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22262 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22263 | return NULL; |
| 22264 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22265 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22266 | PyMem_Free(_children); |
| 22267 | _PyPegen_insert_memo(p, _start_mark, _loop0_117_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22268 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22269 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22270 | } |
| 22271 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22272 | // _loop0_119: ',' star_target |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22273 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22274 | _loop0_119_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22275 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22276 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22277 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22278 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22279 | return NULL; |
| 22280 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22281 | void *_res = NULL; |
| 22282 | int _mark = p->mark; |
| 22283 | int _start_mark = p->mark; |
| 22284 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22285 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22286 | p->error_indicator = 1; |
| 22287 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22288 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22289 | return NULL; |
| 22290 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22291 | ssize_t _children_capacity = 1; |
| 22292 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22293 | { // ',' star_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22294 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22295 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22296 | return NULL; |
| 22297 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22298 | D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22299 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22300 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22301 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22302 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22303 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22304 | (elem = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22305 | ) |
| 22306 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22307 | _res = elem; |
| 22308 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22309 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22310 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22311 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22312 | return NULL; |
| 22313 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22314 | if (_n == _children_capacity) { |
| 22315 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22316 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22317 | if (!_new_children) { |
| 22318 | p->error_indicator = 1; |
| 22319 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22320 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22321 | return NULL; |
| 22322 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22323 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22324 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22325 | _children[_n++] = _res; |
| 22326 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22327 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22328 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22329 | D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', |
| 22330 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22331 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22332 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22333 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22334 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22335 | p->error_indicator = 1; |
| 22336 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22337 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22338 | return NULL; |
| 22339 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22340 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22341 | PyMem_Free(_children); |
| 22342 | _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22343 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22344 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22345 | } |
| 22346 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22347 | // _gather_118: star_target _loop0_119 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22348 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22349 | _gather_118_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22350 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22351 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22352 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22353 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22354 | return NULL; |
| 22355 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22356 | asdl_seq * _res = NULL; |
| 22357 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22358 | { // star_target _loop0_119 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22359 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22360 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22361 | return NULL; |
| 22362 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22363 | D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_119")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22364 | expr_ty elem; |
| 22365 | asdl_seq * seq; |
| 22366 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22367 | (elem = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22368 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22369 | (seq = _loop0_119_rule(p)) // _loop0_119 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22370 | ) |
| 22371 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22372 | D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_119")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22373 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22374 | goto done; |
| 22375 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22376 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22377 | D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', |
| 22378 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_119")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22379 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22380 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22381 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22382 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22383 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22384 | } |
| 22385 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22386 | // _tmp_120: !'*' star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22387 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22388 | _tmp_120_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22389 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22390 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22391 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22392 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22393 | return NULL; |
| 22394 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22395 | void * _res = NULL; |
| 22396 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22397 | { // !'*' star_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22398 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22399 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22400 | return NULL; |
| 22401 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22402 | D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22403 | expr_ty star_target_var; |
| 22404 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22405 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22406 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22407 | (star_target_var = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22408 | ) |
| 22409 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22410 | D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22411 | _res = star_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22412 | goto done; |
| 22413 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22414 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22415 | D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', |
| 22416 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22417 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22418 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22419 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22420 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22421 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22422 | } |
| 22423 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22424 | // _loop0_122: ',' del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22425 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22426 | _loop0_122_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22427 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22428 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22429 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22430 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22431 | return NULL; |
| 22432 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22433 | void *_res = NULL; |
| 22434 | int _mark = p->mark; |
| 22435 | int _start_mark = p->mark; |
| 22436 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22437 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22438 | p->error_indicator = 1; |
| 22439 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22440 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22441 | return NULL; |
| 22442 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22443 | ssize_t _children_capacity = 1; |
| 22444 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22445 | { // ',' del_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22446 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22447 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22448 | return NULL; |
| 22449 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22450 | D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22451 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22452 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22453 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22454 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22455 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22456 | (elem = del_target_rule(p)) // del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22457 | ) |
| 22458 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22459 | _res = elem; |
| 22460 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22461 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22462 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22463 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22464 | return NULL; |
| 22465 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22466 | if (_n == _children_capacity) { |
| 22467 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22468 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22469 | if (!_new_children) { |
| 22470 | p->error_indicator = 1; |
| 22471 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22472 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22473 | return NULL; |
| 22474 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22475 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22476 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22477 | _children[_n++] = _res; |
| 22478 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22479 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22480 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22481 | D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', |
| 22482 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22483 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22484 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22485 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22486 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22487 | p->error_indicator = 1; |
| 22488 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22489 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22490 | return NULL; |
| 22491 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22492 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22493 | PyMem_Free(_children); |
| 22494 | _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22495 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22496 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22497 | } |
| 22498 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22499 | // _gather_121: del_target _loop0_122 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22500 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22501 | _gather_121_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22502 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22503 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22504 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22505 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22506 | return NULL; |
| 22507 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22508 | asdl_seq * _res = NULL; |
| 22509 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22510 | { // del_target _loop0_122 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22511 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22512 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22513 | return NULL; |
| 22514 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22515 | D(fprintf(stderr, "%*c> _gather_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_122")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22516 | expr_ty elem; |
| 22517 | asdl_seq * seq; |
| 22518 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22519 | (elem = del_target_rule(p)) // del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22520 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22521 | (seq = _loop0_122_rule(p)) // _loop0_122 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22522 | ) |
| 22523 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22524 | D(fprintf(stderr, "%*c+ _gather_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_122")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22525 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22526 | goto done; |
| 22527 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22528 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22529 | D(fprintf(stderr, "%*c%s _gather_121[%d-%d]: %s failed!\n", p->level, ' ', |
| 22530 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_122")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22531 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22532 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22533 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22534 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22535 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22536 | } |
| 22537 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22538 | // _loop0_124: ',' target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22539 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22540 | _loop0_124_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22541 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22542 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22543 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22544 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22545 | return NULL; |
| 22546 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22547 | void *_res = NULL; |
| 22548 | int _mark = p->mark; |
| 22549 | int _start_mark = p->mark; |
| 22550 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22551 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22552 | p->error_indicator = 1; |
| 22553 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22554 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22555 | return NULL; |
| 22556 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22557 | ssize_t _children_capacity = 1; |
| 22558 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22559 | { // ',' target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22560 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22561 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22562 | return NULL; |
| 22563 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22564 | D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22565 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22566 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22567 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22568 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22569 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22570 | (elem = target_rule(p)) // target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22571 | ) |
| 22572 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22573 | _res = elem; |
| 22574 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22575 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22576 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22577 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22578 | return NULL; |
| 22579 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22580 | if (_n == _children_capacity) { |
| 22581 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22582 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22583 | if (!_new_children) { |
| 22584 | p->error_indicator = 1; |
| 22585 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22586 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22587 | return NULL; |
| 22588 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22589 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22590 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22591 | _children[_n++] = _res; |
| 22592 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22593 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22594 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22595 | D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ', |
| 22596 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22597 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22598 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22599 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22600 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22601 | p->error_indicator = 1; |
| 22602 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22603 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22604 | return NULL; |
| 22605 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22606 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22607 | PyMem_Free(_children); |
| 22608 | _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22609 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22610 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22611 | } |
| 22612 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22613 | // _gather_123: target _loop0_124 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22614 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22615 | _gather_123_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22616 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22617 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22618 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22619 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22620 | return NULL; |
| 22621 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22622 | asdl_seq * _res = NULL; |
| 22623 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22624 | { // target _loop0_124 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22625 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22626 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22627 | return NULL; |
| 22628 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22629 | D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_124")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22630 | expr_ty elem; |
| 22631 | asdl_seq * seq; |
| 22632 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22633 | (elem = target_rule(p)) // target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22634 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22635 | (seq = _loop0_124_rule(p)) // _loop0_124 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22636 | ) |
| 22637 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22638 | D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_124")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22639 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22640 | goto done; |
| 22641 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22642 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22643 | D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ', |
| 22644 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_124")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22645 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22646 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22647 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22648 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22649 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22650 | } |
| 22651 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22652 | // _tmp_125: args | expression for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22653 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22654 | _tmp_125_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22655 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22656 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22657 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22658 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22659 | return NULL; |
| 22660 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22661 | void * _res = NULL; |
| 22662 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22663 | { // args |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22664 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22665 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22666 | return NULL; |
| 22667 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22668 | D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22669 | expr_ty args_var; |
| 22670 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22671 | (args_var = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22672 | ) |
| 22673 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22674 | D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22675 | _res = args_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22676 | goto done; |
| 22677 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22678 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22679 | D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', |
| 22680 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22681 | } |
| 22682 | { // expression for_if_clauses |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22683 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22684 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22685 | return NULL; |
| 22686 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22687 | D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22688 | expr_ty expression_var; |
| 22689 | asdl_seq* for_if_clauses_var; |
| 22690 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22691 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22692 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22693 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22694 | ) |
| 22695 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22696 | D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22697 | _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22698 | goto done; |
| 22699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22700 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22701 | D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', |
| 22702 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22703 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22704 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22705 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22706 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22707 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22708 | } |
| 22709 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22710 | // _loop0_126: star_named_expressions |
| 22711 | static asdl_seq * |
| 22712 | _loop0_126_rule(Parser *p) |
| 22713 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22714 | D(p->level++); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22715 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22716 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22717 | return NULL; |
| 22718 | } |
| 22719 | void *_res = NULL; |
| 22720 | int _mark = p->mark; |
| 22721 | int _start_mark = p->mark; |
| 22722 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22723 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22724 | p->error_indicator = 1; |
| 22725 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22726 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22727 | return NULL; |
| 22728 | } |
| 22729 | ssize_t _children_capacity = 1; |
| 22730 | ssize_t _n = 0; |
| 22731 | { // star_named_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22732 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22733 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22734 | return NULL; |
| 22735 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22736 | D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22737 | asdl_seq* star_named_expressions_var; |
| 22738 | while ( |
| 22739 | (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions |
| 22740 | ) |
| 22741 | { |
| 22742 | _res = star_named_expressions_var; |
| 22743 | if (_n == _children_capacity) { |
| 22744 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22745 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22746 | if (!_new_children) { |
| 22747 | p->error_indicator = 1; |
| 22748 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22749 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22750 | return NULL; |
| 22751 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22752 | _children = _new_children; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22753 | } |
| 22754 | _children[_n++] = _res; |
| 22755 | _mark = p->mark; |
| 22756 | } |
| 22757 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22758 | D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', |
| 22759 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22760 | } |
| 22761 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22762 | if (!_seq) { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22763 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22764 | p->error_indicator = 1; |
| 22765 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22766 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22767 | return NULL; |
| 22768 | } |
| 22769 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22770 | PyMem_Free(_children); |
| 22771 | _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22772 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22773 | return _seq; |
| 22774 | } |
| 22775 | |
| 22776 | // _tmp_127: '=' annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22777 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22778 | _tmp_127_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22779 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22780 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22781 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22782 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22783 | return NULL; |
| 22784 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22785 | void * _res = NULL; |
| 22786 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22787 | { // '=' annotated_rhs |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22788 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22789 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22790 | return NULL; |
| 22791 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22792 | D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22793 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22794 | expr_ty annotated_rhs_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22795 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22796 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22797 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22798 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22799 | ) |
| 22800 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22801 | D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22802 | _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22803 | goto done; |
| 22804 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22805 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22806 | D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ', |
| 22807 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22808 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22809 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22810 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22811 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22812 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22813 | } |
| 22814 | |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22815 | // _tmp_128: yield_expr | star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22816 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22817 | _tmp_128_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22818 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22819 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22820 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22821 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22822 | return NULL; |
| 22823 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22824 | void * _res = NULL; |
| 22825 | int _mark = p->mark; |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22826 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22827 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22828 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22829 | return NULL; |
| 22830 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22831 | D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22832 | expr_ty yield_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22833 | if ( |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22834 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22835 | ) |
| 22836 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22837 | D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22838 | _res = yield_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22839 | goto done; |
| 22840 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22841 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22842 | D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', |
| 22843 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22844 | } |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22845 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22846 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22847 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22848 | return NULL; |
| 22849 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22850 | D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22851 | expr_ty star_expressions_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22852 | if ( |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22853 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22854 | ) |
| 22855 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22856 | D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 22857 | _res = star_expressions_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22858 | goto done; |
| 22859 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22860 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22861 | D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', |
| 22862 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22863 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22864 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22865 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22866 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22867 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22868 | } |
| 22869 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22870 | // _tmp_129: yield_expr | star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22871 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22872 | _tmp_129_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22873 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22874 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22875 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22876 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22877 | return NULL; |
| 22878 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22879 | void * _res = NULL; |
| 22880 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22881 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22882 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22883 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22884 | return NULL; |
| 22885 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22886 | D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22887 | expr_ty yield_expr_var; |
| 22888 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22889 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22890 | ) |
| 22891 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22892 | D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22893 | _res = yield_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22894 | goto done; |
| 22895 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22896 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22897 | D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', |
| 22898 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22899 | } |
| 22900 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22901 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22902 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22903 | return NULL; |
| 22904 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22905 | D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22906 | expr_ty star_expressions_var; |
| 22907 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22908 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22909 | ) |
| 22910 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22911 | D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22912 | _res = star_expressions_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22913 | goto done; |
| 22914 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22915 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22916 | D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', |
| 22917 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22918 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22919 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22920 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22921 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22922 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22923 | } |
| 22924 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22925 | // _tmp_130: '[' | '(' | '{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22926 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22927 | _tmp_130_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22928 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22929 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22930 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22931 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22932 | return NULL; |
| 22933 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22934 | void * _res = NULL; |
| 22935 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22936 | { // '[' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22937 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22938 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22939 | return NULL; |
| 22940 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22941 | D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22942 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22943 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22944 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22945 | ) |
| 22946 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22947 | D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22948 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22949 | goto done; |
| 22950 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22951 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22952 | D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ', |
| 22953 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22954 | } |
| 22955 | { // '(' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22956 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22957 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22958 | return NULL; |
| 22959 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22960 | D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22961 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22962 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22963 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22964 | ) |
| 22965 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22966 | D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22967 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22968 | goto done; |
| 22969 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22970 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22971 | D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ', |
| 22972 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22973 | } |
| 22974 | { // '{' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22975 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22976 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22977 | return NULL; |
| 22978 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22979 | D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22980 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22981 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22982 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22983 | ) |
| 22984 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22985 | D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22986 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22987 | goto done; |
| 22988 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22989 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22990 | D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ', |
| 22991 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22992 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22993 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22994 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22995 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22996 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22997 | } |
| 22998 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22999 | // _loop0_131: param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23000 | static asdl_seq * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23001 | _loop0_131_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23002 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23003 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23004 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23005 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23006 | return NULL; |
| 23007 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23008 | void *_res = NULL; |
| 23009 | int _mark = p->mark; |
| 23010 | int _start_mark = p->mark; |
| 23011 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23012 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23013 | p->error_indicator = 1; |
| 23014 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23015 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23016 | return NULL; |
| 23017 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23018 | ssize_t _children_capacity = 1; |
| 23019 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23020 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23021 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23022 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23023 | return NULL; |
| 23024 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23025 | D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23026 | arg_ty param_no_default_var; |
| 23027 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23028 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23029 | ) |
| 23030 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23031 | _res = param_no_default_var; |
| 23032 | if (_n == _children_capacity) { |
| 23033 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23034 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23035 | if (!_new_children) { |
| 23036 | p->error_indicator = 1; |
| 23037 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23038 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23039 | return NULL; |
| 23040 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23041 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23042 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23043 | _children[_n++] = _res; |
| 23044 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23045 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23046 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23047 | D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', |
| 23048 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23049 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23050 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 23051 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23052 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23053 | p->error_indicator = 1; |
| 23054 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23055 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23056 | return NULL; |
| 23057 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23058 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 23059 | PyMem_Free(_children); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23060 | _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23061 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23062 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23063 | } |
| 23064 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23065 | // _tmp_132: slash_with_default | param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23066 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23067 | _tmp_132_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23068 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23069 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23070 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23071 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23072 | return NULL; |
| 23073 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23074 | void * _res = NULL; |
| 23075 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23076 | { // slash_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23077 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23078 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23079 | return NULL; |
| 23080 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23081 | D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23082 | SlashWithDefault* slash_with_default_var; |
| 23083 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23084 | (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23085 | ) |
| 23086 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23087 | D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23088 | _res = slash_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23089 | goto done; |
| 23090 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23091 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23092 | D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', |
| 23093 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23094 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23095 | { // param_with_default+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23096 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23097 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23098 | return NULL; |
| 23099 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23100 | D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23101 | asdl_seq * _loop1_146_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23102 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23103 | (_loop1_146_var = _loop1_146_rule(p)) // param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23104 | ) |
| 23105 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23106 | D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23107 | _res = _loop1_146_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23108 | goto done; |
| 23109 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23110 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23111 | D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', |
| 23112 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23113 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23114 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23115 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23116 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23117 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23118 | } |
| 23119 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23120 | // _tmp_133: ')' | ',' (')' | '**') |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23121 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23122 | _tmp_133_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23123 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23124 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23125 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23126 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23127 | return NULL; |
| 23128 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23129 | void * _res = NULL; |
| 23130 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23131 | { // ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23132 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23133 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23134 | return NULL; |
| 23135 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23136 | D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23137 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23138 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23139 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23140 | ) |
| 23141 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23142 | D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23143 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23144 | goto done; |
| 23145 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23146 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23147 | D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', |
| 23148 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23149 | } |
| 23150 | { // ',' (')' | '**') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23151 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23152 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23153 | return NULL; |
| 23154 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23155 | D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23156 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23157 | void *_tmp_147_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23158 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23159 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23160 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23161 | (_tmp_147_var = _tmp_147_rule(p)) // ')' | '**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23162 | ) |
| 23163 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23164 | D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23165 | _res = _PyPegen_dummy_name(p, _literal, _tmp_147_var); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23166 | goto done; |
| 23167 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23168 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23169 | D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', |
| 23170 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23171 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23172 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23173 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23174 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23175 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23176 | } |
| 23177 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23178 | // _tmp_134: ':' | ',' (':' | '**') |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23179 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23180 | _tmp_134_rule(Parser *p) |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23181 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23182 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23183 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23184 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23185 | return NULL; |
| 23186 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23187 | void * _res = NULL; |
| 23188 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23189 | { // ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23190 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23191 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23192 | return NULL; |
| 23193 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23194 | D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23195 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23196 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23197 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23198 | ) |
| 23199 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23200 | D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23201 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23202 | goto done; |
| 23203 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23204 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23205 | D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', |
| 23206 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23207 | } |
| 23208 | { // ',' (':' | '**') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23209 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23210 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23211 | return NULL; |
| 23212 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23213 | D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23214 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23215 | void *_tmp_148_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23216 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23217 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23218 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23219 | (_tmp_148_var = _tmp_148_rule(p)) // ':' | '**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23220 | ) |
| 23221 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23222 | D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23223 | _res = _PyPegen_dummy_name(p, _literal, _tmp_148_var); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23224 | goto done; |
| 23225 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23226 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23227 | D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', |
| 23228 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23229 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23230 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23231 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23232 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23233 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23234 | } |
| 23235 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23236 | // _tmp_135: star_targets '=' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23237 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23238 | _tmp_135_rule(Parser *p) |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23239 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23240 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23241 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23242 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23243 | return NULL; |
| 23244 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23245 | void * _res = NULL; |
| 23246 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23247 | { // star_targets '=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23248 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23249 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23250 | return NULL; |
| 23251 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23252 | D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23253 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23254 | expr_ty z; |
| 23255 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23256 | (z = star_targets_rule(p)) // star_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23257 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23258 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23259 | ) |
| 23260 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23261 | D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23262 | _res = z; |
| 23263 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23264 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23265 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23266 | return NULL; |
| 23267 | } |
| 23268 | goto done; |
| 23269 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23270 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23271 | D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', |
| 23272 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23273 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23274 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23275 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23276 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23277 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23278 | } |
| 23279 | |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23280 | // _tmp_136: '.' | '...' |
| 23281 | static void * |
| 23282 | _tmp_136_rule(Parser *p) |
| 23283 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23284 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23285 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23286 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23287 | return NULL; |
| 23288 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23289 | void * _res = NULL; |
| 23290 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23291 | { // '.' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23292 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23293 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23294 | return NULL; |
| 23295 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23296 | D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23297 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23298 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23299 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23300 | ) |
| 23301 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23302 | D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23303 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23304 | goto done; |
| 23305 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23306 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23307 | D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', |
| 23308 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23309 | } |
| 23310 | { // '...' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23311 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23312 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23313 | return NULL; |
| 23314 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23315 | D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23316 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23317 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23318 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23319 | ) |
| 23320 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23321 | D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23322 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23323 | goto done; |
| 23324 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23325 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23326 | D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', |
| 23327 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23328 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23329 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23330 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23331 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23332 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23333 | } |
| 23334 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23335 | // _tmp_137: '.' | '...' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23336 | static void * |
| 23337 | _tmp_137_rule(Parser *p) |
| 23338 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23339 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23340 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23341 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23342 | return NULL; |
| 23343 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23344 | void * _res = NULL; |
| 23345 | int _mark = p->mark; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23346 | { // '.' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23347 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23348 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23349 | return NULL; |
| 23350 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23351 | D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23352 | Token * _literal; |
| 23353 | if ( |
| 23354 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 23355 | ) |
| 23356 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23357 | D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23358 | _res = _literal; |
| 23359 | goto done; |
| 23360 | } |
| 23361 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23362 | D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', |
| 23363 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23364 | } |
| 23365 | { // '...' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23366 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23367 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23368 | return NULL; |
| 23369 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23370 | D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23371 | Token * _literal; |
| 23372 | if ( |
| 23373 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 23374 | ) |
| 23375 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23376 | D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23377 | _res = _literal; |
| 23378 | goto done; |
| 23379 | } |
| 23380 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23381 | D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', |
| 23382 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23383 | } |
| 23384 | _res = NULL; |
| 23385 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23386 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23387 | return _res; |
| 23388 | } |
| 23389 | |
| 23390 | // _tmp_138: '@' named_expression NEWLINE |
| 23391 | static void * |
| 23392 | _tmp_138_rule(Parser *p) |
| 23393 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23394 | D(p->level++); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23395 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23396 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23397 | return NULL; |
| 23398 | } |
| 23399 | void * _res = NULL; |
| 23400 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23401 | { // '@' named_expression NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23402 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23403 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23404 | return NULL; |
| 23405 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23406 | D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23407 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23408 | expr_ty f; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 23409 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23410 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23411 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23412 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23413 | (f = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23414 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23415 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23416 | ) |
| 23417 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23418 | D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23419 | _res = f; |
| 23420 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23421 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23422 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23423 | return NULL; |
| 23424 | } |
| 23425 | goto done; |
| 23426 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23427 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23428 | D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', |
| 23429 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23430 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23431 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23432 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23433 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23434 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23435 | } |
| 23436 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23437 | // _tmp_139: ',' star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23438 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23439 | _tmp_139_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23440 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23441 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23442 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23443 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23444 | return NULL; |
| 23445 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23446 | void * _res = NULL; |
| 23447 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23448 | { // ',' star_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23449 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23450 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23451 | return NULL; |
| 23452 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23453 | D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23454 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23455 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23456 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23457 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23458 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23459 | (c = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23460 | ) |
| 23461 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23462 | D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23463 | _res = c; |
| 23464 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23465 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23466 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23467 | return NULL; |
| 23468 | } |
| 23469 | goto done; |
| 23470 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23471 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23472 | D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ', |
| 23473 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23474 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23475 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23476 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23477 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23478 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23479 | } |
| 23480 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23481 | // _tmp_140: ',' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23482 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23483 | _tmp_140_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23484 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23485 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23486 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23487 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23488 | return NULL; |
| 23489 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23490 | void * _res = NULL; |
| 23491 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23492 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23493 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23494 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23495 | return NULL; |
| 23496 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23497 | D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23498 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23499 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23500 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23501 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23502 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23503 | (c = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23504 | ) |
| 23505 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23506 | D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23507 | _res = c; |
| 23508 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23509 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23510 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23511 | return NULL; |
| 23512 | } |
| 23513 | goto done; |
| 23514 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23515 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23516 | D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ', |
| 23517 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23518 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23519 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23520 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23521 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23522 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23523 | } |
| 23524 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23525 | // _tmp_141: 'or' conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23526 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23527 | _tmp_141_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23528 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23529 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23530 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23531 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23532 | return NULL; |
| 23533 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23534 | void * _res = NULL; |
| 23535 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23536 | { // 'or' conjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23537 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23538 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23539 | return NULL; |
| 23540 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23541 | D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23542 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23543 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23544 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23545 | (_keyword = _PyPegen_expect_token(p, 532)) // token='or' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23546 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23547 | (c = conjunction_rule(p)) // conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23548 | ) |
| 23549 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23550 | D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23551 | _res = c; |
| 23552 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23553 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23554 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23555 | return NULL; |
| 23556 | } |
| 23557 | goto done; |
| 23558 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23559 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23560 | D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', |
| 23561 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23562 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23563 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23564 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23565 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23566 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23567 | } |
| 23568 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23569 | // _tmp_142: 'and' inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23570 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23571 | _tmp_142_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23572 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23573 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23574 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23575 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23576 | return NULL; |
| 23577 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23578 | void * _res = NULL; |
| 23579 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23580 | { // 'and' inversion |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23581 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23582 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23583 | return NULL; |
| 23584 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23585 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23586 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23587 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23588 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23589 | (_keyword = _PyPegen_expect_token(p, 533)) // token='and' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23590 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23591 | (c = inversion_rule(p)) // inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23592 | ) |
| 23593 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23594 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23595 | _res = c; |
| 23596 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23597 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23598 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23599 | return NULL; |
| 23600 | } |
| 23601 | goto done; |
| 23602 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23603 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23604 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', |
| 23605 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23606 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23607 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23608 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23609 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23610 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23611 | } |
| 23612 | |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23613 | // _tmp_143: 'if' disjunction |
| 23614 | static void * |
| 23615 | _tmp_143_rule(Parser *p) |
| 23616 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23617 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23618 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23619 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23620 | return NULL; |
| 23621 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23622 | void * _res = NULL; |
| 23623 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23624 | { // 'if' disjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23625 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23626 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23627 | return NULL; |
| 23628 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23629 | D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23630 | Token * _keyword; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23631 | expr_ty z; |
| 23632 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23633 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23634 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23635 | (z = disjunction_rule(p)) // disjunction |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23636 | ) |
| 23637 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23638 | D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23639 | _res = z; |
| 23640 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23641 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23642 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23643 | return NULL; |
| 23644 | } |
| 23645 | goto done; |
| 23646 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23647 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23648 | D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', |
| 23649 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23650 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23651 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23652 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23653 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23654 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23655 | } |
| 23656 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23657 | // _tmp_144: 'if' disjunction |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23658 | static void * |
| 23659 | _tmp_144_rule(Parser *p) |
| 23660 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23661 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23662 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23663 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23664 | return NULL; |
| 23665 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23666 | void * _res = NULL; |
| 23667 | int _mark = p->mark; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23668 | { // 'if' disjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23669 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23670 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23671 | return NULL; |
| 23672 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23673 | D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23674 | Token * _keyword; |
| 23675 | expr_ty z; |
| 23676 | if ( |
| 23677 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 23678 | && |
| 23679 | (z = disjunction_rule(p)) // disjunction |
| 23680 | ) |
| 23681 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23682 | D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23683 | _res = z; |
| 23684 | if (_res == NULL && PyErr_Occurred()) { |
| 23685 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23686 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23687 | return NULL; |
| 23688 | } |
| 23689 | goto done; |
| 23690 | } |
| 23691 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23692 | D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', |
| 23693 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23694 | } |
| 23695 | _res = NULL; |
| 23696 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23697 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23698 | return _res; |
| 23699 | } |
| 23700 | |
| 23701 | // _tmp_145: ',' star_target |
| 23702 | static void * |
| 23703 | _tmp_145_rule(Parser *p) |
| 23704 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23705 | D(p->level++); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23706 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23707 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23708 | return NULL; |
| 23709 | } |
| 23710 | void * _res = NULL; |
| 23711 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23712 | { // ',' star_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23713 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23714 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23715 | return NULL; |
| 23716 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23717 | D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23718 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23719 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23720 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23721 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23722 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23723 | (c = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23724 | ) |
| 23725 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23726 | D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23727 | _res = c; |
| 23728 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23729 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23730 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23731 | return NULL; |
| 23732 | } |
| 23733 | goto done; |
| 23734 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23735 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23736 | D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', |
| 23737 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23738 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23739 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23740 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23741 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23742 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23743 | } |
| 23744 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23745 | // _loop1_146: param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23746 | static asdl_seq * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23747 | _loop1_146_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23748 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23749 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23750 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23751 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23752 | return NULL; |
| 23753 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23754 | void *_res = NULL; |
| 23755 | int _mark = p->mark; |
| 23756 | int _start_mark = p->mark; |
| 23757 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23758 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23759 | p->error_indicator = 1; |
| 23760 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23761 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23762 | return NULL; |
| 23763 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23764 | ssize_t _children_capacity = 1; |
| 23765 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23766 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23767 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23768 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23769 | return NULL; |
| 23770 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23771 | D(fprintf(stderr, "%*c> _loop1_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23772 | NameDefaultPair* param_with_default_var; |
| 23773 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23774 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23775 | ) |
| 23776 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23777 | _res = param_with_default_var; |
| 23778 | if (_n == _children_capacity) { |
| 23779 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23780 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23781 | if (!_new_children) { |
| 23782 | p->error_indicator = 1; |
| 23783 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23784 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23785 | return NULL; |
| 23786 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23787 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23788 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23789 | _children[_n++] = _res; |
| 23790 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23791 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23792 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23793 | D(fprintf(stderr, "%*c%s _loop1_146[%d-%d]: %s failed!\n", p->level, ' ', |
| 23794 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23795 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23796 | if (_n == 0 || p->error_indicator) { |
| 23797 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23798 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23799 | return NULL; |
| 23800 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23801 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 23802 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23803 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23804 | p->error_indicator = 1; |
| 23805 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23806 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23807 | return NULL; |
| 23808 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23809 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 23810 | PyMem_Free(_children); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23811 | _PyPegen_insert_memo(p, _start_mark, _loop1_146_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23812 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23813 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23814 | } |
| 23815 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23816 | // _tmp_147: ')' | '**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23817 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23818 | _tmp_147_rule(Parser *p) |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23819 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23820 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23821 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23822 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23823 | return NULL; |
| 23824 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23825 | void * _res = NULL; |
| 23826 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23827 | { // ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23828 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23829 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23830 | return NULL; |
| 23831 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23832 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23833 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23834 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23835 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23836 | ) |
| 23837 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23838 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23839 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23840 | goto done; |
| 23841 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23842 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23843 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 23844 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23845 | } |
| 23846 | { // '**' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23847 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23848 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23849 | return NULL; |
| 23850 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23851 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23852 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23853 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23854 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23855 | ) |
| 23856 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23857 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23858 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23859 | goto done; |
| 23860 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23861 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23862 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 23863 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23864 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23865 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23866 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23867 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23868 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23869 | } |
| 23870 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23871 | // _tmp_148: ':' | '**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23872 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23873 | _tmp_148_rule(Parser *p) |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23874 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23875 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23876 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23877 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23878 | return NULL; |
| 23879 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23880 | void * _res = NULL; |
| 23881 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23882 | { // ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23883 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23884 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23885 | return NULL; |
| 23886 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23887 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23888 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23889 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23890 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23891 | ) |
| 23892 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23893 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23894 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23895 | goto done; |
| 23896 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23897 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23898 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', |
| 23899 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23900 | } |
| 23901 | { // '**' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23902 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23903 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23904 | return NULL; |
| 23905 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23906 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23907 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23908 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23909 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23910 | ) |
| 23911 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23912 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23913 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23914 | goto done; |
| 23915 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23916 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23917 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', |
| 23918 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23919 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23920 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23921 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23922 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23923 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23924 | } |
| 23925 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23926 | void * |
| 23927 | _PyPegen_parse(Parser *p) |
| 23928 | { |
| 23929 | // Initialize keywords |
| 23930 | p->keywords = reserved_keywords; |
| 23931 | p->n_keyword_lists = n_keyword_lists; |
| 23932 | |
| 23933 | // Run parser |
| 23934 | void *result = NULL; |
| 23935 | if (p->start_rule == Py_file_input) { |
| 23936 | result = file_rule(p); |
| 23937 | } else if (p->start_rule == Py_single_input) { |
| 23938 | result = interactive_rule(p); |
| 23939 | } else if (p->start_rule == Py_eval_input) { |
| 23940 | result = eval_rule(p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23941 | } else if (p->start_rule == Py_func_type_input) { |
| 23942 | result = func_type_rule(p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23943 | } else if (p->start_rule == Py_fstring_input) { |
| 23944 | result = fstring_rule(p); |
| 23945 | } |
| 23946 | |
| 23947 | return result; |
| 23948 | } |
| 23949 | |
| 23950 | // The end |